Я думаю, это довольно просто. Просто вычислите математику из справочника Википедии. Вот решение только для Python / OpenCV / Numpy.
Вход A:
Вход B:
import cv2
import numpy as np
# read image_A and convert to float
image_A = cv2.imread('barn.jpg').astype("float32")
# read image_B as grayscale and convert to float
image_B = cv2.imread('barn_mod.jpg').astype("float32")
# convert image_A and image_B from BGR to LAB
image_A = cv2.cvtColor(image_A,cv2.COLOR_BGR2LAB)
image_B = cv2.cvtColor(image_B,cv2.COLOR_BGR2LAB)
# compute difference
diff = cv2.add(image_A,-image_B)
# separate into L,A,B channel diffs
diff_L = diff[:,:,0]
diff_A = diff[:,:,1]
diff_B = diff[:,:,2]
# compute delta_e as mean over every pixel using equation from
# https://en.wikipedia.org/wiki/Color_difference#CIELAB_ΔE*
delta_e = np.mean( np.sqrt(diff_L*diff_L + diff_A*diff_A + diff_B*diff_B) )
# print results
print (delta_e)
delta_e:
0.29771116
См. Также:
https://python-colormath.readthedocs.io/en/latest/delta_e.html
https://python-colormath.readthedocs.io/en/latest/_modules/colormath/color_diff.html
https://github.com/scikit-image/scikit-image/blob/master/skimage/color/delta_e.py