averaging mask and laplacian mask in image processing

Glove picture Glove · Jun 13, 2011 · Viewed 11.6k times · Source

in a given application I apply an averaging mask to input images to reduce noise, and then a Laplacian mask to enhance small details. Anyone knows if I Would get the same results if I reverse the order of these operations in Matlab?

Answer

Amro picture Amro · Jun 14, 2011

Convolving with a Laplacian kernel is similar to using second derivative information about the intensity changes. Since this derivative is sensitive to noise, we often smooth the image with a Gaussian before applying the Laplacian filter.


Here's a MATLAB example similar to what @belisarius posted:

f='http://upload.wikimedia.org/wikipedia/commons/f/f4/Noise_salt_and_pepper.png';
I = imread(f);

kAvg = fspecial('average',[5 5]);
kLap = fspecial('laplacian',0.2);

lapMask = @(I) imsubtract(I,imfilter(I,kLap));

subplot(131), imshow(I)
subplot(132), imshow( imfilter(lapMask(I),kAvg) )
subplot(133), imshow( lapMask(imfilter(I,kAvg)) )

enter image description here