Reputation: 1135
Would like to ask if anyone has or can point me to a fast implementation of a function that calculates the joint histogram between two images?
Thanks
Upvotes: 1
Views: 3570
Reputation: 480
Calculating the joint histogram between multiple images works directly with cv2.calcHist() as well. The trick is to pass an array of the images you want to have in the joint histogram. Then, you have to select the channels that should end up in the histogram. The channel numbering is described here.
This is a short example code in Python that calculates the joint histogram between im1 and im2:
im1 = cv2.imread(im1_path, cv2.CV_LOAD_IMAGE_GRAYSCALE)
im2 = cv2.imread(im2_path, cv2.CV_LOAD_IMAGE_GRAYSCALE)
h = cv2.calcHist( [im1, im2], [0, 1], None, [256, 256], [0, 256, 0, 256] )
Upvotes: 0