As Laplacian filter can detect edges as well as noise, it may be desirable to smooth the image first by a Gaussian filter to suppress the noise before using Laplacian for edge detection. Laplacian of Gaussian (LOG) filter is a combination of Laplacian filter and Gaussian filter. The 5*5 LOG filter is defined as below [ 0 0 1 0 0 0 1 2 1 0 1 2 -16 2 1 0 1 2 1 0 0 0 1 0 0}
Please complete the provided Matlab code to apply LOG filtering.
Please fill in where it states % Your code here
im = imread('lena.bmp');
[r, c]=size(im);
im=double(im);
outim= % Your code here:initialize output image;
LOGfilter= % Your code here: 5*5 log filter;
for i= % Your code here;
for j= % Your code here;
for n= % Your code here;
for m= % Your code here;
outim(i,j)= % Your code here;
end
end
end
end
figure(1)
subplot(1,2,1)
imshow(uint8(im))
subplot(1,2,2)
imshow(uint8(outim));