Skip to content Skip to sidebar Skip to footer

How Can I Detect Faces Using Ruby?

Can anyone tell me how to detect faces in a static picture using Ruby or Javascript?

Solution 1:

If you are going to try and write something from scratch, there is a great explanation of the process on the Carnegie Mellon Website - neat graphics too.

However, your best bet is probably trying to hook into the Opensource Computer Vision project. Here is a good tutorial on using OpenCV for facial recognition.

Solution 2:

Since the other answers to that interesting question are mostly outdated now, here the 2012 solution:

Using jQuery with jquery.objectdetect:

$("#faces").objectdetect("all", {classifier: objectdetect.frontalface}, function(coords) {
    // Do something with the face coordinates
});

Using jQuery with jquery.facedetection:

var coords = $("#faces").faceDetection();
// Do something with the face coordinates

Not using jQuery: Both plugins are based on stand-alone libraries that do not depend on jQuery at all.


In reply to @joeforker who said

"If you really don't understand that the notion JQuery can detect faces is a joke, you need to learn a lot before you will be ready to detect faces."

Or you just have to wait a year or two ;)

Solution 3:

It looks like you are new to programming. Perhaps you have an advanced mathematics degree? If you really don't understand that the notion JQuery can detect faces is a joke, you need to learn a lot before you will be ready to detect faces. If you're lucky you can find an easy out-of-the-box solution. Unfortunately, face recognition is in the class of problems that tend to lack easy out of the box solutions. JavaScript is right out.

http://rubyforge.org/projects/opencv/ is a Ruby binding to OpenCV. The pitiful documentation (autogenerated API docs only) at http://doc.blueruby.mydns.jp/opencv/ mentions a face_detect.rb that might be helpful. As with most bindings, you should also consult the documentation for the original library e.g. http://opencv.willowgarage.com/wiki/FaceDetection

You should also understand that face detection (where are the faces in this photo?) is a different and easier problem than face recognition (whose face is it).

Solution 4:

I do not know if this question was properly answered or how you resolved it, but I recently encountered this problem myself. I'm currently investigating external API's to implement my solution. The two Ruby API's that I am currently comparing are rdetection and Face.com's API

I'm primarily using it for face-aware image-crop using ImageMagick, so your needs and results may differ.

Solution 5:

Detecting faces reliably is one of the hard problems in Computer Science. Realistically, there's no practical way for you to do it using Ruby, JavaScript or any other application language using current technology. If you tell us why you need to detect faces then we might be able to suggest a practical alternative approach.

Post a Comment for "How Can I Detect Faces Using Ruby?"