Monday, July 13, 2009

A7 – Enhancement in the Frequency Domain

Filtering in Fourier Space
"Unwanted repetitive patterns in an image can be removed by masking their
frequencies in the Fourier domain. Alternatively, desired frequencies in the image
may also be enhanced."

A Convolution Theorem


Figure 1.Results for steps 1 to 3.


Figure 2. Variance


As you vary the variance the FT intensity changes in such a way that increasing the variance increase the radius of the FT.


Fig 3. Inversion

To invert the gaussian dots such that highest becomes 0, lowest becomes 255
or 1.0 , I just multiplied the original values by -1 *255 and then added 255.

B. Fingerprints : Ridge Enhancement


Fig 4. The problem
After converting the image to grayscale, I took the FFT and from here try to create a mask to remove the frequencies of the blotches which is ... unknown.
So what I did is start by removing the higher frequencies...obviously using a circular aperture didnt work as seen in Fig.5.

Fig 5. Removing the higher frequencies with a circular aperture... didnt work

Next I tried the other way around, I didnt mask the higher frquencies but just retained it, then I tried cleaning the frequencies close the center as shown in Fig 6 until I finally tried creating a mask from the FT and just clean the FT as shown in Fig 7. The final almost cleaned finger print is shown in Fig 6 (last).

Figure 5.
Figure 6.

before(original fingerprint)
after-the enhanced fingerprint with ridges more clear and less blotches. This final image is from Figure 6c.

C. Lunar Landing Scanned Pictures : Line removal
Remove the vertical lines in the image by filtering in the Fourier Domain.
Fig 7. Lunar image with vertical lines


a. b.
Fig 8. a.FT and horizontal mask to remove the vertical lines. b. the FFT of thw masked FT, the final image is inverted with no more vertical lines.

Fig. 9. The final cleaned image after rotation.


D Canvas Weave Modeling and Removal


Fig. 10 The canvas with weave pattern

Fig 11. The graycale of canvas image



Figure 12.FT of the image




Fig 12. Tried a combination of gaussian filtering and masking the regions shown in c... didint work , the resulting image in e was too blurred.


Figure 13. Made a mask that removes the symmetric peaks around the center.

The mask in figure 13 b, removed the frequencies of the weave pattern and a cleaned image is retrieved by taking the FT again. Also, the cleaned image has higher contrast such that the brushstrokes are enhanced.
Fig. 14. The unwanted canvas weave pattern is now removed(im from Fig 13 c).



Fig. 14. The inverted mask of the peaks

Fig. 15. The FT of inverted mask. It does look like the canvas weave pattern.

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Code:
a.Variance =2^2
b.Variance=3^2

nx = 100; ny = 100;

x = linspace(-100,1,nx);

y = linspace(-100,1,ny);

[X,Y] = ndgrid(x,y);

s1=4;//variance 1

s2=9;//variance 2

h=scf(1);

z1 = exp((-1*(sqrt((X+50).^2+(Y+50).^2)))/s1);

imshow(z1);

//xs2gif(1,'variance1.gif');

h=scf(2);

ft1=fftshift(abs(fft2(z1)));

imshow(ft1);

h=scf(3);

z2=exp((-1*(sqrt((X+50).^2+(Y+50).^2)))/s2);

imshow(z2);

//xs2gif(2,'variance2.gif');

h=scf(4);

ft2=fftshift(abs(fft2(z2)));

imshow(ft2);






No comments:

Post a Comment