简体   繁体   English

Javascript中的前景提取

[英]Foreground extraction in Javascript

I have a very 'simple' photo, with a Face plus Background. 我有一张非常“简单”的照片,带有面部和背景。 I want to create a software (in Javascript) that detects face/background. 我想创建一个检测人脸/背景的软件(使用Javascript)。 In this scenario we can create a kind of Parallax effect by animating them. 在这种情况下,我们可以通过设置动画效果来创建一种视差效果。

Can you have experience in that? 你有经验吗? Is it possible? 可能吗?

After a lot of research, i have only found GrabCut. 经过大量研究,我才发现GrabCut。 But as I know it isn't 100% accurate. 但是据我所知,它不是100%准确的。

It is possible eg using a JavaScript face detector and histogram backprojection . 例如,可以使用JavaScript人脸检测器直方图反投影

  1. Detect the face and create a model histogram of that region. 检测面部并创建该区域的模型直方图。
  2. Use histogram backprojection to assign each pixel around the face the probability of belonging to our model, ie face. 使用直方图反投影为面部周围的每个像素分配属于我们模型(即面部)的概率。
  3. Use thresholding for foreground - background separation. 将阈值用于前景-背景分离。

Here is an example output of that process for pupil extraction using js-objectdetect and the histogram backprojection algorithm from headtrackr : 这是使用js-objectdetectheadtrackr的直方图反投影算法提取瞳孔的过程的示例输出:

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM