/*MATLAB PROGRAM for
Region Growing*/
clc
clear
all
b=imread('cameraman.tif')
subplot(1,2,1)
imshow(b);
title('Original
Image')
a=b;
max=251;
min=7;
t=55;l=2;
[row,col]=size(a);
for
k=2:255
for
l=2:255
if(k<=row-1&&l<=col-1)
if(abs(a(k,l)-a(k+1,l))<=t)
f(k,l)=0;
end
if(abs(a(k,l)-a(k-1,l))<=t)
f(k,l)=0;
end
if(abs(a(k,l)-a(k,l+1))<=t)
f(k,l)=0;
end
if(abs(a(k,l)-a(k,l-1))<=t)
f(k,l)=0;
end
if(abs(a(k,l)-a(k+1,l))>t)
f(k,l)=200;
end
if(abs(a(k,l)-a(k-1,l))>t)
f(k,l)=200;
end
if(abs(a(k,l)-a(k,l+1))>t)
f(k,l)=200;
end
if(abs(a(k,l)-a(k,l-1))>t)
f(k,l)=200;
end
end
end
end
subplot(1,2,2)
imshow(f)
title('Segmentd
Image using Threshold=55')
OUTPUT
No comments:
Post a Comment