39
Digital Image Processing Image Enhancement in the Frequency Domain

Digital Image Processing - Çankaya Üniversitesiceng503.cankaya.edu.tr/uploads/files/file/Digital... · image, thus influencing the geometric structure in the spatial domain. •In

  • Upload
    others

  • View
    8

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Digital Image Processing - Çankaya Üniversitesiceng503.cankaya.edu.tr/uploads/files/file/Digital... · image, thus influencing the geometric structure in the spatial domain. •In

Digital Image Processing

Image Enhancement in the Frequency Domain

Page 2: Digital Image Processing - Çankaya Üniversitesiceng503.cankaya.edu.tr/uploads/files/file/Digital... · image, thus influencing the geometric structure in the spatial domain. •In

Topics

• Frequency Domain Enhancements

• Fourier Transform

• Convolution

• High Pass Filtering in Frequency Domain

• Low Pass Filtering in Frequency Domain

Page 3: Digital Image Processing - Çankaya Üniversitesiceng503.cankaya.edu.tr/uploads/files/file/Digital... · image, thus influencing the geometric structure in the spatial domain. •In

Frequency Domain

• A frequency-domain graph shows how much of the signal lies within each given frequency band over a range of frequencies.

• A frequency-domain representation can also include information on the phase shift that must be applied to each sinusoid in order to be able to recombine the frequency components to recover the original time signal.

• A given function or signal can be converted between the time and frequency domains with a pair of mathematical operators called a transform

Page 4: Digital Image Processing - Çankaya Üniversitesiceng503.cankaya.edu.tr/uploads/files/file/Digital... · image, thus influencing the geometric structure in the spatial domain. •In

Frequency Domain

Page 5: Digital Image Processing - Çankaya Üniversitesiceng503.cankaya.edu.tr/uploads/files/file/Digital... · image, thus influencing the geometric structure in the spatial domain. •In

Fourier Transform

• Fourier transform is given by

• Inverse Fourier transform is

Page 6: Digital Image Processing - Çankaya Üniversitesiceng503.cankaya.edu.tr/uploads/files/file/Digital... · image, thus influencing the geometric structure in the spatial domain. •In

Two Dimensional Fourier Transform • Forward Fourier Transform is:

• Inverse Fourier Transform is:

Page 7: Digital Image Processing - Çankaya Üniversitesiceng503.cankaya.edu.tr/uploads/files/file/Digital... · image, thus influencing the geometric structure in the spatial domain. •In

Discrete Fourier Transform

• 1D forward transform

• 1D inverse transform

Page 8: Digital Image Processing - Çankaya Üniversitesiceng503.cankaya.edu.tr/uploads/files/file/Digital... · image, thus influencing the geometric structure in the spatial domain. •In

Fourier Transform Properties

• From Euler’s Equation we have:

• Hence by replacing we get

Page 9: Digital Image Processing - Çankaya Üniversitesiceng503.cankaya.edu.tr/uploads/files/file/Digital... · image, thus influencing the geometric structure in the spatial domain. •In

Magnitude, Phase, and Power Spectrum of Fourier Transform

• Magnitude of Fourier transform is found by:

• Phase is given by:

• Power Spectrum is:

Page 10: Digital Image Processing - Çankaya Üniversitesiceng503.cankaya.edu.tr/uploads/files/file/Digital... · image, thus influencing the geometric structure in the spatial domain. •In

Sample Functions and their Fourier Transforms

Page 11: Digital Image Processing - Çankaya Üniversitesiceng503.cankaya.edu.tr/uploads/files/file/Digital... · image, thus influencing the geometric structure in the spatial domain. •In

Fourier Transform Usage

• 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.

• In most implementations the Fourier image is shifted in such a way that the DC-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.

Page 12: Digital Image Processing - Çankaya Üniversitesiceng503.cankaya.edu.tr/uploads/files/file/Digital... · image, thus influencing the geometric structure in the spatial domain. •In

Sample Frequency Domain Processing

Page 13: Digital Image Processing - Çankaya Üniversitesiceng503.cankaya.edu.tr/uploads/files/file/Digital... · image, thus influencing the geometric structure in the spatial domain. •In

• Phase image (left), Inverse Fourier transform without phase information (right)

Page 14: Digital Image Processing - Çankaya Üniversitesiceng503.cankaya.edu.tr/uploads/files/file/Digital... · image, thus influencing the geometric structure in the spatial domain. •In

• f=fmax/2

Page 15: Digital Image Processing - Çankaya Üniversitesiceng503.cankaya.edu.tr/uploads/files/file/Digital... · image, thus influencing the geometric structure in the spatial domain. •In
Page 16: Digital Image Processing - Çankaya Üniversitesiceng503.cankaya.edu.tr/uploads/files/file/Digital... · image, thus influencing the geometric structure in the spatial domain. •In
Page 17: Digital Image Processing - Çankaya Üniversitesiceng503.cankaya.edu.tr/uploads/files/file/Digital... · image, thus influencing the geometric structure in the spatial domain. •In

Removing Additive Noise

• Assuming the noisy image is the result of adding noise to the original image as shown below:

• We can remove the noise by filtering out the noise effect

Page 18: Digital Image Processing - Çankaya Üniversitesiceng503.cankaya.edu.tr/uploads/files/file/Digital... · image, thus influencing the geometric structure in the spatial domain. •In
Page 19: Digital Image Processing - Çankaya Üniversitesiceng503.cankaya.edu.tr/uploads/files/file/Digital... · image, thus influencing the geometric structure in the spatial domain. •In

Frequency Filtering

Page 20: Digital Image Processing - Çankaya Üniversitesiceng503.cankaya.edu.tr/uploads/files/file/Digital... · image, thus influencing the geometric structure in the spatial domain. •In

Sample Fourier Analysis

Page 21: Digital Image Processing - Çankaya Üniversitesiceng503.cankaya.edu.tr/uploads/files/file/Digital... · image, thus influencing the geometric structure in the spatial domain. •In

Convolution

• In 2D continuous space, convolution is defined by:

• In 2D discrete space convolution is given by:

Page 22: Digital Image Processing - Çankaya Üniversitesiceng503.cankaya.edu.tr/uploads/files/file/Digital... · image, thus influencing the geometric structure in the spatial domain. •In

Convolution

Page 23: Digital Image Processing - Çankaya Üniversitesiceng503.cankaya.edu.tr/uploads/files/file/Digital... · image, thus influencing the geometric structure in the spatial domain. •In

Filtering in Frequency Domain

Basic Steps of Filtering in Frequency Domain Are:

• Compute F(u,v), the DFT of the input image

• Multiply F(u,v) by a filter function H(u,v)

• Compute inverse DFT of the result

• Obtain real part of the inverse DFT

Page 24: Digital Image Processing - Çankaya Üniversitesiceng503.cankaya.edu.tr/uploads/files/file/Digital... · image, thus influencing the geometric structure in the spatial domain. •In

Filtering in Frequency Domain

Page 25: Digital Image Processing - Çankaya Üniversitesiceng503.cankaya.edu.tr/uploads/files/file/Digital... · image, thus influencing the geometric structure in the spatial domain. •In

Spatial Masks in Time Domain

Page 26: Digital Image Processing - Çankaya Üniversitesiceng503.cankaya.edu.tr/uploads/files/file/Digital... · image, thus influencing the geometric structure in the spatial domain. •In

Convolving Mask with Image in Time Domain

• Convolving mask with image is carried out by sliding the mask over the image, multiplying mask values with the pixel values falling beneath them and obtaining the sum.

• The convolution is converted to multiplication in frequency domain

Page 27: Digital Image Processing - Çankaya Üniversitesiceng503.cankaya.edu.tr/uploads/files/file/Digital... · image, thus influencing the geometric structure in the spatial domain. •In

Sample Frequency Domain Filters

• Notch Filter: Changes the average value of an image to zero

Page 28: Digital Image Processing - Çankaya Üniversitesiceng503.cankaya.edu.tr/uploads/files/file/Digital... · image, thus influencing the geometric structure in the spatial domain. •In

Low Pass Filters

Page 29: Digital Image Processing - Çankaya Üniversitesiceng503.cankaya.edu.tr/uploads/files/file/Digital... · image, thus influencing the geometric structure in the spatial domain. •In

Ideal Low Pass Filter

Page 30: Digital Image Processing - Çankaya Üniversitesiceng503.cankaya.edu.tr/uploads/files/file/Digital... · image, thus influencing the geometric structure in the spatial domain. •In

Some Low Pass Filters

• Gaussian low pass filter (GLPF)

D(u,v) is the distance from the origin of the Fourier transform.

Page 31: Digital Image Processing - Çankaya Üniversitesiceng503.cankaya.edu.tr/uploads/files/file/Digital... · image, thus influencing the geometric structure in the spatial domain. •In

Result of Filtering with GLPF

Page 32: Digital Image Processing - Çankaya Üniversitesiceng503.cankaya.edu.tr/uploads/files/file/Digital... · image, thus influencing the geometric structure in the spatial domain. •In

Low Pass Filter Example

Page 33: Digital Image Processing - Çankaya Üniversitesiceng503.cankaya.edu.tr/uploads/files/file/Digital... · image, thus influencing the geometric structure in the spatial domain. •In

High Pass Filter

Page 34: Digital Image Processing - Çankaya Üniversitesiceng503.cankaya.edu.tr/uploads/files/file/Digital... · image, thus influencing the geometric structure in the spatial domain. •In

High Pass Filters

• Simplest high pass filter is the complement of low pass filter

• Ideal high pass filter is given by:

Page 35: Digital Image Processing - Çankaya Üniversitesiceng503.cankaya.edu.tr/uploads/files/file/Digital... · image, thus influencing the geometric structure in the spatial domain. •In

High Pass Filters

• Gaussian high pass filter is given by:

D0 is the distance from the center to cut-off frequency

D(u,v) is the distance from any point (u,v) to the center given by

Page 36: Digital Image Processing - Çankaya Üniversitesiceng503.cankaya.edu.tr/uploads/files/file/Digital... · image, thus influencing the geometric structure in the spatial domain. •In

Example Results with D0 = 15, 30 and 80

Page 37: Digital Image Processing - Çankaya Üniversitesiceng503.cankaya.edu.tr/uploads/files/file/Digital... · image, thus influencing the geometric structure in the spatial domain. •In

Ideal and Gaussian High Pass Filters

Page 38: Digital Image Processing - Çankaya Üniversitesiceng503.cankaya.edu.tr/uploads/files/file/Digital... · image, thus influencing the geometric structure in the spatial domain. •In

MATLAB Implementations

• Use fft(.) function for 1D Fourier transform and fft2(.) for 2D transform.

• Use ifft and ifft2 for inverse Fourier transforms

• Example:

– I = imread(‘test.jpg’);

– FI = fft2(I);

– FI2 = log(abs(FI));

– imshow( FI2, [-1 5] , 'InitialMagnification','fit')

Page 39: Digital Image Processing - Çankaya Üniversitesiceng503.cankaya.edu.tr/uploads/files/file/Digital... · image, thus influencing the geometric structure in the spatial domain. •In

Fast Convolution

• Read the image

• Create the mask (or read it)

• Find the Fourier transforms of the Image and the mirror of the mask (rotate by 180 degrees)

• Multiply the transformed image and the transformed mask

• Find the inverse Fourier transform of the result