MCPcopy Create free account
hub / github.com/cxapython/catvm / pixel_is_equal

Method pixel_is_equal

geetest/recognition.py:18–34  ·  view source on GitHub ↗

判断两张图片的像素是否相等,不想等即为缺口位置 :param image1: :param image2: :param x: x坐标 :param y: y 坐标 :return:

(image1, image2, x, y)

Source from the content-addressed store, hash-verified

16
17 @staticmethod
18 def pixel_is_equal(image1, image2, x, y):
19 """
20 判断两张图片的像素是否相等,不想等即为缺口位置
21 :param image1:
22 :param image2:
23 :param x: x坐标
24 :param y: y 坐标
25 :return:
26 """
27 # 取两个图片的像素点
28 pixel1 = image1.load()[x, y]
29 pixel2 = image2.load()[x, y]
30 threshold = 60 # 像素色差
31 if abs(pixel1[0]-pixel2[0]) < threshold and abs(pixel1[1]-pixel2[1]) < threshold and abs(pixel1[2]-pixel2[2]) <threshold:
32 return True
33 else:
34 return False
35
36 def get_gap(self, image1, image2):
37 """

Callers 1

get_gapMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected