如何检测并从图像中删除模糊的背景 [英] How do I detect and remove blurred background from image

查看:106
本文介绍了如何检测并从图像中删除模糊的背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一张背景模糊的图像.我需要做的是去除模糊的背景,只保留锋利的前景对象.他们有使用openCV做到这一点的任何方法吗?该图像将类似于下面的图像.我需要检测并减去模糊的背景.

I have an image with its background blurred out. What I need to do is remove the blurred background and only keep the sharp foreground objects. Is their any way of doing this using openCV? The Image will be something like the one below. I need to detect and subtract the blurred background.

推荐答案

这是先验的难题,因为平坦区域(例如衬衫)的外观与模糊区域(即低坡度活动)相同.可以尝试使用一些分割方法并对每个区域周围的边缘强度进行评分,但这并不简单.

This is a priori a difficult task, because flat areas (such as the shirt) have the same appearance as the blurred ones (i.e. low gradient activity). One can try some segmentation method and rate the edge strength around every region, but this isn't straightforward.

对于穷人的解决方案,这是我尝试的方法:

For a poor man's solution, here is what I tried:

  • 使用边缘检测器进行二值化处理,以便将感兴趣的区域封闭起来;

  • use an edge detector and binarize so that the areas of interest are enclosed;

执行连通分量分析并选择最大的斑点(模糊区域);

perform connected components analysis and select the largest blob (the blurred area);

将斑点填充到孔中以获得坚固的口罩.

hole-fill the blob to get a solid mask.

这篇关于如何检测并从图像中删除模糊的背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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