Back to Browse

Region Filling Algorithm | MATLAB Code without using bwfill | Digital Image Processing

4.0K views
Jul 9, 2020
8:05

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');

Download

1 formats

Video Formats

360pmp410.6 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

Region Filling Algorithm | MATLAB Code without using bwfill | Digital Image Processing | NatokHD