%Example10_3
f=imread('building.tif');
f=double(f);
imshow(f,[])                        % a)  Original
pause

f=mat2gray(f);
[gv t]=edge(f, 'sobel','vertical');
figure; imshow(gv,[])               % b)
t
pause

[gv t]=edge(f, 'sobel',0.15,'vertical');    % c)
%T=0.3*max(abs(gv(:)));
%gv=(gv>=T);
figure; imshow(gv)
pause

[gv t]=edge(f, 'sobel',0.15);
%T=0.3*max(abs(gv(:)));
%gv=(gv>=T);
figure; imshow(gv)                   % d)
pause

w45=[-2  -1   0;
    -1   0   1 ;
     0   1   2];
g45=imfilter(f,w45,'replicate');
T=0.3*max(abs(g45(:)));
g45=(g45>=T);
figure; imshow(g45);                     % e)
pause

wm45=[0   1  2;
     -1   0  1 ;
     -2  -1  0];
gm45=imfilter(f,wm45,'replicate');
T=0.3*max(abs(gm45(:)));
gm45=(gm45>=T);
figure; imshow(gm45);                    % f)
pause

close all
