How can I determine the number of closed regions in an edge image?
11 次查看(过去 30 天)
显示 更早的评论
Given an edge image as shown in the figure, how can I find the number of closed regions (4 in the figure) in it?
0 个评论
采纳的回答
Image Analyst
2015-4-19
Trivial - just 3, or even 2, lines of code. Just try this:
% Invert the image to form black curves on a white background
binaryImage = ~binaryImage;
% Get rid of huge background that touches the border
binaryImage = imclearborder(binaryImage);
% Count the objects remaining
[~, numberOfClosedRegions] = bwlabel(binaryImage);
4 个评论
Image Analyst
2015-4-20
The small blob at the bottom was SUPPOSED to be eliminated because it is not a closed curve.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Computer Vision with Simulink 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!