Ask Your Question
0

Printing distance vector for all faces in OpenCV Python FaceRecognizer class

asked 2017-04-06 05:18:32 -0600

Kordian gravatar image

I'm working with OpenCV 2.4.9.1, Python 2.7.9 and using FaceRecognizer class for my real-time face recognition university project. Need to do some research about existing algorithms (Eigenface, Fisherface, LBPH) and plot some data. Normally each algorithm is checking in certain way similarity of faces from database to that real one and append label with lowest coefficient. Is there any way to get predictions of all faces in database to one face that is in front of the camera, so I could draw some affilation function for each person or some face-distance graph?? It would be quite helpful in my analysis part of work. I saw that people can do that probably in C++ or when using SVM but no examples how to do it in python with existing opencv algorithms.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2017-04-06 05:25:47 -0600

berak gravatar image

updated 2017-04-06 05:33:08 -0600

there's no such option in opencv2.4.9 (the distance vectors are hidden behind the (C++) interface) . either:

edit flag offensive delete link more

Comments

Thanks, just compiled OpenCV 3.2 on my Raspberry Pi 3. Any idea how can I call this function "predict overload" in Python? Was looking into OpenCV 3.2.0 documentation, but nothing found :(. Is it some kind of array of results on output with all distance coefficients, that I could plot later?

Kordian gravatar imageKordian ( 2017-04-06 14:07:46 -0600 )edit
1

i can only guess, but looking here it seems like:

collector = cv2.face.StandardCollector_create()
model.predict_collect( queryimg, collector );
list_of_conf_id_tuples = collector.getResults();
berak gravatar imageberak ( 2017-04-07 01:59:01 -0600 )edit

StandardCollector not found, the same with PredictCollector :/. I checked in docs both of them:

http://docs.opencv.org/3.2.0/d4/d8d/classcv_1_1face_1_1StandardCollector.html#abd1bca19318b57f976677faf31a8cd03 (http://docs.opencv.org/3.2.0/d4/d8d/c...)

http://docs.opencv.org/3.2.0/da/d6a/classcv_1_1face_1_1PredictCollector.html (http://docs.opencv.org/3.2.0/da/d6a/c...)

I'm calling it with: collector = cv2.face.StandardCollector() and getting on output: module object has no attribute 'StandradCollector'

Kordian gravatar imageKordian ( 2017-04-07 05:15:54 -0600 )edit

sorry, cv2.face.StandardCollector_create() (underscore !)

please check >>> help(cv2.face)

berak gravatar imageberak ( 2017-04-07 05:20:45 -0600 )edit

Yees, its's working! Thank you so much for your help, really appreciate it. Now I need to figure out how to plot something from this output. Maybe I can ask for another thing, since my first run OpenCV 3.2 on RPi3 I've got some artifacts in displayed screen in places where text is shown (label with confidence for recognized person and date time). Earlier when I was using OpenCV 2.4 everything was fine. Any idea why is happening like this? Photo below: [http://imgur.com/a/XOf41]

Kordian gravatar imageKordian ( 2017-04-07 07:42:56 -0600 )edit

@Kordian, ask a new question, and show your code ?

berak gravatar imageberak ( 2017-04-07 07:50:06 -0600 )edit
1

Question Tools

1 follower

Stats

Asked: 2017-04-06 05:18:32 -0600

Seen: 589 times

Last updated: Apr 06 '17