Commit b7f2b671 authored by Ivy Lee's avatar Ivy Lee

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

parent 77bbd65f
...@@ -833,7 +833,7 @@ void LBPH::predict(InputArray _src, int &minClass, double &minDist) const { ...@@ -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);
......
...@@ -203,7 +203,8 @@ enum { HISTCMP_CORREL = 0, ...@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment