By Nemuel Daniel Pah 14/11/05 Module 5 Spatial Filter: Low Pass Filter (image blurring)
Class Image enhancement/Restoration
Description Low-pass filter smoothes an image by attenuating high-spatial frequency details. It works by calculating the correlation between portion of input image (sized 3 x 3) with a kernel (sized 3 x 3).
a b c d e f g h i
m n o Kernel p q r a*m+b*n+c*o+d*p+e*q+f*r+g*s+h*t+i*u s t u
The common low-pass filter is the average of the nine-pixels, therefore the kernel of low-pass filter is:
1/9 1/9 1/9 1/9 1/9 1/9 1/9 1/9 1/9
The sum of kernel pixel is 1 (one). If the kernel covers an area with constant brightness, it doesnt change the image. In other words, the output brightness in a region of constant brightness remain unchanged. The other common low- pass filter kernels are:
Application To remove high frequency noise in an image (such as spikes) To smooth combined images or pixels. Unsharp masking enhancement by subtraction the original image with the scaled blurred image.
Pemrosesan Citra Page 2 of 4 Copyright JTEUS, 2005 D:\My Documents\JTEUS\Citra\BookOrg\Modul5 SpLPF\Modul5.doc By Nemuel Daniel Pah 14/11/05 Implementation Define special kernel to be used Apply the above convolution to every portion of 3 x 3 pixels in input image. Normalize the result to integer value ranging between 0 and 255.
Complete the empty pixels in the output image. Compare the sharpness of the object (with intensity 22) in the input and output image.
Example Input image:
Pemrosesan Citra Page 3 of 4 Copyright JTEUS, 2005 D:\My Documents\JTEUS\Citra\BookOrg\Modul5 SpLPF\Modul5.doc By Nemuel Daniel Pah 14/11/05 The blurred image calculated using the first kernel:
Observe the effect of low-pass filter.
Matlab Script The above example was created using the following script:
for m=1:1, for B=2:b-1, for K=2:k-1, ImCupl=[Ad(B-1,K-1) Ad(B-1,K) Ad(B-1,K+1);... Ad(B,K-1) Ad(B,K) Ad(B,K+1) ;... Ad(B+1,K-1) Ad(B+1,K) Ad(B+1,K+1)];
ImOut(B,K)=sum(sum(Kern.*ImCupl)); end end Ad=ImOut; end
ImOut=uint8(ImOut);
figure(2); imshow(ImOut); Pemrosesan Citra Page 4 of 4 Copyright JTEUS, 2005 D:\My Documents\JTEUS\Citra\BookOrg\Modul5 SpLPF\Modul5.doc By Nemuel Daniel Pah 14/11/05
Exercise 1. Refer to Matlab manual to understand each line in the above script. 2. Apply low-pass filter to the image using the other two kernels, and observe the difference. 3. Invent your own low-pass filter kernel and apply to the image. 4. Modify the above Matlab file to apply unsharp masking enhancement by subtracting the original image with the scaled-blurred image.
K.T. Chau, R.H.C. Wong, T.-f. Wong (Auth.), STAVROS K. KOURKOULIS (Eds.) - Fracture and Failure of Natural Building Stones_ Applications in the Restoration of Ancient Monuments-Springer Netherlands (2