Implemented Kullback-Leibler divergence

This commit is contained in:
pradeep
2014-05-17 23:44:31 +08:00
parent ada2879faa
commit c5b4b99350
5 changed files with 39 additions and 4 deletions

View File

@@ -181,6 +181,8 @@ Compares two histograms.
* **CV_COMP_HELLINGER** Synonym for ``CV_COMP_BHATTACHARYYA``
* **CV_COMP_KL_DIV** Kullback-Leibler divergence
The functions ``compareHist`` compare two dense or two sparse histograms using the specified method:
* Correlation (``method=CV_COMP_CORREL``)
@@ -224,6 +226,12 @@ The functions ``compareHist`` compare two dense or two sparse histograms using t
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)}}
* Kullback-Leibler divergence (``method=CV_COMP_KL_DIV``).
.. math::
d(H_1,H_2) = \sum _I H_1(I) \log \left(\frac{H_1(I)}{H_2(I)}\right)
The function returns
:math:`d(H_1, H_2)` .