Skip to main content

Activity 6 - Enhancement in the Frequency Domain

In this activity, we did image enhancements in the frequency domain. In particular, we tried to eliminate repetitive patterns in an image by filtering out the frequencies associated with them via masking techniques in the frequency domain.

A. Convolution
To begin, we first did some exercises in Fourier transformations. Using Scilab, we generated several patterns and took their Fourier transforms (FT). These patterns include:
1. Two dots along the x-axis symmetric about the center
2. Two circles along the x-axis symmetric about the center
3. Two squares along the x-axis symmetric about the center
4. Two Gaussian functions along the x-axis symmetric about the center

There are several ways to produce these pattern. One is by finding the corresponding positions on the image that you want to assign a value of zero or one (depending on whether you want a white shape in a black background or vice-versa.) Another way is by convolving the shape with Dirac delta functions at the points where you want your shapes to be located. 

The convolution theorem is a very important tool when operating in the frequency domain. It is useful to remember that:

1. The FT of a convolution of two functions in space is the product of the two functions' FT:  
FT [ f ∗g ]=FG.

2. The convolution of a dirac delta and a function f(t) results in a replication of f(t) in the location of the dirac delta

Fourier transforms of diffferent patterns
Below are the generated patterns and their respective Fourier transforms.

1. Two dots (Dirac delta functions) along the x-axis symmetric about the center 
                         (a)                                                               (b)
Figure 1. (a) Two dots, 1 pixel each, located at x = -1 and x = 1 along the x-axis
and its (b) FT
2. Two circles along the x-axis symmetric about the center

                                        PATTERN                                          FT
                 (a) radius = 0.05 units                    
(b) radius = 0.1 units
 (c) radius = 0.2 units                      
(d) radius = 0.5 units  
Figure 2. Two circles along the x-axis and their FFT for different radii

3. Two squares along the x-axis symmetric about the center 

 (a) side = 0.05 units   
 (b) side = 0.1 units   
 (c) side = 0.2 units   
 (d) side = 0.5 units   
Figure 2. Two squares along the x-axis and their FFT for different length of sides

4. Two Gaussian functions along the x-axis symmetric about the center

 (a) variance = 0.05 units   
 (b) variance = 0.1 units   
 (c) variance = 0.2units   
  (d) variance = 0.5 units   
Figure 4. Two Gaussians along the x-axis and their FFT for different values of variance

B. Lunar Landing Scanned Pictures: Line Removal


Figure 5 shows an image of one of the craters on the surface of the moon taken by the lunar orbiter. However, this is a composite image produced by combining individual framelets. Because of this,evenly  spaced horizontal lines are overlaid on the image.  
Figure 5. Composite image of one of the moon's craters taken by the Lunar Orbiter

The FT of the image is shown in Figure 6a. Due to the very bright zero order (center), the higher order frequencies are no longer easily observable. We want to see where the higher order frequencies lie since these are the ones that contribute to the noise in the image (i.e. the horizontal lines) and need to be masked. To make them more obvious, we want to eliminate the central part of the FT so we multiply it by a circular mask and we yield the image in Figure 6b.
(a) FT of the composite image of the moon's crater in Figure 5

(b) FT with masked zero order

From the masked FT, the frequencies with high amplitude are the ones that contribute to the horizontal lines in the image. A mask is created to block these frequencies. This mask is multiplied by the FT in Figure 6a and the inverse FT of the product is the reconstruction. The mask and the reconstructed image is shown in Figure 7. The horizontal lines on the image are visibly reduced. 
                                
                                           MASK                       RECONSTRUCTED IMAGE



Figure 7. Masks used (column 1) and the corresponding reconstructed image (column 2)

C. Canvas Weave Modeling and Removal
Figure 8 shows an image of the painting "Detail of the Frederiksborg." Our goal is to remove the weave pattern so that we can see the painting as we would if the canvass were completely flat. This way, the brushstrokes will be more distinguished.
(a)
(b)
Figure 8. (a) color and (b) greyscale image of the painting "Detail of the Frederiksborg"

The FT of the image is shown in Figure 9. We also got the FT with masked zero order

(a) FT of the image of the painting

(b) FT of the painting with masked zero order
Figure 9. FT of the painting (a) without  and (b) with masked zero order 

From the FT, we made the masks in paint where the FT in Figure 9b is just "color-inverted" and thresholded for conversion to black and white image.
(a1) First mask used

(a2) Reconstructed image using mask in (a1)
(b1) Second mask used 
(b2) Reconstructed image using mask in (b1)
 (b1) Third mask used 
(c2)Reconstructed image using mask in (c1)

Figure 10. Masks and reconstructed images for the painting

The weave patterns may be obtained by inverting the masks and multiplying it with the FT of the image then taking the inverse FT. The weave pattern for each mask is shown in Figure 11.

(a)

 (b)
(c)
Figure 11. Weave patterns obtained for the (a) mask in Fig 10 (a1), (b) mask in Fig 10 (b1) and (c) mask in Fig 10 (c1)

I give myself a grade of 10 for this activity for being able to do the required tasks and for understanding the concepts well.

Also, I would like to thank Ms. Eloisa Ventura, Ms. Maria Isabel Saludares and Mr. Gino Borja for helpful discussions.

References:
1. M. Soriano, "Activity 6: Enhancement in the Frequency Domain, " AppPhy 186 Activity sheet, 2012

Comments

Popular posts from this blog

Activity 10 Applications of Morphological Operation 3 of 3: Looping through images

When doing image-based measurements, we often want to separate the region of interest (ROI) from the background. One way to do this is by representing the ROIs as blobs. Binarizing the image using the optimum threshold obtained from the image histogram simplifies the task of segmenting the ROI. Usually, we want to examine or process several ROIs in one image. We solve this by looping through the subimages and processing each. The binarized images may be cleaned using morphological operations.  In this activity, we want to be able to distinguish simulated "normal cells" from simulated "cancer cells" by comparing their areas. We do this by taking the best estimate of the area of a "normal cell" and making it our reference.  Figure 1 shows a scanned image of scattered punched papers which we imagine to be cells examined under the microscope. These will be the "normal cells." Figure 1. Scattered punched paper digitized using flatbe...

Activity 12: Basic Video Processing

Hello!  In this activity we will try to process a video of a kinematic event in order to extract information such as constants, frequencies, etc. For our group, we took a video of a 3D spring pendulum which we observed in one plane. We would like to trace its path and then try to determine its phase-space plot. The mass was covered in masking tape with the bottom colored red to facilitate easier segmentation. The video was taken using a Canon D10 camera at frame rate of 30fps.  Media 1. Video of the spring pendulum (first 50 frames only) The frames of the video were then extracted using Avidemux 2.5. The mass was then segmented from each frame using parametric segmentation. The patch of the region of interest (ROI) used for color segmentation is shown in Figure 1. Figure 1. Patch used to segment ROI  Using morphological operations, particularly Open and Close operations, the segmented images were cleaned. The extracted frames for different observation...

Activity 7: Morphological Operations

When talking about morphology, what immediately comes to mind are the forms and structures or shapes of objects. Hence, performing morphological operations imply that the shape or form of an object is altered.       In this activity, we will perform morphological operations on binary images. In particular, we make use of erosion and dilation . Erosion and dilation were performed on the following: 1. A 5×5 square 2. A triangle, base = 4 boxes, height = 3 boxes 3. A hollow 10×10 square, 2 boxes thick 4. A plus sign, one box thick, 5 boxes along each line Using each of the structuring elements below: 1. 2×2 ones 2. 2×1 ones 3. 1×2 ones 4. cross, 3 pixels long, one pixel thick. 5. A diagonal line, two boxes long, i.e. [[0 1],[1 0] ].      When performing these operations, it is important to note the “anchor” or “origin” of the structuring element in order to give an accurate prediction of the result. For the 2x2 ones, 2...