I was trying to track how much next picture differs from the previous one, assuming some movement in the scene. Decided to apply subtraction of corresponding pixel values between two jpg images and then calculate the mean value of the resulting matrix in order to check if it's below or under some threshold level (for further analysis).
Subtraction was done by cv2.subtract and np.subtract methods. I've noticed quite big differences in the result. It seems like numpy somehow stretched the histogram and normalized resulting values, but why?
Images were loaded via cv2.open. I know this method use BGR order of channels but it doesn't explain what happened. Loaded images are numpy nd.array with np.uint values. Working on Spyder with Python 3.7.
Edit: argument 0 in cv2.imread tells to load image in greyscale
#loading images
img_cam0 = cv2.imread(r'C:\Users\Krzysztof\Desktop\1.jpg',0)
img_cam1 = cv2.imread(r'C:\Users\Krzysztof\Desktop\2.jpg', 0)
print('img0 type:',type(img_cam0), 'and shape:', img_cam0.shape)
print('img1 type:',type(img_cam1),'and shape:', np.shape(img_cam1))
print('\n')
#opencv subtraction
cv2_subt = cv2.subtract(img_cam0,img_cam1)
cv2_mean = cv2.mean(cv2_subt)
print('open cv mean is:', cv2_mean)
f.show_im(cv2_subt, 'cv2_subtr')
#np subtraction and mean
np_subtr = np.subtract(img_cam0, img_cam1)
np_mean = np.mean(np_subtr)
print('numpy mean is:', np_mean)
f.show_im(np_subtr, 'np_subtr')