How to convert binary segmentation back to RGB but keep circle!

1 vue (au cours des 30 derniers jours)
Jose
Jose le 3 Août 2022
Commenté : Jose le 4 Août 2022
Hello I am experiencing some trouble I have created a circle around an eye in an image but I want to be able to show the original image over everything and keep the red circle this is what is looks like currently, ive tried insertobjectmask but it hasnt work does anyone have any other options?
eye=imread("niceeye.jpg");
figure(1)
grayeye = rgb2gray(eye);
filtersize= [1 1];
avg = fspecial('average',filtersize);
eyeavg = imfilter(eye,avg,"circular");
eyeavgBW = imbinarize(eyeavg,"adaptive","ForegroundPolarity","bright");
bkgdfilt=bwareaopen(eyeavgBW,12500);
clredges = imclearborder(bkgdfilt,8);
imagesc(clredges)
Rmin = 40;
Rmax = 100;
[centersDark, radiiDark] = imfindcircles(grayeye,[Rmin Rmax],'ObjectPolarity','dark','Sensitivity',0.9);
circles = viscircles(centersDark,radiiDark,'Color','r');

Réponse acceptée

Image Analyst
Image Analyst le 3 Août 2022
You need to display the original image again. DON'T call it eye since that is a built in function. Call it rgbImage or something, but not eye. Then after you have gotten your circles with imfindcircles, just do this
imshow(rgbImage);
viscircles(centersDark, radiiDark, 'Color', 'r');
  1 commentaire
Jose
Jose le 4 Août 2022
Oh gnarly thank you so much for the assistance!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Feature Detection and Extraction dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by