f=imread('moon.tif');        % f is uint8 
w4=fspecial('laplacian',0)   % Can produce negative graylevels!
g1=imfilter(f,w4,'replicate');
imshow(g1,[ ])  % Shows all pixels positive
pause
% Change f to double before filtering
f2=im2double(f);
g2=imfilter(f2,w4,'replicate');
figure,imshow(g2,[ ])  %
pause
g=f2-g2;
figure,imshow(g)
pause
w8=[1 1 1;1 -8 1;1 1 1];
g8=f2-imfilter(f2,w8,'replicate');
figure, imshow(g8)
pause
close all