Revision history [back]

Hello, I need to compare two histograms for my project. I am working on normalized histograms by using the following function call:

//Assuming that histogram is a cv::Mat and is valid
cv::normalize(histogram, histogram, 1.0);


I am using cv::compareHist() to compare the histograms. I have tried the all four methods for comparison with OpenCV macros: CV_COMP_CORREL, CV_COMP_CHISQR, CV_COMP_INTERSECT, CV_COMP_BHATTACHARYYA.

The problem is that: When analyzing the comparison results, CV_COMP_INTERSECT comparison method produce values bigger than 1 although two histograms are normalized. It is stated on Learning OpenCV: Computer Vision with the OpenCV library (page 202):

If both histograms are normalized to 1, then a perfect match is 1 and a total mismatch is 0.