Thursday, August 6, 2009

Activity 7 - Enhancement in the Frequency Domain

In the previous activity, the properties of the 2D Fourier transform were studied and analyzed. These properties can have significant implications in image enhancement by filtering. In the frequency domain (Fourier space), desired signals can be isolated from the noise (or unwanted patterns) embedded in the data or an image.

Two dot images and their corresponding Fourier transforms (modulus)

Single pixel (0.5 pixel radius)

2 pixel radius

6 pixel radius

One property of the Fourier transform is that the transform of the convolution of two functions is equal to the product of the transforms of the functions (AP 186 Activity 7 Manual, Soriano, 2009). In a one-dimensional situation, the transform of two Dirac delta functions at opposite sides (equal distance) from the origin is a cosinusoidal function (Hecht, Optics). The single-pixel two-dot image shown above (top left) is a 2D analog, so, the corresponding Fourier transform (modulus) is the 2D sinusoid image shown (right).

On the other hand, the Fourier transform of the circle is actually a Bessel beam (Hecht, Optics). Increasing the pixel radius of the dot image is actually similar to convolving a circle with a certain radius to the dot image. The resulting Fourier transform will have the form of the product of the 2D sinusoid image and the Bessel beam, as a consequence of the property earlier stated. As evidence, the visible fringes in the Fourier transforms have the same frequency seemingly embedded on a Bessel beam.

Since the FT is in inverse space, increasing the radius of the circle will result into a decrease in size of the Bessel beam. This decrease also translates to its product with the sinusoid transform.

Now, replacing the circle dots with square dots, the Bessel beam would be replaced with a Bessel function along the x and y direction. This was seen in the previous activity of the Fourier transform of a square. This transform would also be multiplied with the sinusoid transform because, as mentioned, the image is convolution of a square and two Dirac delta functions. Again, increasing the widths of the squares will result into a decreasing size of the dimensions of the transform (see images below).

Two square dot images and their Fourier transform

3 pixel width squares

5 pixel width squares

7 pixel width squares

Using another shape, this time Gaussian dots, the same phenomenon is observed. Because the Fourier transform of a Gaussian is also a Gaussian (Hecht, Optics), the fringe pattern would now be embedded on a Gaussian in the transform of the image. And with increasing standard deviaton (σ) of the Gaussian dot, the spread of the transform decreases.

Two Gaussian dot images and their Fourier transform

σ=1

σ=3

σ=5

For further analysis, the Fourier transform of the inverse image of the Gaussian dot was obtained and compared with the original. It appears that the transform of the inverse image is only a single point at the center. This makes sense because the Gaussian dots in the image are no longer the signal but the background. And because the dots are very small, it would appear that they no longer exist in the image. The image Fourier transform would then be more of a transform of a DC signal (white), which is of zero frequency, corresponding to the central dot on the Fourier transform observed.

Two Gaussian dot image (σ=1) and the inverted image

Corresponding Fourier transforms (modulus)

Real part of the Fourier transforms

Imaginary part of the Fourier transforms

However, since the frequency of the DC bias of a signal is real, the imaginary parts of the Fourier transform for the original and inverse Gaussian dot images are still the same. The Fourier transform is linear. As a consequence, frequency (in Fourier space) of the added signal is simply added to the transform. In this case, inverting the original image has the same effect as adding a DC signal resulting in the addition of a zero frequency, where most of the magnitude of the real part of the transform would be concentrated. On the other hand, the imaginary part will not be affected.

The properties analyzed in the previous discussions can be applied to the filtering in frequency space for image enhancement. First, this is demonstrated in enhancing the ridges for a fingerprint image.

Original fingerprint image and its Fourier transform

The frequencies characterizing the ridges were determined from the Fourier transform. Obviously, these frequencies (most of) are the ones specified by the region between the two ellipses (red). Removing other frequencies will help remove the blotches in the fingerprint image. Theoretically, edges and details have high frequencies, which is why the region chosen to be removed is the low frequencies. The region within the zero frequency was not removed because this would only result to darkening of the image.
The enhancement done was applying the filtering twice and after each filtering, there was a linear enhancement of the histogram (equalization), which was demonstrated in Activity 4, for better contrast results (S. Greenberg, et al., Fingerprint Image Enhancement using Filtering Techniques, 2000). It can already be seen from the unbinarized image that the ridges are significantly enhanced.

1st filtering and contrast enhancement (linear). Left image is the filter mask used.

2nd filtering and contrast enhancement (linear). Left image is the filter mask used.

The final enhanced image was binarized (threshold level = 0.5) and compared with the binarized image of the original fingerprint (threshold level = 0.5, 0.6). Notice that the ridges are more defined even at the edges of the image and the blotches are removed.

Binarized original fingerprint image (threshold = 0.5 (left) and 0.6 (right))

Binarized final enhanced image (threshold level = 0.5)

Frequency filtering can also be applied when there are regular unwanted patterns embedded in the image. For example, the vertical lines in the image below can be removed to produce a better image of the lunar landing by the Apollo missions.


These vertical lines look like the vertical fringe pattern previously analyzed. Filtering can then be applied so as to remove the frequencies corresponding to the vertical lines. As observed, these frequencies lie along the middle horizontal axis. Designing a mask similar to the one shown below, and apply this as the filter, the vertical lines in the original image are clearly removed. (see the resulting image below)

Filter mask (should be same size as image)

Grayscale image with the vertical lines removed

Weaving patterns in a canvas painting are also unwanted repetitive patterns. The sample image shown below can be enhanced by removing these weaving patterns of the canvas. By analyzing the Fourier transform (left), the frequencies of these patterns can be detected and removed. The filter mask shown (right) can be used to remove the frequencies that should correspond to the weave.

Painting on a canvas with weaving patterns
(Oil painting from the UP Vargas Museum Collection)

Fourier transform of the image (left) and the designed filter mask (right)


Grayscale of the enhanced image (removed weaving patterns)

The enhanced image shown above removed the embedded canvas weave (although not perfect). This also helped enhance the brushstrokes of the painting, showing the true texture of the painting. In checking this result, the filter mask was inverted such that filtering would be getting only the frequencies corresponding to the weaving pattern. The inverse Fourier transform was taken to see whether this would match the appearance of the canvas weave. Indeed, the frequencies correspond to the canvas weave pattern based on the resulting image shown below.

Canvas weave appearance
Inverse Fourier transform of the filtered
frequencies removed from the original image

For this activity, I would like to give myself a grade of 10 because I think I did a good job. The results I obtained are very satisfactory and I have even applied what we have learned in some of our previous activities.
I would like to thank Winsome Chloe Rara, Mark Jayson Villangca and Orly Tarun for some discussions regarding this activity. I also acknowledge the guidance and knowledge provided by our professor Dr. Maricor Soriano.

No comments:

Post a Comment