How can I color only specific blobs in my segmented image?

1 vue (au cours des 30 derniers jours)
Andrea Labudzki
Andrea Labudzki le 16 Fév 2022
Commenté : Andrea Labudzki le 16 Fév 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')

Réponse acceptée

Image Analyst
Image Analyst le 16 Fév 2022
colorizedImage = imoverlay(segmentedImage, binaryImage, 'r');
  1 commentaire
Andrea Labudzki
Andrea Labudzki le 16 Fév 2022
Hi Image Analyst! Thanks for the answer. This worked perfectly! Over the past few months, you've helped me so much with my project. This is my final thesis for my Engineering Bachelors and you've helped me countless times so thank you so so much!! I really appreciate all your answers. :D

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Red dans Help Center et File Exchange

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by