Shape detection in image using Matlab

穿精又带淫゛_ 提交于 2019-12-02 23:26:13

问题


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.

Image:


回答1:


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 function creates a structuring element with given size for rectangle, disk or any other shape on the picture you added.

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 will be used to delete the objects which has less than P -given as input- pixels.

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!



来源:https://stackoverflow.com/questions/32787534/shape-detection-in-image-using-matlab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!