使用Matlab进行图像形状检测 [英] Shape detection in image using Matlab

查看:804
本文介绍了使用Matlab进行图像形状检测的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个有很多形状的图像,我需要编写一些Matlab代码,删除除矩形之外的所有形状。是否可以使用与strel,imclose和bwareaopen一起使用?如果您认为是的话,我会非常乐意听取您的意见。

I have an image with many shapes and I need to write some Matlab code which remove all the shapes except the rectangle.. Does it availabe to do it using only with strel,imclose and bwareaopen? if you think yes i will be very happy to hear your opinion.

图片:

推荐答案

如果我从你的评论中理解,矩形可以有任何大小。我认为只有当其他形状具有固定大小时才能询问,因为要求您使用strel,imclose和bwareaopen。简要说明一下,

If I understood right from your comment, rectangle may have any size. I think this can be asked only if the other shapes have fixed size since you are asked to use strel, imclose and bwareaopen. To briefly explain,

strel 函数为矩形,磁盘或任何其他形状创建一个给定大小的结构元素在您添加的图片上。

strel function creates a structuring element with given size for rectangle, disk or any other shape on the picture you added.

imclose 应该用于连接您提供的类似形状作为输入(基本上是您应该找到的结构元素) strel函数)。

imclose should be used to connect the similar shapes you give as input(basically the structuring element you should find from the strel function).

bwareaopen 将用于删除少于P -given作为输入像素的对象。

bwareaopen will be used to delete the objects which has less than P -given as input- pixels.

因此,如果可以为此图像指定任何大小的矩形,则其他形状应保持不变,以便能够使用strel函数定义它们,并通过使用连接imclose功能。通过这种方式,您可以将它们全部连接起来,取反之,使用bwareaopen删除并再次反向以矩形结束。

So, if the rectangle can be given in any size for this image, the other shapes should stay the same in order to be able to define them with strel function, and connect by using imclose function. In this way, you may connect them all, take inverse, remove using bwareaopen and take inverse once again to end up with rectangle.

我无法想到任何其他解决方案希望它有所帮助!

I could not think about any other solution, hope it helps!

这篇关于使用Matlab进行图像形状检测的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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