
Remove regions outside a range and find their centroids
    4 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
I'm analysing images of giant clam shells with the hope of automating the process of counting and measuring their daily growth lines. I've been trying to find the centroids of the regions but as the images are not consistent I'm not sure this will be generealisable. I am only interested in the white regions with width around 30-200 pixels. How can I remove the other regions and find the centres of these lines? If this seems like the incorrect approach I would welcome any suggestions. I've attached the original and binarised images below.
 
 0 comentarios
Respuestas (1)
  Image Analyst
      
      
 el 5 de Jul. de 2023
        
      Editada: Image Analyst
      
      
 el 5 de Jul. de 2023
  
      If you want the bounding box width to be between 30 and 200, do this
labeledImage = bwlabel(mask);
% Measure bounding boxes.
props = regionprops(labeledImage, 'BoundingBox')
allBB = vertcat(props.BoundingBox);
% Widths are column 3
widths = allBB(:, 3);
% Find out which widths are in the range we want.
keeperIndexes = find((widths >= 30) & (widths <= 200));
% Get a new binary image with only those blobs meeting the criteria.
mask = ismember(mask, keeperIndexes);
% Now get centroids and bounding boxes of what's left.
props = regionprops(labeledImage, 'BoundingBox', 'Centroid')
allBB = vertcat(props.BoundingBox);
% Get centroids as a matrix of (x,y) coordinates.
xyCentroids = vertcat(props.Centroid)
It's a generic, general purpose demo of how to threshold an image to find blobs, and then measure things about the blobs, and extract certain blobs based on their areas or diameters.
These look like tree rings.  There is a center at the University of Arizona that is a world leader in Dendrochronology (study of tree rings).  See if they can help you in your research.  

You can also check the File Exchange for submissions on Vessel or Ridge finding filters, like Frangi, Hessian, B-COSFIRE
2 comentarios
  Image Analyst
      
      
 el 7 de Jul. de 2023
				Yes it's possible to some degree, though not by using simple things like imbinarize().  And it won't be some short 200 line long program.  To be robust the program will be much longer than that.  
If there are indeed widths in the range 30-200, then the output mask from ismember should have them.  I made a mistake though.  The line of code should use the labeled image, not the mask.
mask = ismember(labeledImage, keeperIndexes);
Ver también
Categorías
				Más información sobre Image Processing Toolbox en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

