Jun-07-2018, 02:31 AM
(Jun-07-2018, 01:55 AM)scidam Wrote: You can use numpy to do such comparison, e.g.
import numpy as np img_a_array = np.array(img_a_pixels) img_b_array = np.array(img_b_pixels) difference = (img_a_array == img_b_array).sum()Also, you can use the threshold to specify colors similarity, e.g.
threshold = 2 difference_with_threshold = (np.abs(img_a_array - img_b_array) <= threshold).sum()
Cool, I will do some speed comparisons with the numpy code that you provided. Thank you.
I use the threshold and comparison counter method for determining how much of an image is black or white.