
How to cluster a binary image?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
sheli whitson
el 6 de Sept. de 2016
Comentada: Image Analyst
el 11 de Abr. de 2022
I have the following image. Now I want to separate the black and white pixel from the image so that I can fit an ellipse to each black pixel area and find the length of the major axis of each ellipse. How can I separate black pixel from the white pixel and fit an ellipse?

0 comentarios
Respuesta aceptada
Image Analyst
el 6 de Sept. de 2016
See my image processing tutorial: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
Basically, here are the steps.
% Invert your image so the black things are white.
binaryImage = grayImage < 128;
% Call bwlabel
[labeledImage, numberOfRegions] = bwlabel(binaryImage);
% Call regionprops
props = regionprops(labeledImage, 'MajorAxisLength', 'Orientation');
It's all shown in Steve's blog:

5 comentarios
Eyup Demir
el 11 de Abr. de 2022
I think, I found what I was looking for! It is almost-connected-compenent labeling Thank you Steve! https://blogs.mathworks.com/steve/2010/09/07/almost-connected-component-labeling/
Image Analyst
el 11 de Abr. de 2022
Sometimes you can reduce this effect by using 4-connected labeling instead of the default 8-connected labeling.
Más respuestas (0)
Ver también
Categorías
Más información sobre Image Segmentation and Analysis 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!