Different result when (Bug #4436)
Description
I use LBPH face recognizer to find the similarity between 2 pictures of 1 person (one pics took in light condition and the other took in dark condition).
I know that in LBPH, the number of pics in training set doesn't matter as FisherFaces or EigenFaces.
So, I use pic 1 as base image, and pic 2 as the training set. When I train (pic2), then predict (pic1), the result is 105
Next, I use pic 2 as base image, and pic 1 as the training set. When I train (pic1), then predict (pic2), the result is 85
Meanwhile, I expect that the both of the 2 experiments must produce the same result.
Digging further in the source code, I find out that LBPH predict function use the function: compareHist( InputArray _H1, InputArray _H2, int method ). In this function, the LBPH assign the third parameter as: CV_COMP_CHISQR which is one of 4 method of comparing 2 histograms (CV_COMP_CORREL, CV_COMP_CHISQR, CV_COMP_INTERSECT, CV_COMP_BHATTACHARYYA)
I thought the problem is the formula of CV_COMP_CHISQR itself: http://docs.opencv.org/doc/tutorials/imgproc/histograms/histogram_comparison/histogram_comparison.html
In this formula, if I consider HISTOGRAM of pic 1 as H1, and HISTOGRAM of pic 2 as H2, the result of d(H1, H2) will be different from d(H2, H1)
So my suggestion is in order to avoid this, can you guy repare the compareHist in LBPH predict function to use CV_COMP_CORREL method. Thus, we can ensure that d(H1, H2) = d(H2, H1) and lead to predict(pic1) = predict(pic2).
Besides, I'm using opencv android sdk 2.4.11. It's great if somebody can fix this and regenerate the jar file for opencv android sdk.
Thanks!
History
Updated by Quang Huy Nguyen over 9 years ago
Please close this because I forgot to type the issue title before creating it.
I created a new one with the same content and meaningfull title
- Status changed from New to Cancelled