大家好,我正在尝试用AndroidViewClient 5.1.1比较图片,下面是我写的代码,但总是打印两张图片不一样。这是使用相同函数的正确方式吗?如果没有,请告诉我正确的使用方法。
from PIL import Image
image1=('Smell.jpg')
image2=('Smell1.jpg')
if sameAs(image1, image2, percent=1.0):
print "Both Images are same"
else:
print"Both images are not same"在使用monkeyRunner时,我们使用它来加载图像。我们还需要加载新版本吗?
发布于 2014-07-08 18:15:00
您需要知道图像的比较是逐个像素进行的。
也就是说,它将image1的像素1与image2的像素1、image1的2与Picture2的2进行比较,依此类推。
因此,您必须确保比较相同或不相同的图像,以测试您的代码。
编辑:Android Reference Developer
https://stackoverflow.com/questions/24628830
复制相似问题