Gain information about individual objects in an image

2 visualizaciones (últimos 30 días)
Mithra
Mithra el 13 de Sept. de 2013
I have a binary image which contains several separated regions. I want to put a threshold on the Area (number of pixels) that these regions occupy, in the way that: a region would be omitted if it has fewer pixels than the threshold. I already have tried these codes (using bwconncomp and labelmatrix):
[...]
% let's assume threshold = 50
CC = bwconncomp(my_image);
L = labelmatrix(CC);
A = cell( size(CC.PixelIdxList,1) , size(CC.PixelIdxList,2) );
A = CC.PixelIdxList;
for column = 1 : size(CC.PixelIdxList,2)
if numel(CC.PixelIdxList{column}) < 50, A{column} = 0;
end
end
But at this point I don't know how to convert cell C back to the shape of my image and then show it! Are there any tricks to do that?
Is there any easier and straighter way to gain information about objects in an image than this one I used in here?
I also need to know length and width (number of pixels in x and y direction) of these objects. These objects do not necessarily have any specific geometrical shape!
Thanks in advance

Respuesta aceptada

Image Analyst
Image Analyst el 13 de Sept. de 2013
Yes, Use Area rather than PixelIdxList. Then you can threshold on the areas and use ismember to filter objects based on their area. See my Image Segmentation Tutorial for an example of exactly that. Image Analyst File Exchange

Más respuestas (0)

Categorías

Más información sobre Image Segmentation and Analysis en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by