如何使用 Ruby 检测人脸?
谁能告诉我如何使用 Ruby 或 Javascript 检测静态图片中的人脸?
Can anyone tell me how to detect faces in a static picture using Ruby or Javascript?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(12)
如果您打算尝试从头开始编写一些内容,可以使用 卡内基梅隆大学网站上对该过程的精彩解释 - 图形也很简洁。
然而,您最好的选择可能是尝试加入开源计算机视觉项目。这是关于使用 OpenCV 进行面部识别的好教程。
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.
由于这个有趣问题的其他答案现在大多已经过时,这里是 2012 年的解决方案:
使用 jQuery 和 jquery.objectdetect:
使用 jQuery 和 jquery.facedetection :
不使用 jQuery:这两个插件都基于完全不依赖于 jQuery 的独立库。
回复 @joeforker 谁说
或者你只需要等待一两年;)
Since the other answers to that interesting question are mostly outdated now, here the 2012 solution:
Using jQuery with jquery.objectdetect:
Using jQuery with jquery.facedetection:
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
Or you just have to wait a year or two ;)
看来您是编程新手。也许您拥有高等数学学位?如果您真的不明白 JQuery 可以检测人脸的概念是个笑话,那么您需要学习很多知识才能准备好检测人脸。如果幸运的话,您可以找到一个简单的开箱即用的解决方案。不幸的是,人脸识别属于一类往往缺乏简单的开箱即用解决方案的问题。 JavaScript 已经出来了。
http://rubyforge.org/projects/opencv/ 是与 OpenCV 的 Ruby 绑定。可怜的文档(仅自动生成的 API 文档)位于 http://doc.blueruby.mydns.jp/opencv / 提到了一个可能有帮助的face_detect.rb。与大多数绑定一样,您还应该查阅原始库的文档,例如 http://opencv.willowgarage。 com/wiki/FaceDetection
您还应该了解,人脸检测(这张照片中的人脸在哪里?)是一个与人脸识别(是谁的脸)不同且更容易的问题。
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).
我不知道这个问题是否得到了正确的回答或者你是如何解决的,但我最近自己也遇到了这个问题。我目前正在研究外部 API 来实施我的解决方案。我当前比较的两个 Ruby API 是 rdetection 和 Face.com 的 API
我主要将其用于使用 ImageMagick 进行面部感知图像裁剪,因此您的需求和结果可能会有所不同。
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.
可靠地检测人脸是计算机科学中的难题之一。实际上,您没有任何实用的方法可以使用 Ruby、JavaScript 或使用当前技术的任何其他应用程序语言来完成此操作。如果您告诉我们为什么需要检测人脸,那么我们也许可以建议一种实用的替代方法。
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.
收集大量现金并联系这些人 求一个好的解决方案!
Wikipedia 有一篇关于此的好文章,它也解释了为什么你要尝试做一些事情做起来仍然非常复杂。
FRGC 也很有趣...如果你确实找到了解决方案,你可以参加这个挑战。
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.
这是一个使用 Javascript 和使用 Mashape 的人脸识别 API 的人脸识别教程 - http://blog.mashape.com/post/45712257463/face-recognition-using-javascript-and-mashape
它还可以让您检测该人是否在微笑:)
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 :)
经过一些研究和这个线程的帮助后,我决定制作一个 rubygem,可以在这里找到:
编辑:
不幸的是,rekognize 决定停止他们的服务,使这个 Gem 过时。
这使用了 rekognition.com 的人脸识别 API。
After some research and help from this thread I've decided to make a rubygem which can be found here:
EDIT:
Unfortunately rekognize decided to discontinue their services making this Gem obsolete.
This uses the face recognition API from rekognition.com.
Javascript 神经网络已用于 OCR,所以应该是如果面部更难的话是可能的。
Javascript Neural Nets have been used for OCR so should be possible if much harder for faces.
人脸检测是使用基于密集内存的算法完成的,该算法实际上通过图像数据来检测人脸图案。它们可能有许多免费(或收费)的面部识别/模式识别算法和 API,您可以使用 Ruby 或 Javascript 来使用/实现它们。
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.
我知道这是一个老问题,但如果有人像我一样检查过这些问题:博客文章、测试页面和 < a href="https://github.com/liuliu/ccv/tree/unstable/js" rel="nofollow">Github。
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.
这应该可以帮助您开始。这是关于通过 FFI 将 OpenCV 与 Ruby 结合使用: http://rubysource .com/detecting-faces-with-ruby-ffi-in-a-nutshell/
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/