f = imread('moon.tif');
w4 = fspecial('laplacian',0);
w8 = [1 1 1; 1 -8 1;1 1 1];
f = im2double(f);
g4 =f - imfilter(f,w4,'replicate');
g8 =f - imfilter(f,w8,'replicate');
subplot(3,1,1);
imshow(f),title('original image');
subplot(3,1,2);
imshow(g4)
title('Filtered image with predefined Laplacian mask using fspecial ') ;
subplot(3,1,3);
imshow(g8)
title('Filtered image with  manually created Laplacian mask ') ;
