Help with face recognition - ofxCvFaceRec

Hello openframeworkers!
Just a few days ago I convinced my self to dive into the amazing world of OpenFrameworks with a project in mind.

I want to track and recognize faces from the webcam, so I am looking around for libraries and example code to try out before the actual implementation. I’ve already managed to track faces both using the ofxOpenCv addon as well as ofxCv which seems to be faster and as far as I read better to use this than the first. (is that right you think?)

Moving on with a basic face recognition test, I manage to get some results by copy pasting code from this example project into mine .

With further looking online, I came across this class which seems to be a nicer approach. But correct me if I am wrong, it seems that this was written for an older version of openframeworks, or VisualStudio and it can’t compile. It doesn’t even have a ofApp.cpp file. Why is that?

I may be missing something fundamental here, but I am still trying to figure out how things work with visualStudio, c++, openframeworks and how to bring in additional libraries.

What do I need to do to add it to my project, or even run the testApp that comes with it?
Or is there maybe another easy to use class/library to consider using?

thank you

Ok, after refreshing my memory about some of the basics of c++ with pointers and the other structure types, I managed to go through all the errors and successfully compile the library and its testApp. From what I read, it seems like this library was written with an older version of OF and since then ofPixels and ofImage class have changed a bit.
ie: getPixelsRef no longer exist and I had to use the getPixels() function twice to get the pixels in an unsigned * char format that the library uses.
unsigned char * pixels = vidGrabber.getPixels().getPixels();

I am not sure if my fixes are the best ones, since I am still figuring things out. I can provide the code if anyone is interested to review and add it back to the github

I now need to work out how to test and use this class on my own project.

have you seen this:

no I haven’t. I will definitely give it a try at home later on. Thank you for pointing me to that.

I managed to put together a test app with a bunch a photos, create an eigenfaces model and compare them, but it doesn’t seem to work very well for me. I downloaded a dataset of face photos from an online database and also added 10 photos of my self. I use the ofxCv to detect my face in the camera feed, I crop the image and feed it to the model, but the confidence value I get back is not that different to a face that is not included in the set. For easier testing, I am overlaying a photo of a person on top of the camera frame, before passing it to the model.

Maybe I should try what you describe in gitHub, to first eye align and crop both training images and camera feed, so they match as much as possible testing them against each other.

My end goal is to make a system that constantly detects faces from the camera, but captures only one photo for each person. So I am looking into face recognition to avoid duplicates.

ideally we would get this to work in OF

1 Like