

f=imread('cameraman.gif');
[rows,columns]=size(f);
%Initialise derivative images
gx=zeros(rows, columns);
gy=zeros(rows, columns);

% define derivative filters
wx=[-1, -1, -1; 0, 0 , 0; 1, 1, 1];
wy=wx';
%This are the first derivate images 
gx=filter2(wx,f);gy=filter2(wy,f);


% To visualise the image info 
figure, imshow(uint8(gx))
figure, imshow(uint8(gy))
figure, imshow(uint8(sqrt(gx.^2+gy.^2)))
