enum cv::HistCompMethods
Overview
Histogram comparison methods Moreā¦
#include <imgproc.hpp> enum HistCompMethods { HISTCMP_CORREL = 0, HISTCMP_CHISQR = 1, HISTCMP_INTERSECT = 2, HISTCMP_BHATTACHARYYA = 3, HISTCMP_HELLINGER = HISTCMP_BHATTACHARYYA, HISTCMP_CHISQR_ALT = 4, HISTCMP_KL_DIV = 5, };
Detailed Documentation
Histogram comparison methods
Enum Values
HISTCMP_CORREL
Correlation
\[d(H_1,H_2) = \frac{\sum_I (H_1(I) - \bar{H_1}) (H_2(I) - \bar{H_2})}{\sqrt{\sum_I(H_1(I) - \bar{H_1})^2 \sum_I(H_2(I) - \bar{H_2})^2}}\]
where
\[\bar{H_k} = \frac{1}{N} \sum _J H_k(J)\]
and \(N\) is a total number of histogram bins.
HISTCMP_CHISQR
Chi-Square
\[d(H_1,H_2) = \sum _I \frac{\left(H_1(I)-H_2(I)\right)^2}{H_1(I)}\]
HISTCMP_INTERSECT
Intersection
\[d(H_1,H_2) = \sum _I \min (H_1(I), H_2(I))\]
HISTCMP_BHATTACHARYYA
Bhattacharyya distance (In fact, OpenCV computes Hellinger distance, which is related to Bhattacharyya coefficient.)
\[d(H_1,H_2) = \sqrt{1 - \frac{1}{\sqrt{\bar{H_1} \bar{H_2} N^2}} \sum_I \sqrt{H_1(I) \cdot H_2(I)}}\]
HISTCMP_HELLINGER
Synonym for HISTCMP_BHATTACHARYYA.
HISTCMP_CHISQR_ALT
Alternative Chi-Square
\[d(H_1,H_2) = 2 * \sum _I \frac{\left(H_1(I)-H_2(I)\right)^2}{H_1(I)+H_2(I)}\]
This alternative formula is regularly used for texture comparison. See e.g. [67]
HISTCMP_KL_DIV
Kullback-Leibler divergence
\[d(H_1,H_2) = \sum _I H_1(I) \log \left(\frac{H_1(I)}{H_2(I)}\right)\]