DIP Exp5 -[ Line Detection ]

 %Line DETECTION

clear all;
clc;
aa=imread('sample.jpg');
a=double(rgb2gray(aa));
% ab=imnoise(aa);
% a=double(ab);
w=[-1 -1 -1; 2 2 2 ;-1 -1 -1]
[row col]=size(a);
for x=2:1:row-1
for y=2:1:col-1
a1(x,y)=(a(x-1,y-1)*w(1)+a(x-1,y)*w(2)+a(x-1,y+1)*w(3)+a(x,y-1)*w(4)+a(x,y)*w(5)+a(x,y+1)*w(6)+a(x+1,y-1)*w(7)+a(x+1,y)*w(8)+a(x+1,y+1)*w(9));
end
end
subplot(221)
figure(1)
imshow(uint8(a))
title('ORIGINAL IMAGE')
subplot(222)
imshow(uint8(a1))
title('Line detection in Horizontal direction')
Next Post Previous Post
No Comment
Add Comment
comment url