Effacer les filtres
Effacer les filtres

How to Fill a 'hole' with leakage?

2 vues (au cours des 30 derniers jours)
Subhajit Chatterjee
Subhajit Chatterjee le 25 Sep 2015
Commenté : Jeff E le 25 Sep 2015
I want to fill this holes in this image. I have tried strel() and then imclose() and then imfill() holes. But it is failed to detect these holes with leakage? Please put some light on how to fill those image and make this a whole black one. Thanks
  1 commentaire
Jeff E
Jeff E le 25 Sep 2015
Try imclose, which will make a bridge between the two "leakages" and then find the holes. imclose affects other parts of the image, so adding back those holes you found and then filling in holes again will get you a more accurate result. You may need to play a bit with the size of the imclose filter as well, depending upon the size of the "leaks".
imgin = imread('breast_image_segmented_38.jpg');
imgbw = im2bw(imgin);
%take complement to adhere to convention
imgbw = imcomplement(imgbw) ;
%make bridges across small "leaks"
img_close = imclose(imgbw , strel('disk', 7));
%find holes in resulting image
holes = ~img_close & imfill(img_close, 'holes');
%add back holes to original image
img_filled = imfill((imgbw | holes) , 'holes');
%optional additional filling
img_filled_closed = imclose(img_filled, strel('disk', 3)) ;

Connectez-vous pour commenter.

Réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by