Extract data from regionprops.

2 visualizzazioni (ultimi 30 giorni)
Fernando Scala
Fernando Scala il 4 Dic 2017
Modificato: Image Analyst il 4 Dic 2017
Hi everyone !
I have a set of images like this:
I use regionprops to find centroids and equivalent diameters.
The problem is: I need to select only the greater region and so, how can i extract the max EquivDiameter and the respective centroids ???
Thanks for your Help :)

Risposte (1)

Image Analyst
Image Analyst il 4 Dic 2017
Modificato: Image Analyst il 4 Dic 2017
props = regionprops(binaryImage, 'EquivDiameter', 'Centroid');
allDiameters = [props.EquivDiameter]
centroids = [props.Centroid]; % [x1,y1,x2,y2]
xCentroids = centroids(1:2:end)
yCentroids = centroids(2:2:end)
The first elements describe the blob on the left. The second elements describe the blob on the right.
Sounds like you haven't run my Image Segmentation Tutorial yet, where I go over all that. I suggest you do that: https://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862&sort=downloads_desc
Another thing you might want to do, instead of measuring everything there, if you want only the largest blob in the image, use bwareafilt() to extract it:
largestBlob = bwareafilt(binaryImage, 1);
Then if you call regionprops, there is information from only the largest blob, not both/all of them.

Community Treasure Hunt

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

Start Hunting!

Translated by