1 / 65

# Frequency Filtering - PowerPoint PPT Presentation

Frequency Filtering. Instructor: Juyong Zhang [email protected] http://staff.ustc.edu.cn/~juyong. Convolution Property of the Fourier Transform. * = convolution · = multiplication.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

## PowerPoint Slideshow about ' Frequency Filtering' - bella

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

Instructor: Juyong Zhang

[email protected]

http://staff.ustc.edu.cn/~juyong

* = convolution

· = multiplication

The Fourier Transform of a convolution equals the product of the Fourier Transforms. Similarly, the Fourier Transform of a convolution is the product of the Fourier Transforms

Transforms

Pixel-wise Product

Inverse Transform

• Read the image from a file into a variable, say I.

• Compute the sum of the mask: s = sum(h(:));

• If s == 0, set s = 1;

• Replace h with h = h/s;

• Create: H = zeros(size(I));

• Copy h into the middle of H.

• Shift Hinto position: H = ifftshift(H);

• Take the 2D FT of I and H:FI=fft2(I); FH=fft2(H);

• Pointwise multiply the FTs: FJ=FI.*FH;

• Compute the inverse FT: J = real(ifft2(FJ));

For color images you may need to do each step for each band separately.

Odd

Even

Odd

Image Origin

Image Origin

Weight Matrix Origin

Weight Matrix Origin

After FFT shift

After FFT shift

After IFFT shift

After IFFT shift

Coordinate Origin of the FFT

Center =

(floor(R/2)+1, floor(C/2)+1)

I(1,1)  J ( R/2 +1, C/2 +1)

I = ifftshift(J):

J( R/2 +1, C/2 +1) I(1,1)

Matlab’s fftshift and ifftshift

where x = floor(x) = the largest integer smaller than x.

Blurring results from:

• Pixel averaging in the spatial domain:

• Each pixel in the output is a weighted average of its neighbors.

• Is a convolution whose weight matrix sums to 1.

• Lowpass filtering in the frequency domain:

• High frequencies are diminished or eliminated

• Individual frequency components are multiplied by a nonincreasing function of  such as 1/ = 1/(u2+v2).

The values of the output image are all non-negative.

Sharpening results from adding to the image, a copy of itself that has been:

• Pixel-differenced in the spatial domain:

• Each pixel in the output is a difference between itself and a weighted average of its neighbors.

• Is a convolution whose weight matrix sums to 0.

• Highpass filtered in the frequency domain:

• High frequencies are enhanced or amplified.

• Individual frequency components are multiplied by an increasing function of  such as  = (u2+v2), where  is a constant.

The values of the output image positive & negative.

Convolution Property of the Fourier Transform

* = convolution

· = multiplication

The Fourier Transform of a convolution equals the product of the Fourier Transforms. Similarly, the Fourier Transform of a convolution is the product of the Fourier Transforms

Image size: 512x512

Multiply by this, or …

… convolve by this

Fourier Domain Rep.

Spatial Representation

Central Profile

Image size: 512x512

Multiply by this, or …

… convolve by this

Fourier Domain Rep.

Spatial Representation

Central Profile

Power Spectrum and Phase of an Image

Original Image

Power Spectrum

Phase

Image size: 512x512

Ideal LPF in FD

Original Image

Power Spectrum

Image size: 512x512

Original Image

Filtered Power Spectrum

Filtered Image

Image size: 512x512

Multiply by this, or …

… convolve by this

Fourier Domain Rep.

Spatial Representation

Central Profile

Image size: 512x512

Power Spectrum

Original Image

Ideal HPF in FD

Ideal Highpass Filter

Image size: 512x512

Original Image

Filtered Power Spectrum

Filtered Image*

Ideal Highpass Filter

Image size: 512x512

Positive Pixels

Filtered Image*

Negative Pixels

• A bandpass filter is created by

• subtracting a FD radius 2 lowpass filtered image from a FD radius 1 lowpass filtered image, where 2< 1, or

• convolving the image with a mask that is the difference of the two lowpass masks.

-

=

Ideal Bandpass Filter

Ideal Bandpass Filter

original image*

filter power spectrum

filtered image

A Different Ideal Bandpass Filter

original image

filter power spectrum

filtered image*

space

frequency

FT

space

frequency

FT

A small object in space has a large frequency extent and vice-versa.

frequency

space

Recall: a symmetric pair of impulses in the frequency domain becomes a sinusoid in the spatial domain.

IFT

 small extent 

 large extent 

 small extent 

 large extent 

frequency

space

A symmetric pair of lines in the frequency domain becomes a sinusoidal line in the spatial domain.

IFT

 small extent 

 large extent 

 small extent 

 large extent 

IFT

A sharp cutoff in the frequency domain…

…causes ringing in the spatial domain.

Ideal LPF

Blurring the image above with an ideal lowpass filter…

…distorts the results with ringing or ghosting.

IFT

The Gaussian filter optimizes the uncertainty relation. It provides the sharpest cutoff with the least ringing.

R = 512, C = 512

c

r

 = 257, s= 64

Two-Dimensional Gaussian

If  and  are different for r & c…

…or if  and  are the same for r & c.

Gaussian LPF

With a gaussian lowpass filter, the image above …

… is blurred without ringing or ghosting.

Compare with an “Ideal” LPF

Ideal LPF

Blurring the image above with an ideal lowpass filter…

…distorts the results with ringing or ghosting.

Image size: 512x512

SD filter sigma = 8

Multiply by this, or …

… convolve by this

Fourier Domain Rep.

Spatial Representation

Central Profile

Image size: 512x512

SD filter sigma = 2

Multiply by this, or …

… convolve by this

Fourier Domain Rep.

Spatial Representation

Central Profile

Image size: 512x512

SD filter sigma = 8

Power Spectrum

Original Image

Gaussian LPF in FD

Image size: 512x512

SD filter sigma = 8

Original Image

Filtered Power Spectrum

Filtered Image

Image size: 512x512

FD notch sigma = 8

Multiply by this, or …

… convolve by this

Fourier Domain Rep.

Spatial Representation

Central Profile

Image size: 512x512

FD notch sigma = 8

Power Spectrum

Original Image

Gaussian HPF in FD

Gaussian Highpass Filter

Image size: 512x512

FD notch sigma = 8

Original Image

Filtered Power Spectrum

Filtered Image*

Gaussian Highpass Filter

Image size: 512x512

FD notch sigma = 8

Negative Pixels

Positive Pixels

Filtered Image*

Another Gaussian Highpass Filter

original image

filter power spectrum

filtered image*

• A bandpass filter is created by

• subtracting a FD radius 2 lowpass filtered image from a FD radius 1 lowpass filtered image, where 2< 1, or

• convolving the image with a mask that is the difference of the two lowpass masks.

-

=

Ideal Bandpass Filter

original image

filter power spectrum

filtered image*

Gaussian Bandpass Filter

Image size: 512x512

sigma = 2 - sigma = 8

Fourier Domain Rep.

Spatial Representation

Central Profile

Image size: 512x512

sigma = 2 - sigma = 8

Power Spectrum

Original Image

Gaussian BPF in FD

Gaussian Bandpass Filter

Image size: 512x512

sigma = 2 - sigma = 8

Filtered Image*

Filtered Power Spectrum

Original Image

Gaussian Bandpass Filter

Image size: 512x512

sigma = 2 - sigma = 8

Negative Pixels

Positive Pixels

Filtered Image*

Filtered Image

Ideal Lowpass and Highpass Filters

Ideal LPF

Original Image

Ideal HPF*

Gaussian Lowpass and Highpass Filters

Gaussian LPF

Original Image

Gaussian HPF*

Ideal and Gaussian Bandpass Filters

Ideal BPF*

Original Image

Gaussian BPF*

Gaussian and Ideal Bandpass Filters

Gaussian BPF*

Original Image

Ideal BPF*

original image

power spectrum

phase

blurred image

power spectrum

phase

original image

power spectrum

phase

sharpened image

power spectrum

phase