slide1
Download
Skip this Video
Download Presentation
Frequency Filtering

Loading in 2 Seconds...

play fullscreen
1 / 65

Frequency Filtering - PowerPoint PPT Presentation


  • 63 Views
  • Uploaded on

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

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

PowerPoint Slideshow about ' Frequency Filtering' - bella


An Image/Link below is provided (as is) to download presentation

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
slide1

Frequency Filtering

Instructor: Juyong Zhang

[email protected]

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

convolution property of the fourier transform
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

convolution via fourier transform
Convolution via Fourier Transform

Image & Mask

Transforms

Pixel-wise Product

Inverse Transform

how to convolve via ft in matlab
How to Convolve via FT in Matlab
  • Read the image from a file into a variable, say I.
  • Read in or create the convolution mask, h.
  • 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));

The mask is usually 1-band

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

coordinate origin of the fft

Even

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)

matlab s fftshift and ifftshift

J = fftshift(I):

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 averaging lowpass filtering
Blurring: Averaging / Lowpass Filtering

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 differencing highpass filtering
Sharpening: Differencing / Highpass Filtering

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 transform1

Recall:

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

ideal lowpass filter
Ideal Lowpass Filter

Image size: 512x512

FD filter radius: 16

Multiply by this, or …

… convolve by this

Fourier Domain Rep.

Spatial Representation

Central Profile

ideal lowpass filter1
Ideal Lowpass Filter

Image size: 512x512

FD filter radius: 8

Multiply by this, or …

… convolve by this

Fourier Domain Rep.

Spatial Representation

Central Profile

slide14

Ideal Lowpass Filter

Image size: 512x512

FD filter radius: 16

Ideal LPF in FD

Original Image

Power Spectrum

ideal lowpass filter2
Ideal Lowpass Filter

Image size: 512x512

FD filter radius: 16

Original Image

Filtered Power Spectrum

Filtered Image

ideal highpass filter
Ideal Highpass Filter

Image size: 512x512

FD notch radius: 16

Multiply by this, or …

… convolve by this

Fourier Domain Rep.

Spatial Representation

Central Profile

ideal highpass filter1
Ideal Highpass Filter

Image size: 512x512

FD notch radius: 16

Power Spectrum

Original Image

Ideal HPF in FD

ideal highpass filter2

*signed image: 0 mapped to 128

Ideal Highpass Filter

Image size: 512x512

FD notch radius: 16

Original Image

Filtered Power Spectrum

Filtered Image*

ideal highpass filter3

*signed image: 0 mapped to 128

Ideal Highpass Filter

Image size: 512x512

FD notch radius: 16

Positive Pixels

Filtered Image*

Negative Pixels

ideal bandpass filter
Ideal Bandpass Filter
  • 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.

-

=

FD LP mask with radius 1

FD LP mask with radius 2

FD BP mask 1 -2

ideal bandpass filter1

*signed image: 0 mapped to 128

Ideal Bandpass Filter

image LPF radius 1

image LPF radius 2

image BPF radii 1, 2*

ideal bandpass filter2

*signed image: 0 mapped to 128

Ideal Bandpass Filter

original image*

filter power spectrum

filtered image

a different ideal bandpass filter

*signed image: 0 mapped to 128

A Different Ideal Bandpass Filter

original image

filter power spectrum

filtered image*

the uncertainty relation
The Uncertainty Relation

space

frequency

FT

space

frequency

FT

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

the uncertainty relation1
The Uncertainty Relation

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 

ideal filters do not produce ideal results
Ideal Filters Do Not Produce Ideal Results

IFT

A sharp cutoff in the frequency domain…

…causes ringing in the spatial domain.

ideal filters do not produce ideal results1
Ideal Filters Do Not Produce Ideal Results

Ideal LPF

Blurring the image above with an ideal lowpass filter…

…distorts the results with ringing or ghosting.

optimal filter the gaussian
Optimal Filter: The Gaussian

IFT

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

two dimensional gaussian

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.

optimal filter the gaussian1
Optimal Filter: The Gaussian

Gaussian LPF

With a gaussian lowpass filter, the image above …

… is blurred without ringing or ghosting.

compare with an ideal lpf
Compare with an “Ideal” LPF

Ideal LPF

Blurring the image above with an ideal lowpass filter…

…distorts the results with ringing or ghosting.

gaussian lowpass filter
Gaussian Lowpass Filter

Image size: 512x512

SD filter sigma = 8

Multiply by this, or …

… convolve by this

Fourier Domain Rep.

Spatial Representation

Central Profile

gaussian lowpass filter1
Gaussian Lowpass Filter

Image size: 512x512

SD filter sigma = 2

Multiply by this, or …

… convolve by this

Fourier Domain Rep.

Spatial Representation

Central Profile

gaussian lowpass filter2
Gaussian Lowpass Filter

Image size: 512x512

SD filter sigma = 8

Power Spectrum

Original Image

Gaussian LPF in FD

gaussian lowpass filter3
Gaussian Lowpass Filter

Image size: 512x512

SD filter sigma = 8

Original Image

Filtered Power Spectrum

Filtered Image

gaussian highpass filter
Gaussian Highpass Filter

Image size: 512x512

FD notch sigma = 8

Multiply by this, or …

… convolve by this

Fourier Domain Rep.

Spatial Representation

Central Profile

gaussian highpass filter1
Gaussian Highpass Filter

Image size: 512x512

FD notch sigma = 8

Power Spectrum

Original Image

Gaussian HPF in FD

gaussian highpass filter2

*signed image: 0 mapped to 128

Gaussian Highpass Filter

Image size: 512x512

FD notch sigma = 8

Original Image

Filtered Power Spectrum

Filtered Image*

gaussian highpass filter3

*signed image: 0 mapped to 128

Gaussian Highpass Filter

Image size: 512x512

FD notch sigma = 8

Negative Pixels

Positive Pixels

Filtered Image*

another gaussian highpass filter

*signed image: 0 mapped to 128

Another Gaussian Highpass Filter

original image

filter power spectrum

filtered image*

gaussian bandpass filter
Gaussian Bandpass Filter
  • 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.

-

=

FD LP mask with radius 1

FD LP mask with radius 2

FD BP mask 1 -2

ideal bandpass filter3

*signed image: 0 mapped to 128

Ideal Bandpass Filter

original image

filter power spectrum

filtered image*

gaussian bandpass filter1

*signed image: 0 mapped to 128

Gaussian Bandpass Filter

image LPF radius 1

image LPF radius 2

image BPF radii 1, 2*

gaussian bandpass filter2
Gaussian Bandpass Filter

Image size: 512x512

sigma = 2 - sigma = 8

Fourier Domain Rep.

Spatial Representation

Central Profile

gaussian bandpass filter3
Gaussian Bandpass Filter

Image size: 512x512

sigma = 2 - sigma = 8

Power Spectrum

Original Image

Gaussian BPF in FD

gaussian bandpass filter4

*signed image: 0 mapped to 128

Gaussian Bandpass Filter

Image size: 512x512

sigma = 2 - sigma = 8

Filtered Image*

Filtered Power Spectrum

Original Image

gaussian bandpass filter5

*signed image: 0 mapped to 128

Gaussian Bandpass Filter

Image size: 512x512

sigma = 2 - sigma = 8

Negative Pixels

Positive Pixels

Filtered Image*

Filtered Image

slide61

Power Spectrum and Phase of an Image

original image

power spectrum

phase

power spectrum and phase of a blurred image
Power Spectrum and Phase of a Blurred Image

blurred image

power spectrum

phase

slide63

Power Spectrum and Phase of an Image

original image

power spectrum

phase

slide64

Power Spectrum and Phase of a Sharpened Image

sharpened image

power spectrum

phase

ad