Fixed Bug #3514 Incorrect Chi-Square distance used in LBPH FaceRecognizer

This commit is contained in:
Ivy Lee 2014-01-30 21:53:05 +00:00
parent 77bbd65fa6
commit b7f2b671a2
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;
minClass = -1;
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)) {
minDist = dist;
minClass = _labels.at<int>((int) sampleIdx);

View File

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