How do morphological operations work at/near image baundaries?
1 次查看(过去 30 天)
显示 更早的评论
Hi
Hi, I want to track the edge of a feature in an image. The feature extends from the lower boundary to the top boundary of the image and so does the edge I want to track. An example of this looks like:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/156547/image.png)
Before I identify the edge I use different morphological operations imclose() and imopen(). The result is sometimes not as I expected near the image boundaries. Often the line indicating the edge is vertical (like at the top boundary) when it should be inclined to vertical (Like at the lower boundary).
When I apply filters like:
h = fspecial('disk',12);
Im3 = imfilter(Im2,h,'replicate');
I have the option to choose how the filter behaves near the boundaries using options like 'replicate'. That made me think:
How does the imclose() and imopen() work near the image boundaries and is it possible to control it in a similar way to the boundary options for imfilter()?
Best regards, Brian
0 个评论
采纳的回答
Michael Abboud
2016-9-27
The function “imopen” performs a morphological erosion followed by a dilation, while “imclose” does these operations in the opposite order. Therefore, there is no single rule or property for padding in these functions, rather each erosion and dilation follows its own rule.
In particular, MATLAB pads images with the value 1 or 255 (depending on the data type) when performing a morphological erosion, and a value of 0 when performing a dilation.
This standard is meant to reduce the possible edge effects from morphological functions. You can find more information at the following documentation page:
0 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!