Extract data from regionprops.
조회 수: 5 (최근 30일)
이전 댓글 표시
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 :)
댓글 수: 0
답변 (1개)
Image Analyst
2017년 12월 4일
편집: Image Analyst
2017년 12월 4일
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.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!