How can I detect faces using Ruby?

亡梦爱人 提交于 2019-12-03 09:45:01

问题


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


回答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.




回答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 ;)




回答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).




回答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.




回答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.




回答6:


Collect a lot of cash and contact these guys for a good solution!

Wikipedia has a good article about this which also explains why you're trying to do something that is still extremely complex to do.

FRGC is also interesting... If you do find a solution, you can take part in this challenge.




回答7:


This is a face recognition tutorial using Javascript and face recognition APIs using Mashape - http://blog.mashape.com/post/45712257463/face-recognition-using-javascript-and-mashape

It also lets you detect if the person is smiling or not :)




回答8:


Javascript Neural Nets have been used for OCR so should be possible if much harder for faces.




回答9:


After some research and help from this thread I've decided to make a rubygem which can be found here: https://github.com/dennisdevulder/rekognize

This uses the face recognition API from rekognition.com.




回答10:


Face detection is done using intensive memory based algorithms, which actually go through the image data to detect face like patterns. They may be many facial recognition / Pattern recoginition algorithms and APIS available for free (or for a fee) which you can use/implement with Ruby or Javascript.




回答11:


I know this is an old question, but if anyone happens on it like I did check these out: blog post, test page, and Github.




回答12:


This should get you started. It's about using OpenCV with Ruby via FFI: http://rubysource.com/detecting-faces-with-ruby-ffi-in-a-nutshell/



来源:https://stackoverflow.com/questions/1399748/how-can-i-detect-faces-using-ruby

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!