Merge pull request #2237 from ivylee:lbph_chi_square_alt

This commit is contained in:
Roman Donchenko 2014-01-31 12:22:24 +04:00 committed by OpenCV Buildbot
commit 1f3206af70
2 changed files with 3 additions and 2 deletions

View File

@ -833,7 +833,7 @@ void LBPH::predict(InputArray _src, int &minClass, double &minDist) const {
minDist = DBL_MAX; minDist = DBL_MAX;
minClass = -1; minClass = -1;
for(size_t sampleIdx = 0; sampleIdx < _histograms.size(); sampleIdx++) { for(size_t sampleIdx = 0; sampleIdx < _histograms.size(); sampleIdx++) {
double dist = compareHist(_histograms[sampleIdx], query, HISTCMP_CHISQR); double dist = compareHist(_histograms[sampleIdx], query, HISTCMP_CHISQR_ALT);
if((dist < minDist) && (dist < _threshold)) { if((dist < minDist) && (dist < _threshold)) {
minDist = dist; minDist = dist;
minClass = _labels.at<int>((int) sampleIdx); minClass = _labels.at<int>((int) sampleIdx);

View File

@ -203,7 +203,8 @@ enum { HISTCMP_CORREL = 0,
HISTCMP_CHISQR = 1, HISTCMP_CHISQR = 1,
HISTCMP_INTERSECT = 2, HISTCMP_INTERSECT = 2,
HISTCMP_BHATTACHARYYA = 3, HISTCMP_BHATTACHARYYA = 3,
HISTCMP_HELLINGER = HISTCMP_BHATTACHARYYA HISTCMP_HELLINGER = HISTCMP_BHATTACHARYYA,
HISTCMP_CHISQR_ALT = 4
}; };
//! the color conversion code //! the color conversion code