|
|
楼主 |
发表于 2020-7-29 16:38:23
|
显示全部楼层
|
ces库
from PIL import Image
def get_snap(n):
snap_obj=Image.open(str(n)+'000.png')
return snap_obj
threhold=60
#img1=get_snap(1)
#img2=get_snap(2)
a=0
b=0
def get_distance():
a=0
img1=get_snap(1)
img2=get_snap(2)
for i in range(60,200):
for j in range(159):
print(i,j)
rgb1=img1.load()[i,j]
rgb2=img2.load()[i,j]
#rgb1 = img1.getpixel((i,j))
#rgb2 = img2.getpixel((i,j))
print(rgb1,rgb2)
res1=abs(rgb1[0]-rgb2[0])
res2=abs(rgb1[1]-rgb2[1])
res3=abs(rgb1[2]-rgb2[2])
print(res1,res2,res3)
print('-------------------------------')
if (res1>=threhold and res2>=threhold and res3>=threhold):
print('normal')
a+=1
print(i)
if a==1:
b=i
break
return b-7
#break
print('*****************************')
#print(get_distance())
|
|