How can I color only specific blobs in my segmented image?
1 view (last 30 days)
Show older comments
Andrea Labudzki
on 16 Feb 2022
Commented: Andrea Labudzki
on 16 Feb 2022
I have a segmented/labeled image. There are some segments that are too big, and I have their blob indices. I would like to color those blobs red while keeping the other blobs white. How can I do that? My current code below keeps the badBlobs, but turns the other blobs black.
Also, I would like the badBlobs to all be red, not with a spectrum like in the hsv colormap. How can I do that?
I am attaching the image that I am using.
And this is the result that I'm getting:
I want all other blobs to be visible as well, but in white.
Thanks.
Edit: wording
badBlobs = [25];
newImage = segmentedImage;
%Keep only blobs that are too big
binaryImage = ismember(newImage, badBlobs);
labeledImage = bwlabel(binaryImage);
%Show bad openings
figure('Name', 'Bad openings', 'numbertitle', 'off');
imshow(labeledImage);
colormap('hsv')
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Red in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!