Face Detection - where to start

Firstly, I’ve been away from Xojo for 7 or 8 months but was always a database guy, not into graphics.

It seems facial recognition/detection software is popping up all over the place and I’d like to try my hand at developing something.

I’m first thinking at least getting to the point of detecting a face in a photograph. My problem is, where do I start? Some pseudo code to get me started would be most helpful. I’m assuming the guts of the coding would be around the Picture control and examination of pixels but after that I’m at a loss as to how to examine said pixels. Hey, my assumption may be way off as well, but any help would be appreciated.

Cheers,

Steve.

If you have money, you could license a C++ library which does it and let someone like me make a plugin for you.

Or a plugin that call OpenCV?
OpenCV

This is built-in to Core Image and can be done in a few lines of code but obviously this confines you to OS X (and iOS). Still, depending on your needs, it might be less work than building your own in Xojo… (there are tonnes of tutorials out there or PM me)

For CoreImage Face Detection, I have classes in MBS Plugin. See example project “FaceDetection”.
But that’s for finding faces, not for detecting who belongs to that face.

Thanks for responses everyone, I should say I’m coming from a learning point of view so I don’t have any time constraints and plus it’s not my day job.

Thanks, PM sent.

[quote=66574:@Christian Schmitz]For CoreImage Face Detection, I have classes in MBS Plugin. See example project “FaceDetection”.
But that’s for finding faces, not for detecting who belongs to that face.[/quote]

I clicked on the ‘Answer’ button by mistake, not sure how to remove it. I was wanting to click on the ‘Quote’ button.

I checked your website but I’m unable to find any information regarding Face Detection. Can you supply a link which explains this function along with any other related functions?

no problem:

CIFaceFeatureMBS class is documented here:
https://www.monkeybreadsoftware.net/class-cifacefeaturembs.shtml

example project is included with plugin examples, but you can see code online here:
https://www.monkeybreadsoftware.net/example-macosx-facedetection.shtml

CIDetectorMBS class is described here:
https://www.monkeybreadsoftware.net/class-cidetectormbs.shtml

I see Mac OS X 10.9 brings new detectors for eye blink and smile, so I can update my plugin later today.

I’m no expert, but I’ve been recently playing around with Perceptual Hashes. Take a look at this link:

http://www.hackerfactor.com/blog/?/archives/432-Looks-Like-It.html

I’ve made a simple implementation of the first algorithm on that page (the average hash) and it’s remarkably accurate for something so simple. It’s great at finding identical or very similar images. I guess for face recognition you may need to implement the more complex pHash version as it’s better at dealing with differences in images. For my needs the average hash is OK as it’s good at finding identical (even varying in size) or very similar images.

I guess you’re going to need to first find the faces in the image (using CoreImage face detection through MBS perhaps?) and then make a Perceptual Hash of the face area. Then you can compare the hashes and see the % difference between them.

There’s an open source hash library call pHash that may help: http://www.phash.org/

Hope this helps, I’d be interested in hearing how you progress!

[quote=66783:@Richard Vivash]I’m no expert, but I’ve been recently playing around with Perceptual Hashes. Take a look at this link:

http://www.hackerfactor.com/blog/?/archives/432-Looks-Like-It.html

I’ve made a simple implementation of the first algorithm on that page (the average hash) and it’s remarkably accurate for something so simple. It’s great at finding identical or very similar images. I guess for face recognition you may need to implement the more complex pHash version as it’s better at dealing with differences in images. For my needs the average hash is OK as it’s good at finding identical (even varying in size) or very similar images.

I guess you’re going to need to first find the faces in the image (using CoreImage face detection through MBS perhaps?) and then make a Perceptual Hash of the face area. Then you can compare the hashes and see the % difference between them.

There’s an open source hash library call pHash that may help: http://www.phash.org/

Hope this helps, I’d be interested in hearing how you progress![/quote]

I mentioned this style of algorithm in another post. It’s fantastic for image comparison purposes. A problem is that the fingerprint is of the image itself and not of the face, though.

https://forum.xojo.com/8757-best-method-to-compare-pictures/p1#p61860

I have other apps using OpenCV in Windows and Linux that I would like to try in Xojo. Any hints out there? Thanks

Are you trying to identify any face? or match against a “known” face in particular?

Christian Schmitz

I would like to get OpenCV functions in Xojo.

I was wondering this as well because it is actually far more difficult than people think. I had a client who wanted to do facial recognition for children and they looked at how it would be possible. You will find (quick Google search) a growing number of libraries that do it but be aware that the vast majority of them do it badly and the risk of false-positives is massive. They will all work ok if you have a consistent solid background, you have lighting exactly correct with no shadows and you have the person looking directly at the camera. Many of the libraries will put a wire-frame outline on the screen you are looking at to line up your eyes, nose etc to it so that they can increase the accuracy but the really impressive solutions cost a lot of money.

I have several real-time camera-based projects completed that use OpenCV in both mswindows and Linux. I suppose I could run both executables concurrently and pass info through files, but I was hoping to do something cleaner, with only one executable and common graphic window(s)…

Hi Christian,

I just downloaded MBS-Xojo-Plugins174 but I am not finding finding your example project “FaceDetection”.

Kindly assist.

Thanks.

Lennox

How about the one named “FaceDetection” in the MacCG folder in examples?

Thanks Christian,

What is the cost for this plugin?

Lennox

Have you tried https://github.com/ldci/OpenCV-Xojo? It works really well.

Thanks Matthew,

I am having a problem here…
Just unzip the downloaded file and open OpenCVX code with Xojo IDE.

How do I do that? It just not happening.

This binding requires OpenCV 3.0
Does that mean that I must install OpenCV 3.0 on my computer? With Homebrew?

Lennox