在OpenCV C ++中查找人物剪影 [英] Finding people silhouette in OpenCV C++

查看:143
本文介绍了在OpenCV C ++中查找人物剪影的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想提取照片中人物的轮廓并删除背景.该照片可以是整个身体的照片,只能是上半身,也可以是下半身.

I would like to extract the silhouette of a human in a photo and remove the background. The photo could be taken of the full body, only the upper body or only the lower body.

到目前为止,我所做的是使用Haar Cascades跟踪面部,但是我使用的算法在面部上做了一个矩形,因此我需要整个身体的形状.我也尝试过HOG,但是它也给了我一个矩形,并且不能用于所有照片.

What I have done so far is track the face using Haar Cascades, but the algorithm I use does a rectangle over the face and I would need the shape of all the body. I have tried HOG as well, but as well it gives me a rectangle and it doesn't work with all photos.

如果有人可以帮助我,那将是很棒的.我正在使用OpenCV和C ++.

It would be great if somebody could help me. I'm using OpenCV and C++.

推荐答案

您可以尝试GrabCut或GraphCut算法(至少OpenCV中存在抓取功能).

You can try the GrabCut or GraphCut algorithms (At least grabcut is present in OpenCV).

您告诉他们矩形(主体在哪里),并且他们会尽力在内部切割对象.这不是很快,也不是完美,但是您将很难找到更好的东西.

You tell them the rectangle (where the body is), and they do the best to cut the object inside. It's not fast, nor perfect, but you'll have a hard time trying to find something better.

这是一个开放的研究领域,因此,如果您的图像没有如您所愿地被裁剪,请准备好几年的博士后研究以找到更好的算法:)

This is an open research field, so if your images do not get cut as you want, prepare yourself for some years of post-PhD research to find better algorithms :)

这篇关于在OpenCV C ++中查找人物剪影的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆