hello eveyone

i am just new in image processing using matlab and i wrote a code to detect edge using sobel

and now i wanna implement conv2 algorithm fully and do not use matlab's function

would you please help me?

here is my code

A = imread('/home/debian/Pictures/Image.jpg');

I = rgb2gray(A);

imshow(I)

Z = [-1 0 1; -2 0 2; -1 0 1];

P = [-1 -2 -1; 0 0 0; 1 2 1];

Gx = conv2(I,Z);

Gy = conv2(I,P);

magnitude = sqrt(Gx.^2 + Gy.^2);

direction = atan(Gy/Gx);

thresh = magnitude < 135;

magnitude(thresh) = 0;

imshow(magnitude)

thanks

Similar questions and discussions