Working with erosion and dilatation

倾然丶 夕夏残阳落幕 提交于 2019-12-25 18:47:16

问题


From the the previous link:

Working with an specific region generated by BoundingBox

The following code is based on it

se = strel('disk',9);

p_mask=imerode(Ic(BB,1).Image,se);
k_mask=imdilate(p_mask,se);

Ipointer=I2.*repmat( k_mask , [1 1 3]);

figure,imshow(Ipointer)

Mch=Ic(BB,1).Image-k_mask;
Mbch=bwareaopen(Mch,3000);
Ichaplet=I2.*repmat( Mbch , [1 1 3]);
figure,imshow(Ichaplet)

And so, I do not understand it


回答1:


google is your friend. if you don't know what a function does, google matlab + its name and read the reference documentation.

se is your structure element. Here defined as a disk with radius 9 http://de.mathworks.com/help/images/ref/strel-class.html

Your binary image is eroded, then dilated (which is called Opening) https://en.wikipedia.org/wiki/Opening_(morphology)

Assuming white is considered foreground (I can only guess without your image) Opening will remove small white spots. Erosion shrink everything by nibbling around the contour. If you nibble enough you eat the hole object :) Dilation will resize those objects that have not been eroded completely. Dilation will add pixels around the contour.

bwareaopen will remove connected components smaller than 3000 pixels http://de.mathworks.com/help/images/ref/bwareaopen.html

I'm sure you can figure out the rest on your own!



来源:https://stackoverflow.com/questions/37558409/working-with-erosion-and-dilatation

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