In an image, a 1-pixel dot represents a dirac delta. The FT of two dots symmetric about the center is a sinusoid pattern as shown below.
Figure 1. (a) Image of two dots symmetric about the center. Each dot is only one
pixel. (b) FT of the image in (a), a sinusoid pattern.
In general, the convolution of a pattern and a dirac delta is the repetition of that pattern at the location of the dirac delta. Thus, an image of two circles symmetric about the center can be considered as a convolution of a circle and two dots symmetric at the center. Also, we now know from the previous activity that the FT of a convolution of two images is equal to the product of the FTs of the images.
The FT of two circles symmetric about the center is equal to the product of an Airy pattern and a sinusoid. With varying radius, we can also see that the pattern changes.
Figure 2. Left, from top to bottom: Image of two circles symmetric about the center
with radii 0.01, 0.05 and 0.1, respectively. Right, from top to bottom: FT of the
corresponding images from the left. We can see that as the radius decreases, the
Airy pattern dominates over the sinusoid pattern.
The FT of two squares symmetric about the center is equal to the product of a sinc function and a sinusoid. Here I also show the FT of squares of different sizes.
Figure 3. Left, from top to bottom: Image of two squares symmetric about the center
with sides 0.01, 0.05 and 0.1, respectively. Right, from top to bottom: FT of the
corresponding images from the left. We can see that as the length of the sides
decrease, the sinc pattern dominates over the sinusoid pattern.
I did the same for Gaussian circles and obtained the corresponding FTs.
Figure 4. Left, from top to bottom: Image of two Gaussian circles symmetric about
the center with the standard deviation σ = 0.01, 0.05 and 0.1, respectively. Right,
from top to bottom: FT of the corresponding images from the left. We can see that
as σ decreases, the Gaussian pattern dominates over the sinusoid pattern.
from top to bottom: FT of the corresponding images from the left. We can see that
as σ decreases, the Gaussian pattern dominates over the sinusoid pattern.
Here I placed random white dots on black background and convolved it with different patterns. I show here the convolution with a star and a pentagon. The locations of the patterns are precisely the randomly generated dirac deltas.
Figure 5. Top, left to right: A pentagon and the convolution with randomly placed
dirac deltas. Bottom, left to right: A five-pointed star and the convolution with
randomly placed dirac deltas.
And last for the preliminaries, I generated equally-spaced white patterns and obtained their corresponding FTs.
Figure 6. Left, from top to bottom: Regularly spaced white lines every 50, 20,
25 (both horizontal and vertical), 10, and 5 lines. Right, from top to bottom: FT of
the corresponding images from the left, which look like interference
patterns from a grating.
The second part is the enhancement in the Fourier domain. First we were given an image taken from NASA Lunar Orbiter photography. The task is to remove the horizontal lines which resulted from combining several digitized segments to create one image. First, I took the FT of the image, but I only saw a black image. This means that most of the detail are concentrated at the lower frequencies, and so I took the log of the FT (called the power spectrum) to see a little better. Usually, it is easy to spot the FT of a regularly patterned noise because it appears as conspicuous dots or lines in the FT of the image.
Using the spectrum, I created a "mask" by covering some dots and lines of the FT and multiplied the mask with the FT of the original image to remove the noise. Here are my results:
Figure 7. (a) Original lunar image, with the unwanted horizontal lines. (b) log(FT) of
the image, which is called the power spectrum. (c) Power spectrum of the image with
the unwanted regions masked. (d) Mask, which is to be multiplied with the FT of the
original image. (e) Resulting cleaned image, without the unwanted horizontal lines.
Honestly, I took a lot of time doing this part of the activity because I could not quite figure out how Scilab does its FFT and why I cannot obtain my desired image. Upon laboring and searching over the net on how to do it, I was finally able to "clean" my image.
The last part of the activity is to remove the weaves over an oil painting on canvas. Here is the original image:
Figure 8. Original painting, Frederiksborg, oil on canvas
by Dr. Vincent Daria
First I took the grayscale of the image and took a small portion so that I will be familiar with the form of the pattern when I take its FT. As before, I created a mask and multiplied it with the FT of the original image. Here are my results.
Figure 9. (a) Portion of the painting Frederiksborg in grayscale. (b) FT of the
image portion. (c) Mask to be convolved with the original image. (d) Cleaned image.
Aside from removing the weaves, some of the brush strokes became more prominent also. The texture of the grass below the entrance of the church also become more prominent. I also inverted the mask and took its inverse FT, obtaining a pattern similar to the weaves present in the original image. This means that I was removing the right parts in the image.
Figure 10. Inverse FT of the mask, which looks similar to the
weave pattern present in the original image.
I took the difference between the uncleaned and cleaned image and got the image below, which shows the weave pattern that was removed. However we can also see here that some of the information was also remove, which shows that losses from cleaning cannot really be avoided.
Figure 11. Difference between the uncleaned and cleaned
image, showing the weave pattern along with some information
that was also removed during cleaning.
Then I also tried cleaning the entire painting. Here, after I converted the image into grayscale, I took its FT and created a mask. Then I removed the weaves, resulting in the clean image below. I also took the difference between the cleaned and uncleaned images, as shown.
Figure 11. (a) FT of the grayscale image. (b) Mask to remove the weave
patterns. (c) Cleaned image without the weaves. (d) Difference of the original
from the cleaned image, also showing some information that was lost.
Taking it a little step further, I wondered if we would be able to clean a colored image. Recall that a colored image has three distinct layers: red, green and blue. Using GIMP (because I don't know how to do it in Scilab) I separated the colored image into its red, green and blue components. Then I took the FT of all three channels and created masks for all three, convolved them with the original channel and combined the three cleaned channels using GIMP (again because I don't know how to do it in Scilab). Here are my results.
Figure 12. (a) Red channel of the image, in grayscale. (b) FT of the red channel.
(c) Mask for the red channel. (d) Cleaned red channel.
Figure 12. (a) Green channel of the image, in grayscale. (b) FT of the green
channel. (c) Mask for the green channel. (d) Cleaned green channel.
Figure 13. (a) Blue channel of the image, in grayscale. (b) FT of the blue channel.
(c) Mask for the blue channel. (d) Cleaned blue channel.
Figure 14. (a) Cleaned image by combining the cleaned RGB channels.
(b) Difference between the original colored image and the combined color image.
Grade I give myself: 12/10. Although I finished this activity a bit longer than the others, I was able to successfully clean the images by manipulating the frequency domain, and also demonstrate cleaning a colored image which is not part of the activity anymore.
Source: I got some of my ideas about filtering from this site:
http://www.imagemagick.org/Usage/fourier/#noise_removal
No comments:
Post a Comment