How to fill a large hole?
The imfill function doesn’t fill the large hole. How can I fill it?
Or, more generally:
How can I separate the image from the background?
Using a very large ‘disk’ might work to fill the hole, but it would also make the subject too large.
Any suggestions?
Thank you!
I = imread("sample_image.png");
BW = imbinarize(I);
se = strel(‘disk’,40);
closeBW = imclose(BW,se);
BW2 = imfill(closeBW,’holes’);
figure
imshowpair(I,BW2,’montage’)The imfill function doesn’t fill the large hole. How can I fill it?
Or, more generally:
How can I separate the image from the background?
Using a very large ‘disk’ might work to fill the hole, but it would also make the subject too large.
Any suggestions?
Thank you!
I = imread("sample_image.png");
BW = imbinarize(I);
se = strel(‘disk’,40);
closeBW = imclose(BW,se);
BW2 = imfill(closeBW,’holes’);
figure
imshowpair(I,BW2,’montage’) The imfill function doesn’t fill the large hole. How can I fill it?
Or, more generally:
How can I separate the image from the background?
Using a very large ‘disk’ might work to fill the hole, but it would also make the subject too large.
Any suggestions?
Thank you!
I = imread("sample_image.png");
BW = imbinarize(I);
se = strel(‘disk’,40);
closeBW = imclose(BW,se);
BW2 = imfill(closeBW,’holes’);
figure
imshowpair(I,BW2,’montage’) fill, hole, separate background, matlab MATLAB Answers — New Questions