Ask Your Question

confidence value and threshold in opencv

asked 2013-04-21 07:32:27 -0500

agile gravatar image

What is the difference between "confidence" value in Face Recognizer predict method and "threshold" in model consrtuctor?

I want to just grab the LBP histogram from the source image and compare it with the previous stored LBP Histograms and I want a probabilistic match. Like top three matches. I am presently grabbing the LBP Histogram through train method and I want a set of distances from the predict method not just a single predicted label.


edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-04-21 07:54:05 -0500

berak gravatar image

the 'confidence' value is actually the distance between the test and the closest found image.

the 'threshold' value passsed into the constructor is used in the predict method, any distance greater than that is ignored (thresholded).

unfortunately, to achieve more than one result, you'd have to hack the source, or copy parts of it into your source code (contrib/src/facerec.cpp).

don't be afraid of it, the code is quite easy.

good luck!

edit flag offensive delete link more


if confidence is the distance between test and the closest it means it is the distance return by CompareHist. i.e "dist" in the code: double dist = compareHist(_histograms[sampleIdx], query, HISTCMP_CHISQR);

If that is the case, then why the dist is compared with minDist (which is confidence value). if((dist < minDist) && (dist < _threshold)) {..}

agile gravatar imageagile ( 2013-04-21 08:21:44 -0500 )edit

dist is Not the distance between test and the closest , but distance between test and the current item from the train set.

from there on its just a nearest-neighbour search

berak gravatar imageberak ( 2013-04-21 09:09:25 -0500 )edit

Thanks. I am doing it for android and using JavaCV. But I don't know if it source is available in JavaCV. But I can write my own predict method. i just need comareHist which is available in android opencv and javacv as well.

agile gravatar imageagile ( 2013-04-22 05:53:59 -0500 )edit

Question Tools


Asked: 2013-04-21 07:32:27 -0500

Seen: 5,175 times

Last updated: Apr 21 '13