clc, clear all, close all

img = imread('grayimage.png');

edges=[[-1:1; -1:1; -1:1];[1,0,-1; 2,0,-2; 1,0,-1];
      [1,1,-1; 1,-2,-1; 1,1,-1];[3, 3,-5; 3,0,-5; 3,3,-5];
      [0,1,0; 1,-4,1; 0,1,0]];
titles={'Prewitt','Sobel','Robinson','Kirsch','Laplace'};

figure(1)
for i=1:length(titles)
  subplot(2,3,i); imshow(convolution(img,edges(i:i+3,:)));	title(titles{i});
end

titles={'prewitt','sobel','laplacian'};
functions={@convolution,@conv2,@imfilter}

figure(2);
for i=1:3:length(titles)*3
  for j=1:3
    subplot(3,3,i+j-1); imshow(functions{j}(img,fspecial(titles{(i+2)/3})));	
    title(titles{(i+2)/3});
  end
end

titles={'canny','zerocross','log'};

figure(3);
for i=1:3
 subplot(1,3,i); imshow(edge(img,titles{i},0.007));	title(titles{i});
end
