Code: Select all
import cv2
if __name__ == "__main__":
one_in = cv2.imread("one.jpg")
two_in = cv2.imread("two.jpg")
one = cv2.cvtColor(one_in, cv2.COLOR_BGRA2BGR)
two = cv2.cvtColor(two_in, cv2.COLOR_BGRA2BGR)
numPixels = 0
for y in range(one.shape[1]):
for x in range(one.shape[0]):
numPixels += 1
r = abs(float(one[x,y][0]) - float(two[x,y][0]))
g = abs(float(one[x,y][1]) - float(two[x,y][1]))
b = abs(float(one[x,y][2]) - float(two[x,y][2]))
diff = (r,g,b)
#print(str(diff) + str(numPixels))
Code: Select all
>               r = abs(float(self.reference_image_flat[x,y][0]) - float(self.captured_image_flat[x,y][0]))
E               TypeError: 'builtin_function_or_method' object is not subscriptable
 Mobile version
 Mobile version