function [output] = sobel_conv(input)

%This function implements a Sobel edge detector.
%It is used by the edge outline filter
%----------------------------------------------

input=double(input);
gx=-0.25.*[-1 0 1;-2 0 2;-1 0 1];
gy=-0.25.*[1 2 1;0 0 0;-1 -2 -1];

output_rowgrad=conv2(input,gx);    
 output_colgrad=conv2(input,gy);
 
 [cols,rows]=size(output_rowgrad);
 output=zeros([cols,rows]);
 for j=1:1:rows
     for i=1:1:cols
        output(i,j)=sqrt((output_rowgrad(i,j)^2)+(output_colgrad(i,j)^2)); 
    end
end
output=output(1:480,1:640);
output(1:7,1:640)=0;
output(473:480,1:640)=0;  %get rid of white edges introduced by conv2 function
output(1:480,1:7)=0;
output(1:480,633:640)=0;
output=uint8(output);