1 0BIntroduction The objective of this assignment is to experiment with Fourier Transforms and to perform filtering operations in the Fourier Domain. We will discuss about the Fourier transform and the inverse Fourier transform, followed by filtering in the Fourier( frequency domain). We will follow this with the results of our experiment on gray scale images, colour images and videos. We did not implement the Fourier Transform. Instead, we were asked to use the rfftw and fftw libraries to generate the Fast Fourier Transform and its inverse. 2 1BFourier Transform and its inverse For a continuous 2D function, the Fourier transform is defined as,, And its inverse is given by:,, However, in the case of digital images, the values are discrete and hence we use the discrete version of the Fourier Transform known as Discrete Fourier Transform. This is given by: 1,, And the Inverse Discrete Fourier Transform is given by:, 1, The discrete Fourier transform can be applied to any function, but takes a considerable long time to compute. The Fast Fourier Transform is a faster implementation of the DFT and can be used when the number of elements is a power of 2. By using FFT, we can reduce the computational complexity from O(N 2 ) to O(N log N). The advantage of the Fourier Transform is that any convolution in the Time domain is converted to multiplication in the Frequency domain thereby simplifying a number of operations. 3 2BFilters There are several filters in the Image domain. However, we will only discuss about three types of filters: 1. Low Pass Filter 2. High Pass Filer 3. Band Pass Filter 3.1 5BLow Pass Filter A low pass filter- as the name indicates, passes all low frequency components and stops high frequency components. The frequency response of a LPF can be given as
Amplitude Fig 1. Frequency Response of 1-D Low Pass Filter In a 2-D case, the Frequency response will be given by, Frequency Fig 2. 2-D frequency response of a Low Pass Filter In the case of images, any region which has a change in contrast is known as high frequency. Sharper the contrast difference, higher the frequency. Simply put, all edges are high frequency and all smooth regions are low frequency. Hence, an ideal low pass filter smoothens all edges in an image. 3.2 6BHigh Pass Filter A high pass filter is exactly opposite in function to a LPF in that it stops low frequency components and passes high frequency edges. The frequency response of a HPF is given by: Amplitude For the 2-D case, it is given by: Frequency Fig 3. 1-D frequency response of High pass filter
A high pass filter acts as an edge detector. Fig.4 2-D Frequency response of High Pass Filter. 3.3 7Band Pass Filter A Band pass filter can be considered to be in between a high pass and a low pass filter. It is used to pass a band of frequencies and stop the rest. The frequency responses in the 1-D and 2-D cases are given by: Amplitude Frequency Fig. 5 1-D frequency response of Band pass Filter. Fig. 6 2-D frequency response of Band pass Filter. 4 3BResults and Discussion 4.1 8BGray Scale Images Following are the results of applying Fourier transform to some gray scale images.
Fig 7a. Input Image Fig 7b. Real FFT of 7a Fig 7c.Reconstructed from IFFT Fig 7d. FT after HP FilterFig 7e. High Pass Filtered and reconstructed. Fig 7f. FT after LP Filtering Fig 7g. Low Pass Filtered and reconstructed. Following is another gray scale image. As can be seen the image is rich in high frequency content. Fig8a. Fig8b Fig8c Fig8d a. Original image. b. FT of ROI c. FT with HPF d. Reconstructed HPF image e. FT with LPF f. Reconstructed LPF image
Fig 8e. Fig 8f 4.2 9BColour Images We now apply the Fourier transform to the Intensity component of Colour Images. Fig 9a Fig 9b Fig 9c Fig 9d Fig 9e a. Original image. b. Intensity image of ROI c. FT of ROI d. FT with HPF e. Reconstructed HPF image f. FT with LPF g. Reconstructed LPF image h. FT with Band Pass Filter i. Reconstructed image after BPF Fig 9f Fig 9g. Fig 9h. Fig 9i Fig 10a Fig 10b Fig 10c.
a. Original Fig 10d image. Fig 10e Fig 10f Fig 10g. b. Intensity image. c. FT of imge d. FT with HPF e. Reconstructed HPF image f. FT with LPF g. Reconstructed LPF image h. FT with Band Pass Filter i. Reconstructed image after BPF Fig 10h Fig 10i 4.3 10BVideo Following is a frame taken out of context from a video of a news reader. The ROI is subjected to Low Pass filtering. 11a. Frame taken out a video 11b. Fourier transform of an ROI in 11a 11c. 11b, subjected to Low Pass Filtering 11d. Low Pass Filtered frame Fig 11a. Fig 11b. Fig 11c. Fig 11d. Following is another frame taken out of context from a video of a news reader. The ROI is subjected to Band Pass filtering. Fig 12a. Frame taken from a video Fig 12b. Band Pass Filter Fig 12c. band Pass Filtered output On FT
We can infer the following from the above results: a. The Fourier transform obtained by rfftw library seems to be the inverse of the actual definition. i.e the high frequency components are at the centre and the low frequency components are at the edges. b. The High Pass and Low pass filters perform as expected. However, the Band Pass Filter s performance was difficult to measure. It seems to have very specific applications and required very specific knowledge to be utilized to its full extent. c. The ringing effects of LPF can be seen in Fig. 10g which has a lot of unwanted artecats. d. Although the High Pass filter is set to pass in very low frequencies, it still does not make a complete picture(fig.10d,e) whereas, a little component of the Low frequencies in 10f,g makes a much more comprehensible image. e. High Pass Filtering can be compared to Edge detection. However, the High pass filter seems to detect too many edges. It will need a lot of fine tuning before it can make meaningful edge detections. f. As the frame size of the video was very small, it did not have a significant impact on performance. Each frame was filtered in approximately the same time as a single image. g. The frequency for the filters is measured as the normalized distance from the centre( 1 is the maximum and zero is the minimum) 5 4BConclusion Thus, we have implemented Low, High and Band pass filters for images in the Fourier Domain. We were able to transform the images into the Frequency domain, Filter them and successfully convert them back to the spatial domain. Most of the filters and transforms performed as desired except that the Fourier transform seemed inverted for some reason and the Band Pass Filter did not really convey any information.