Image Enhancement -Part 3 - Image Enhancement Part 3...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Image Enhancement Part 3 Frequency Domain Filtering Image Representation in Frequency Domain Images can be represented in ways other than arrays of pixels. One way is by using the Fourier Transform.. Image Representation in Frequency Domain FT The Fourier Transform is an important image processing tool which is used to decompose an image into its sine and cosine components. The output of the transformation represents the image in the Fourier or frequency domain, while the input image is the spatial domain equivalent. In the Fourier domain image, each point represents a particular frequency contained in the spatial domain image. Image Representation in Frequency Domain FT Instead of simply specifying individual pixel values in an image, the Fourier Transform builds up the image from sets of image waves. The same way in which a musical note is built up from pure sound waves, with various harmonics making the note more interesting and giving it its individual characteristics. Image Representation in Frequency Domain FT We will begin to understand how the Fourier Transform works by looking at how to represent some simple image waveforms. One simple image consists of a step edge, which is a dark panel on the left hand side of the image, and a bright panel on the right. Such an image is represented spatially by an array of 0s and 255s, where the 0s encode black and the 255s encode white A step can be constructed by adding together a series of pulse signals. This corresponds to thinking of the step as a series of pixel values. ...or a step can be thought of as the sum of a series of sine waves Building Up Any Waves Fourier, at the time of the French Revolution, showed that it was possible to build up any waveform exactly by adding up an infinite number of sine waves and cosine waves. This leads to the concept of Fourier Series Image Representation in Frequency Domain FT Any signal can be made by a sum of sine and cosine waves The things that characterize a sine wave, or a cosine wave, are its amplitude, phase, and frequency. The amplitude is defined to be the height of the sine wave above its mean value. The phase is defined by the point of the sine wave that goes through the origin. The spatial frequency is 1/wavelength. wavelength The Fourier Transform Image Representation The Fourier Transform represents an image by an array of amplitude and phase values for each frequency in the image. By itself, it is difficult to interpret, and often all we display are the amplitude values. Usually we simply plot the log of the absolute values of the amplitudes. Image Representation in Frequency Domain FT The Fourier Transform is used in a wide range of applications, such as image analysis, image filtering, image reconstruction and image compression As we are only concerned with digital images, we will restrict our discussion to the Discrete Fourier Transform (DFT). Discrete Fourier Transform (DFT) The DFT is the sampled Fourier Transform Therefore does not contain all frequencies forming an image, but only a set of samples which is large enough to fully describe the spatial domain image. The number of frequencies corresponds to the number of pixels in the spatial domain image, i.e. the image in the spatial and Fourier domain are of the same size 2D DFT and Inverse DFT (IDFT) For a square image of size NN, the twodimensional DFT is given by: f(x, y) In a similar way, the Fourier image can be retransformed to the spatial domain. The inverse Fourier transform is given by: F(u, v) M, N: image size x, y: image pixel position u, v: spatial frequency 2DCT where f(x,y) is the image in the spatial domain and the exponential term is the base function corresponding to each point F(u,v) in the Fourier space. The equation can be interpreted as: the value of each point F(u,v) is obtained by multiplying the spatial image with the corresponding base function and summing the result. General Use of FT The Fourier Transform is used if we want to access the geometric characteristics of a spatial domain image. Because the image in the Fourier domain is decomposed into its sinusoidal components, it is easy to examine or process certain frequencies of the image, thus influencing the geometric structure in the spatial domain. General Use of FT In most implementations the Fourier image is shifted in such a way that the discrete coefficient value (i.e. the image mean) F(0,0) is displayed in the center of the image. The further away from the center an image point is, the higher is its corresponding frequency Filtering in a Frequency Domain Fundamental Concept The most important mathematical theorem relating to the Fourier Transform is known as the Convolution Theorem. It says that convolution in the spatial domain corresponds to multiplication in the frequency domain, and vice versa. Convolution Theorem f (x,y) input image h(x,y) impulse response (filter) g(x,y) output image g ( x , y ) = f ( x, y ) h ( x , y ) DFT IDFT DFT IDFT DFT IDFT G(u,v) = F(u,v) H(u,v) Convolution Theorem If f and g are two images, and F and G are their Fourier transforms, then f(x)*g(x) = F(n).G(n) where x represents spatial variables and n represents frequency variables, `*' represents convolution, and `.' represents multiplication. Filtering Frequencies For any image, in the frequency domain there is a smallest frequency, known as the 0th frequency or the DC term. This term represents the average value of the image. This term is displayed at the centre of the Fourier spectrum. Filtering in a Frequency Domain 1. Compute the F(u,v), the Discrete Fourier Transform (DFT) of the image to be enhanced, Generate a filter function, H(u,v) Multiply F(u,v) by H(u,V) (rather than convolve in the spatial domain), Take the Inverse Discrete Fourier Transform (IDCT) of the result in 3 to produce the filtered/enhanced image. The final image is obtained by some post processing like image cropping and converting to unit8/unit16 for storage 2. 3. 4. 5. Frequency Domain Filtering From [Gonzalez & Woods] Some Basic Filters and Their Properties Three common frequency enhancement techniques: low pass filtering high pass filtering high boost filtering Image Enhancement in Frequency Domain Enhancement in the Frequency Domain Types of enhancement that can be done: Lowpass filtering: reduce the high frequency content blurring or smoothing Highpass filtering: increase the magnitude of highfrequency components relative to lowfrequency components sharpening. Often, the enhancement we wish to achieve is one of eliminating certain frequencies in the image, or stressing certain frequencies. Low pass filtering involves letting the low frequencies pass, and eliminating the high frequencies. We can achieve this by multiplying the frequencies with a filter that has a value of 1 for the desired low frequencies, and 0 for the undesired high frequencies. Low pass filtering generates an image with the overall shading characteristics, but without any fine detail. Enhancement Frequency Domain Low-pass filtering High pass filtering does the opposite. Enhancement Frequency Domain High pass filtering lets through the high frequencies (the detail), but eliminates the low frequencies (the overall shape). Acts like an edge enhancer. High-pass filtering High boost filtering lets through the high frequencies (the detail), and lets through some of the low frequencies (the overall shape). The high frequencies are boosted relative to the low frequencies. Enhancement Frequency Domain High boost filtering Homomorphic Filtering 1. the amount of source light incident on the scene 2. the amount of light reflected by the objects in the scene. Images normally consists of light reflected from objects. The basic nature of the image is characterised by: These portions of light are called illumination and reflectance. They combine multiplicatively: f(x) = i(x).r(x) Homomorphic Filtering f(x) = i(x).r(x) i(x) is positive, and r(x) lies between 0 and 1. The reflectance provides information about the colour and shape of the objects in the image. Variations in illumination cause confusion. Thus, we would like to be able to suppress the illumination effects, and enhance the reflectance effects. Homomorphic Filtering One of the properties of the Fourier Transform is that it is linear, that is, if we take the Fourier Transform of the sum of two images, the result is the sum of the two Fourier Transforms. Fourier Transform (A + B) = Fourier Transform (A) + Fourier Transform (B) This is a very useful property when our image consists of two parts, however the reflectance and illumination components are multiplied, not added. The way we deal with this is to use logarithms and exponentials, where multiplications turn into additions. To see how this works, we will use a simple example in base 10 arithmetic. If we want to multiply 100 by 1000 we can write 10 x 10= 10+ All our arithmetic is done with the exponents. The process of simply considering the exponents is called taking the logarithm. If we want to move just from the exponents back to the complete numbers, we invert the logarithm by taking exponentials. Homomorphic Filtering So remember that our image is made up of two components: f(x) = i(x).r(x) We take logarithms to get : ln f(x) = ln i(x) + ln r(x) and now note that the Fourier Transform acts linearly over this function: FT[ln f(x)] = FT[ln i(x)] + FT[ln r(x)] Z(n) = I(n) + R(n) Homomorphic filtering We apply our filter, call it H, to Z(n) = FT[ln f(x)] to get S(n) = H(n).I(n) + H(n).R(n) and then back-transform into the spatial domain using the Inverse Fourier Transform: s(x) = IFT[S(n)] = IFT[H(n).I(n)] + IFT[H(n).R(n)] Now we simply need to exponentiate, to counteract the original logarithms, and we get our enhanced image. The new image g(x) = exp[s(x)] Lowpass Filtering in the Frequency Domain Edges, noise contribute significantly to the highfrequency content of the FT of an image. Blurring/smoothing is achieved by reducing a specified range of highfrequency components Low pass filtering involves the elimination of the high frequency components in the image. It results in blurring of the image Smoothing in the Frequency Domain G(u,v) = H(u,v) F(u,v) Ideal Lowpass Filters Butterworth lowpass filters Gaussian lowpass filters 2D-DFT Domain Filter Design Gaussian lowpass filtering Gaussian highpass filtering From [Gonzalez & Woods] Ideal Filter (Lowpass) Ideal: all frequencies inside a circle of radius D0 are passed with no attenuation all frequencies outside this circle are completely attenuated. Butterworth Filter (Lowpass) This filter does not have a sharp discontinuity that establishing a clear cutoff between passed and filtered frequencies as between passed and filtered frequencies in the ideal HPF (compare Fig 4.14 and Fig 4.10). No ringing effect but it does become significant for higherorder filters (n=20 exhibits the characteristics of the ILPF) Sharpening in Frequency Domain Edges and sharp transitions in grayvalues in an image contribute significantly to highfrequency content of its Fourier transform. Regions of relatively uniform grayvalues in an image contribute to lowfrequency content of its Fourier transform. Hence, image sharpening in the Frequency domain can be done by attenuating the lowfrequency content of its Fourier transform. This would be a highpass filter! High Pass Filters By highpass filters: 1. Ideal highpass filters 2. Butterworth highpass filters 3. Gaussian highpass filters An ideal highpass filter with cutoff frequency ro : An ideal highpass filter with cutoff frequency ro : Ideal High Pass Filter Refer to Fig 4.24, next slide (a) and (b) has ringing effect The severe ringing effect in the output images, which is a characteristic of ideal filters. It is due to the discontinuity in the filter transfer function. Highpass Filters From [Gonzalez & Woods] Butterworth Highpass Filter 2D Butterworth filter with n: filter order, ro: cutoff frequency Behaves smoother and less distortion than IHPF (refer to Fig 4.25) Gaussian Highpass Filter Results obtained are smoother than the previous filters. Even the filtering of the smaller objects and thin bars is cleaner (compare Fig 4.26 with 4.25) 2D-DFT Domain Filter Design Choices of highpass filters Ideal Butterworth Gaussian From [Gonzalez & Woods] Highpass Filters Ideal Butterworth Gaussian From [Gonzalez & Woods] Reference Two-Dimensional Discrete Fourier Transform, Zhou Wang, Dept. of Electrical Engineering, The Univ. of Texas at Arlington, Fall 2006 Image Enhancement in the Spatial Domain, Wanasanan Thongsongkrit Others later Homework Linear filtering of images is achieved by using the conv2 operator, except for the boundaries. Try the following exercises: i) x = eye(10); g = [1 1] g2 = conv2(g,g') g3 = conv2(g,conv2(g2,g')) y = conv2(x,g); y2 = conv2(g2,x) y3 = conv2(g3,x) ii) Same as part (i) except let x = ones(10,10); Homework iii) L = [0 1 0; 1 4 1; 0 1 0]; % the Laplacian conv2(L, ones(10,10)) conv2(L, eye(10)) Explain why the result is what you observe. Check out this site 33/matlab/index.html ...
View Full Document

This note was uploaded on 02/06/2012 for the course FACULTY OF WXGE6320 taught by Professor Noraini during the Winter '09 term at University of Malaya.

Ask a homework question - tutors are online