%% demonstrate edge detection
% S. Allen Broughton - 28 Oct 10

% get MATLAB image
load('gatlin');

% show original image
figure(1);
imagesc(X);
colormap(gray)

%% construct convolution masks
g = [1 -1]; 
h = [1 -1]; 

%% filter
Wg = circconv2(X,g);     % horizontal
Wh = circconv2(X,h');    % vertical
Wgh = circconv2(X,h'*g); % diagonal
  
%% show transformed images
figure(2);
imagesc(Wg);
colormap(gray)

figure(3)
imagesc(Wh);
colormap(gray)

figure(4)
imagesc(Wgh);
colormap(gray)

figure(5)
imagesc(abs(Wg)+abs(Wh)+abs(Wgh));
colormap(gray)



