Hi. Anyone has an idea how to find the area at red region area?
2 次查看(过去 30 天)
显示 更早的评论
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/854600/image.jpeg)
采纳的回答
Image Analyst
2022-1-6
% Take the 3 largest blobs
mask = bwareafilt(mask, 3);
% Assume we want the middle one. Label the blobs 1, 2, and 3.
[labeledImage, numBlobs] = bwlabel(mask);
% Extract the middle one, which has label 2:
middleBlob = ismember(labeledImage, 2);
imshow(middleBlob); % Display it.
3 个评论
Image Analyst
2022-1-6
There is also a function bwarea() you can use. It weights the area according to the shape of the boundary locally so it gives a different area than summing the pixels or using nnz(). I don't usually use bwarea() though. I use nnz(). I've been told it's slightly faster than using sum().
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!