Looking at the Histogram Documentation, there are 4(5) different comparison methods:
They all give different outputs that are read differently as shown in the Compare Histogram Documentation. But I can't find anything that states how effectively each method performs compared against each other. Surely there are Pros and Cons for each method, otherwise why have multiple methods?
Even the OpenCV 2 Computer Vision Application Programming Cookbook has very little to say on the differnces:
The call to cv::compareHist is straightforward. You just input the two histograms and the function returns the measured distance. The specific measurement method you want to use is specified using a flag. In the ImageComparator class, the intersection method is used (with flag CV_COMP_INTERSECT). This method simply compares, for each bin, the two values in each histogram, and keeps the minimum one. The similarity measure is then simply the sum of these minimum values. Consequently, two images having histograms with no colors in common would get an intersection value of 0, while two identical histograms would get a value equal to the total number of pixels.
The other methods available are the Chi-Square (flag CV_COMP_CHISQR) which sums the normalized square difference between the bins, the correlation method (flag CV_COMP_CORREL) which is based on the normalized cross-correlation operator used in signal processing to measure the similarity between two signals, and the Bhattacharyya measure (flag CV_COMP_BHATTACHARYYA) used in statistics to estimate the similarity between two probabilistic distributions.
There must be differences between the methods, so my question is what are they? and under what circumstances do they work best?
CV_COMP_INTERSECT is fast to compute since you just need the minimum value for each bin. But it will not tell you much about the distribution of the differences. Other methods try to achieve better and more continuous score as a match, under different assumptions about the pixel distribution.
You can find the formulae used in different methods, at
http://docs.opencv.org/doc/tutorials/imgproc/histograms/histogram_comparison/histogram_comparison.html
Some references to more details on the matching algorithms can be found at:
http://siri.lmao.sk/fiit/DSO/Prednasky/7%20a%20Histogram%20based%20methods/7%20a%20Histogram%20based%20methods.pdf
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With