Ask Your Question
0

Face recognition - Get distance for all trained images

asked 2013-05-12 01:01:59 -0600

MH gravatar image

updated 2013-05-12 01:14:11 -0600

Hi,

I have just begun using OpenCV in the past week and i am hoping to get a little advice :).

I am currently using the FaceRecognizer to train a set of images and then use predict to compare a face against that trained set of images. This appears to be working fine, however it only retrieves the label with the best score whereas I was hoping to be able to retrieve the score and label for each trained image.

So say i have trained 10 images, i then have an image i want to compare against that trained set of images. My ideal output would be.

img1, distance

img2, distance

img3, distance

etc..

Is this possible?

Im not sure if it makes a big difference but i want to use each technique available and test the results. So Eigenfaces, Fisherfaces and LBP

So essentiall what im doing is.

Ptr<FaceRecognizer> model = createLBPHFaceRecognizer();
model->train(images , labels);
int predictedLabel;
double distance;
model->predict(testSample , predictedLabel , distance);

And essentially what i want is an array of labels and array of distance returned. Which isn't how it works haha.

edit retag flag offensive close merge delete

Comments

what do you want to do with that information ?

a real database won't have 10 images, more like 1000, so you'll pretty soon find out, that only the best result matters.

berak gravatar imageberak ( 2013-05-12 04:34:30 -0600 )edit

That's just an example, i do have a large database of images. I am doing a study where i require all of the results. And in real life if you have a large database it is possible to have multiple images with very close scores. So if that's the case the close matches should then be displayed to the user to allow them to decide.

MH gravatar imageMH ( 2013-05-12 06:50:26 -0600 )edit

ah, ok. that would be more a knn-search instead of the current nearest neighbour one

maybe this related question helps

berak gravatar imageberak ( 2013-05-12 08:46:12 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2013-05-12 08:59:56 -0600

MH gravatar image

updated 2013-05-12 09:00:27 -0600

Yeah that does seem to be what i am looking for!, i shall give it a go when i get home.

Thanks for that, it's very helpful :)

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-05-12 01:01:59 -0600

Seen: 2,157 times

Last updated: May 12 '13