OpenCV Histogram Comparison Methods

In the histogram documentation, there are 4 (5) different comparison methods:

  • CV_COMP_CORREL Correlation
  • CV_COMP_CHISQR Chi-Square
  • CV_COMP_INTERSECT Intersection
  • CV_COMP_BHATTACHARYYA Distance Bhattacharya
  • CV_COMP_HELLINGER Synonym for CV_COMP_BHATTACHARYYA

All of them give different outputs, which are read in different ways, as shown in the Comparison of the histogram documentation . But I can’t find anything that indicates how efficiently each method compares with each other. Of course, there are pros and cons for each method, otherwise why are there several methods?

Even OpenCV 2, "A Book on PC Software Programming," says very little about the differences:

Calling cv :: compareHist is simple. You simply enter two histograms, and the function returns the measured distance. the specific measurement method you want to use is indicated using the flag. The ImageComparator class uses the intersection method (with the CV_COMP_INTERSECT flag) . This method simply compares for each bin two values ​​in each histogram and keeps a minimum. a measure of similarity is simply the sum of these minimum values. Therefore, two images having histograms without common colors would get an intersection value of 0, and two identical histograms would get a value equal to the total number of pixels.

Other available methods are Chi-Square (flag CV_COMP_CHISQR) which summarizes the normalized square difference between the bunkers, the correlation method (flag CV_COMP_CORREL) , which is based on the normalized cross-correlation operator used to process the signals, measure the similarity between the two signals, and Bhattacharya measurePYBAT ) used in statistics to assess the similarity between two probability distributions.

There should be differences between the methods, so my question is what is it? and under what circumstances do they work best?

+6
source share
1 answer

CV_COMP_INTERSECT is quickly calculated, because you just need the minimum value for each bin. But this does not tell you about the distribution of differences. Other methods try to achieve a better and more continuous score in accordance with various assumptions about the distribution of pixels.

You can find the formulas used in different methods in

http://docs.opencv.org/doc/tutorials/imgproc/histograms/histogram_comparison/histogram_comparison.html

Some links to more detailed information about matching algorithms can be found at:

http://siri.lmao.sk/fiit/DSO/Prednasky/7%20a%20Histogram%20based%20methods/7%20a%20Histogram%20based%20methods.pdf

+1
source

Source: https://habr.com/ru/post/987269/


All Articles