How to extract a particular blob from an image consisting of number of blobs. In the figure below, i need to separately show the first ellipse in an image window.

3 views (last 30 days)
I know the image i have attached contains 13 blobs and i need to show image of (say 4th blob) alone in a separate image window. How is it possible to do so. Please explain with a script.

Accepted Answer

Image Analyst
Image Analyst on 30 Jul 2016
You could try bwselect() if you know the location. Otherwise you can label and use ismember
% Assign each blob an ID label.
labeledImage = bwlabel(binaryImage);
% Extract the 4th blob into it's own binary image.
binaryImage4 = ismember(labeledImage, 4) > 0;
  3 Comments
Sreejath S
Sreejath S on 31 Jul 2016
if true
for i=1:numberOfBlobsred
binaryImagei = ismember(labeledImagered, i) > 0;
imshow(binaryImagei);
end
end
This code doesn't work. i need to display some blobs in a for loop. The above script only shows the last blob. please help.
Sreejath S
Sreejath S on 31 Jul 2016
Sorry, I figured it out....I was not using figure; So the images get plotted on the same figure!!!...Thank you

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!