Sobel Edge detection Implementation Problem

2 views (last 30 days)
I m new to MATLAB,Plz guide me.i m trying to implement the Sobel Edge detection algorithm but i m not getting correct output. My output is not match with the output obtained from using the inbuild edge function.This is my code. Thanks in advance.
gx=[-1 0 1;-2 0 2;-1 0 1];
d=conv2(original_Image,gx);
gy=[1 2 1;0 0 0;-1 -2 -1];
e=conv2(Original_Image,gy);
[m n]=size(e);
for i=1:m
for j=1:n
G(i,j)=uint8(sqrt(d(i,j)*d(i,j)+e(i,j)*e(i,j)));
end
end
figure;
imshow(G);

Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!