How can I determine the number of closed regions in an edge image?
11 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
coolguynp
el 19 de Abr. de 2015
Comentada: Image Analyst
el 20 de Abr. de 2015
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 comentarios
Respuesta aceptada
Image Analyst
el 19 de Abr. de 2015
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 comentarios
Image Analyst
el 20 de Abr. de 2015
The small blob at the bottom was SUPPOSED to be eliminated because it is not a closed curve.
Más respuestas (0)
Ver también
Categorías
Más información sobre Computer Vision with Simulink en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!