clc
clear all
close all
warning off
%%
%Take the Original Image
a=[ 0 0 0 0 0 0 0
0 0 1 1 0 0 0
0 1 0 0 1 0 0
0 1 0 0 1 0 0
0 0 1 0 1 0 0
0 0 1 0 1 0 0
0 1 0 0 0 1 0
0 1 0 0 0 1 0
0 1 1 1 1 0 0
0 0 0 0 0 0 0];
imshow(a);
%%
%Defining the structuring element
b=[0 1 0;1 1 1;0 1 0];
%%
%Take the complement of the original Image
acmp=~(a);
%%
%Deside the strat point of hole and make that 1
x=[0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 1 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0];
%%
y=(imdilate(x,b) & acmp);
%%
while(~isequal(x,y))
x=y;
y=(imdilate(x,b) & acmp);
end
y=y | a;
subplot(1,2,1)
imshow(a);
title('Original Image');
subplot(1,2,2)
imshow(y);
title('Image after performing region filling operation');
On this page of the site you can watch the video online Region Filling Algorithm | MATLAB Code without using bwfill | Digital Image Processing with a duration of hours minute second in good quality, which was uploaded by the user Knowledge Amplifier 08 July 2020, share the link with friends and acquaintances, this video has already been watched 3,413 times on youtube and it was liked by 35 viewers. Enjoy your viewing!