用眼睛、嘴巴、耳朵……在 Javascript 中进行人脸识别
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17719285/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Face recognition with eye, mouth, ears.. in Javascript
提问by arlg
I was wondering and searching for information about face recognition using Canvas, and specifically how to detect the parts of a face.
我想知道并搜索有关使用 Canvas 进行人脸识别的信息,特别是如何检测人脸的各个部分。
Let's say I take a picture from my webcam, and then I want to detect the eyes, mouth, nose and ears to split them into different images.
假设我从我的网络摄像头拍了一张照片,然后我想检测眼睛、嘴巴、鼻子和耳朵,将它们分成不同的图像。
What would be the process for doing this ?
这样做的过程是什么?
采纳答案by roger_that
You can use HTML5's getUserMediaand also headtrackr.jsto achieve what you are looking for. Also, then you can detect objects, get access to user media and many more things. Hope this is what you are looking for.
您可以使用 HTML5 的getUserMedia和headtrackr.js来实现您想要的。此外,您还可以检测对象、访问用户媒体等等。希望这是你正在寻找的。
回答by Tomasz Szarzyński
What i did recently trying to solve same problem (face and eyes detection) was:
我最近试图解决同样的问题(面部和眼睛检测)是:
Scale down processed image to achieve decent performance (I downscaled everything to 320px width)
Detect face in image using Core Computer Vision Library - https://github.com/liuliu/ccv
Based on the detected face rectangle information detect eyes using HAAR object detector (it has cascade for eyes only detection - https://github.com/inspirit/jsfeat
缩小处理后的图像以获得不错的性能(我将所有内容缩小到 320px 宽度)
使用核心计算机视觉库检测图像中的人脸 - https://github.com/liuliu/ccv
基于检测到的人脸矩形信息,使用 HAAR 对象检测器检测眼睛(它具有仅用于眼睛检测的级联 - https://github.com/inspirit/jsfeat)
For step 2 i also used "grayscale" and "equalize_histogram" from JSFEAT library.
对于第 2 步,我还使用了 JSFEAT 库中的“灰度”和“均衡直方图”。
Also if step 3 fails you can try to guess eyes position (depends on how high accuracy you're going for).
此外,如果第 3 步失败,您可以尝试猜测眼睛的位置(取决于您要达到的准确度有多高)。
This workflow gave me satisfying results and performance. It tested it both on desktop (~500ms on iMac) and mobile devices (~3000ms on iphone 4 using image from webcam). Unfortunately I cannot post a link to working example at this point, but i'll post a link to github once i have something there.
这个工作流程给了我令人满意的结果和性能。它在台式机(iMac 上约 500 毫秒)和移动设备(iPhone 4 上使用网络摄像头图像约 3000 毫秒)上对其进行了测试。不幸的是,此时我无法发布指向工作示例的链接,但是一旦我有一些东西,我就会发布指向 github 的链接。