필터 지우기
필터 지우기

How to Fill a 'hole' with leakage?

조회 수: 2 (최근 30일)
Subhajit Chatterjee
Subhajit Chatterjee 2015년 9월 25일
댓글: Jeff E 2015년 9월 25일
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
Jeff E
Jeff E 2015년 9월 25일
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)) ;

댓글을 달려면 로그인하십시오.

답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by