I want save each each white nodules as an image from the below binary image?

1 次查看(过去 30 天)
region_of_interest.PNG

回答(1 个)

Image Analyst
Image Analyst 2020-2-1
You can use regionprops() to get the bounding box of each blob, then crop it and use imwrite() to write it out as its own image. Something like this untested code:
props = regionprops(binaryImage, 'BoundingBox');
for k = 1 : length(props)
croppedImage = imcrop(binaryImage, props(k).BoundingBox);
fileName = sprintf('Blob %2.2d', k);
imwrite(croppedImage, filename);
end
This just does what your subject line asked - how to save each blob as an image. It does not compute the GLCM of each blob. If you want, you can call glcm() on each cropped image and save the results in a .mat file using save().

类别

Help CenterFile Exchange 中查找有关 Image Segmentation and Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by