通过对AndroidViewclient 5.1.1使用sameAs函数进行图像同步

时间:2014-07-08 09:54:17

标签: android androidviewclient

您好我正在尝试使用AndroidViewClient 5.1.1帮助比较图像以下是我编写的代码,但始终是打印两个图像都不一样。这是使用sameAs函数的正确方法吗?如果没有,请告诉我使用它的正确方法。

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时我们用来加载图片..我们还要加载新版本。

1 个答案:

答案 0 :(得分:0)

你需要知道图像的比较是逐像素的。

也就是说,它将image1的像素1与image2的像素1,image1的2与Picture2的2进行比较,依此类推。

因此,您必须确保比较相同或不相同的图像,以测试您的代码。

编辑:Android Reference Developer