How can i separate all the connected regions in a binary image and display them individually?

Illustration
sumaiya khan - 2024-02-07T18:40:48+00:00
Question: How can i separate all the connected regions in a binary image and display them individually?

I have small white pixel areas in my binary image, how can I extract only those white connected pixel areas and display them individually.  

Expert Answer

Profile picture of Neeta Dsouza Neeta Dsouza answered . 2025-11-20

Use bwlabel() and ismember

 

[labeledImage, numRegions] = bwlabel(binaryImage);
props = regionprops(labeledImage, 'Area')
% Compute all the areas.
allAreas = [props.Area]
% Display each blob in its own figure.
for k = 1 : numRegions
    thisRegion = ismember(labeledImage, k);
    figure;
    imshow(thisRegion);
    drawnow;
end

 


Not satisfied with the answer ?? ASK NOW

Get a Free Consultation or a Sample Assignment Review!