Shape detection in image using Matlab

依然范特西╮ 提交于 2019-12-02 14:41:19

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!

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