OpenCV:快速删除主题周围的背景,假设简单的背景? [英] OpenCV: Quickly remove background around subject, assuming simple background?

查看:389
本文介绍了OpenCV:快速删除主题周围的背景,假设简单的背景?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想做一些类似背景移除,像blob检测...

I'm looking to do something sort of like background removal, sort of like blob detection...

基本上,我想要能够以捕捉人或其他物体在合理均匀背景(例如墙壁或地毯地板)前面的照片。然后,尽可能少的用户交互和参数,我想完全删除那个背景,让我的主题在纯白色背景。

Basically, the idea is, I want to be able to snap a photo of a person or other object in front of a reasonably uniform background -- say, a wall, or a carpeted floor. Then, with as little user interaction and parameters as possible, I want to remove that background completely, leaving me with the subject on a pure white background.

我意识到,如果主体具有类似于未被其他颜色完全包围的背景的任何着色(例如,穿着白衬衫站在白墙前的人),我可能运气不好。没关系。

I realize if the subject has any coloration that's similar to the background which isn't completely surrounded by other colors (e.g. a person wearing a white shirt standing in front of a white wall), I'm probably out of luck. That's fine. I just want this to work in most situations.

因为我需要在C,C ++和/或Obj-C中工作,所以我只想让它在我们希望OpenCV是在这里使用的正确的工具包,但如果我真的错了,请chime in ...假设它是一个很好的计划与OpenCV,什么可能是最好的方式做什么我

Since I need to be working in C, C++ and/or Obj-C, I'm expecting OpenCV is the right toolkit to use here, but if I'm actually wrong about that, please chime in... Assuming it is indeed a good plan to go with OpenCV, what might be the best way to do what I'm trying to do?

感谢。

推荐答案

可以使用 OpenCV的Grabcut分段提取前景,在您的情况下是一个人

You should be using OpenCV's Grabcut segmentation for extracting the foreground, which in your case is a person

这篇关于OpenCV:快速删除主题周围的背景,假设简单的背景?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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