3-d computational vision csc 83020 image processing ii - fourier transform

41
Vision Vision CSc 83020 CSc 83020 Image Processing II - Image Processing II - Fourier Transform Fourier Transform

Upload: darlene-diggins

Post on 14-Dec-2015

219 views

Category:

Documents


0 download

TRANSCRIPT

3-D Computational Vision3-D Computational VisionCSc 83020CSc 83020

Image Processing II - Fourier Image Processing II - Fourier TransformTransform

CSc 83020 3-D Computer Vision / Ioannis StamosCSc 83020 3-D Computer Vision / Ioannis Stamos

The Fourier TransformThe Fourier Transform

Previous lecture: filtering in the spatial domain.

A signal (i.e. scanline/audio/image) hasequivalent representation in the Frequency Domain.

Spatial domain Frequency domain

CSc 83020 3-D Computer Vision / Ioannis StamosCSc 83020 3-D Computer Vision / Ioannis Stamos

1-D Continuous Fourier Transform1-D Continuous Fourier TransformSpatial Domain(x) => Frequency Domain (u)Spatial Domain(x) => Frequency Domain (u)

1,sincos

)()(

)()(

2

2

ikike

dueuFxf

dxexfuF

ik

uxi

uxi

Note that F(u) is generally COMPLEX.

CSc 83020 3-D Computer Vision / Ioannis StamosCSc 83020 3-D Computer Vision / Ioannis Stamos

)()(

)2sin()()2cos()()(

uiIuR

dxuxxfidxuxxfuF

Real and imaginary part.

Integration with cos/sin waves of

different frequencies.

Magnitude |F(u)| : Fourier Spectrum.

Phase φ(u) : Phase Spectrum.

CSc 83020 3-D Computer Vision / Ioannis StamosCSc 83020 3-D Computer Vision / Ioannis Stamos

A periodic signal and its spectrumA periodic signal and its spectrum

From“Digital Image Warping”byGeorge Wolberg.

CSc 83020 3-D Computer Vision / Ioannis StamosCSc 83020 3-D Computer Vision / Ioannis Stamos

An aperiodic signal and its An aperiodic signal and its spectrumspectrum

From“Digital Image Warping”byGeorge Wolberg.

CSc 83020 3-D Computer Vision / Ioannis StamosCSc 83020 3-D Computer Vision / Ioannis Stamos

CSc 83020 3-D Computer Vision / Ioannis StamosCSc 83020 3-D Computer Vision / Ioannis Stamos

CSc 83020 3-D Computer Vision / Ioannis StamosCSc 83020 3-D Computer Vision / Ioannis Stamos

Fourier Transformation & ConvolutionFourier Transformation & Convolution

)()()(

))()(()(

)()(

)()()(

*

2

2

uHuFuG

dxedxhfuG

dxexguG

dxhfxg

hfg

uxi

uxi

Convolution

Fourier Trans.Using y=x-ξ

Convolution in Spatial Domain ===Multiplication in Frequency Domain.

CSc 83020 3-D Computer Vision / Ioannis StamosCSc 83020 3-D Computer Vision / Ioannis Stamos

Fourier Transform and ConvolutionFourier Transform and ConvolutionSpatial Domain (x)

g=f * h

g=f x h

Frequency Domain (u)G=F x H

G=F * HAlternative Method of finding g(x)

g = f * h

G = F x H

F.T F.TIFT

CSc 83020 3-D Computer Vision / Ioannis StamosCSc 83020 3-D Computer Vision / Ioannis Stamos

Example: SmoothingExample: Smoothingf(x)

x

NOISYSIGNAL

We want: g(x) = f(x) * h(x) (SMOOTHED)

22

2

2

)2()(

2

1)(

2

1

2

1

ueuH

exhx

Let:

Then:

Example: SmoothingExample: Smoothingh(x)

H(u)

u

1/(2πσ)

We know: G(u)=F(u) H(u)

H(u) ATTENUATES high frequencies in F(u)(LOW-PASS FILTER)

Sampling TheoremSampling Theoremf(x)

x

CONTINUOUSSIGNAL

S(x)

x

……SHAH FUNCTION

x0

n

nxxxS )()( 0

)(*)()(

)().()().()( 0

uSuFuF

nxxxfxsxfxf

s

ns

Sampled Function:

CSc 83020 3-D Computer Vision / Ioannis StamosCSc 83020 3-D Computer Vision / Ioannis Stamos

Sampling TheoremSampling Theorem

n

s x

nu

xuFuF )(

1*)()(

00

……

1/x0

F(u)Let:

umax

S(u)

uA

Sampling TheoremSampling Theorem

n

s x

nu

xuFuF )(

1*)()(

00

u……

1/x0

S(u)

F(u)Let:

umax

Fs(u)……

Here: umax <= 1/(2*x0)

u

u

A

A/x0

CSc 83020 3-D Computer Vision / Ioannis StamosCSc 83020 3-D Computer Vision / Ioannis Stamos

Sampling TheoremSampling Theorem

Fs(u)……u

What if umax > 1/(2*x0) ?

A/x0

1/x0

CSc 83020 3-D Computer Vision / Ioannis StamosCSc 83020 3-D Computer Vision / Ioannis Stamos

Sampling TheoremSampling Theorem

Fs(u)……u

What if umax > 1/(2*x0) ?

1/x0

A/x0ALIASING

Can we recover F(u) from Fs(u)?

CSc 83020 3-D Computer Vision / Ioannis StamosCSc 83020 3-D Computer Vision / Ioannis Stamos

Sampling TheoremSampling Theorem

Fs(u)……u

What if umax > 1/(2*x0) ?

1/x0

A/x0

Can we recover F(u) from Fs(u)?

Only if umax <= 1 /(2*x0) (NYQUIST FREQUENCY).

ALIASING

CSc 83020 3-D Computer Vision / Ioannis StamosCSc 83020 3-D Computer Vision / Ioannis Stamos

FromShreeNayar’snotes.

Figure 8.11. Left: At the top is a 256x256 pixel image showing a grid obtained by multiplying two sinusoids with linearly increasing frequency . one in x and one in y. The other images in the series are obtained by resampling by factors of two, without smoothing (i.e. the next is a 128x128, then a 64x64, etc., all scaled to the same size). Note the substantial aliasing; high spatial frequencies alias down to low spatial frequencies, and the smallest image is an extremely poor representation of the large image. Right: The magnitude of the Fourier transform of each image . displayed as a log, to compress the intensity scale. The constant component is at the center. Notice that the Fourier transform of a resampled image is obtained by scaling the Fourier transform of the original image and then tiling the plane. Interference between copies of the original Fourier transform means that we cannot recover its value at some points . this is the mechanism of aliasing.

Original Image256x256

Resampled128x128

Resampled64x64

CorrespondingFourier Transforms

ALIASING

2-D Domain - Images2-D Domain - ImagesSpatial Domain(x,y) => Frequency Domain Spatial Domain(x,y) => Frequency Domain

(u,v)(u,v)

dudvevuFyxf

dxdyeyxfvuF

vyuxi

vyuxi

)(2

)(2

),(),(

),(),(

f(x,y) g(x,y)h(x,y)

LSIS:

δ(x,y) h(x,y)h(x,y)

Point Spread Function

From Forsyth & Ponce

Table 8.1. A variety of functions of two dimensions, and their Fourier transforms. This table can be used in two directions (with appropriate substitutions for u, v and (x, y), because the Fourier transform of the Fourier transform of a function is the function. Observant readers may suspect that the results on infite sums of δ functions contradict the linearity of Fourier transforms; by careful inspection of limits, it is possible to show that they do not.

2πi

CSc 83020 3-D Computer Vision / Ioannis StamosCSc 83020 3-D Computer Vision / Ioannis Stamos

Discrete 2-D Fourier Discrete 2-D Fourier TransformTransform

Fast Fourier Transform (FFT)!

M

k

N

l

NMkmi

M

k

N

l

NMkmi

enmFlkf

elkfMNnmF

1 1

)ln//(2

1 1

)ln//(2

),(),(

),()/1(),(

CSc 83020 3-D Computer Vision / Ioannis StamosCSc 83020 3-D Computer Vision / Ioannis Stamos

FromShreeNayar’snotes.

CSc 83020 3-D Computer Vision / Ioannis StamosCSc 83020 3-D Computer Vision / Ioannis Stamos

From Forsyth & Ponce.

Image 1

Image 2

Log of Fouriermagnitude Phase Spectrum

Discussion

CSc 83020 3-D Computer Vision / Ioannis StamosCSc 83020 3-D Computer Vision / Ioannis Stamos

From Forsyth & Ponce.

CSc 83020 3-D Computer Vision / Ioannis StamosCSc 83020 3-D Computer Vision / Ioannis Stamos

Figure 8.11. Left: At the top is a 256x256 pixel image showing a grid obtained by multiplying two sinusoids with linearly increasing frequency . one in x and one in y. The other images in the series are obtained by resampling by factors of two, without smoothing (i.e. the next is a 128x128, then a 64x64, etc., all scaled to the same size). Note the substantial aliasing; high spatial frequencies alias down to low spatial frequencies, and the smallest image is an extremely poor representation of the large image. Right: The magnitude of the Fourier transform of each image . displayed as a log, to compress the intensity scale. The constant component is at the center. Notice that the Fourier transform of a resampled image is obtained by scaling the Fourier transform of the original image and then tiling the plane. Interference between copies of the original Fourier transform means that we cannot recover its value at some points . this is the mechanism of aliasing.

Original Image256x256

Resampled128x128

Resampled64x64

CorrespondingFourier Transforms

ALIASING

Figure 8.11. Left: At the top is a 256x256 pixel image showing a grid obtained by multiplying two sinusoids with linearly increasing frequency . one in x and one in y. The other images in the series are obtained by resampling by factors of two, without smoothing (i.e. the next is a 128x128, then a 64x64, etc., all scaled to the same size). Note the substantial aliasing; high spatial frequencies alias down to low spatial frequencies, and the smallest image is an extremely poor representation of the large image. Right: The magnitude of the Fourier transform of each image . displayed as a log, to compress the intensity scale. The constant component is at the center. Notice that the Fourier transform of a resampled image is obtained by scaling the Fourier transform of the original image and then tiling the plane. Interference between copies of the original Fourier transform means that we cannot recover its value at some points . this is the mechanism of aliasing.

Resampled32x32

Resampled16x16

CorrespondingFourier Transforms

ALIASINGFrom Forsyth & Ponce

CSc 83020 3-D Computer Vision / Ioannis StamosCSc 83020 3-D Computer Vision / Ioannis Stamos

Figure 8.12. Left: Resampled versions of the image of figure 8.11, again by factors of two, but this time each image is smoothed with a Gaussian of σ one pixel before resampling.This filter is a low-pass filter, and so suppresses high spatial frequency components, reducing aliasing. Right: The effect of the low-pass filter is easily seen in these logmagnitude images; the low pass filter suppresses the high spatial frequency components so that components interfere less, to reduce aliasing.

Original Image256x256

CorrespondingFourier Transforms

LOW PASS FILTERING

σ=1 pixel

CSc 83020 3-D Computer Vision / Ioannis StamosCSc 83020 3-D Computer Vision / Ioannis Stamos

Figure 8.12. Left: Resampled versions of the image of figure 8.11, again by factors of two, but this time each image is smoothed with a Gaussian of σ one pixel before resampling.This filter is a low-pass filter, and so suppresses high spatial frequency components, reducing aliasing. Right: The effect of the low-pass filter is easily seen in these logmagnitude images; the low pass filter suppresses the high spatial frequency components so that components interfere less, to reduce aliasing.

CorrespondingFourier Transforms

LOW PASS FILTERING

σ=1 pixel

FromForsyth & Ponce

CSc 83020 3-D Computer Vision / Ioannis StamosCSc 83020 3-D Computer Vision / Ioannis Stamos

Figure 8.12. Left: Resampled versions of the image of figure 8.11, again by factors of two, but this time each image is smoothed with a Gaussian of σ one pixel before resampling.This filter is a low-pass filter, and so suppresses high spatial frequency components, reducing aliasing. Right: The effect of the low-pass filter is easily seen in these logmagnitude images; the low pass filter suppresses the high spatial frequency components so that components interfere less, to reduce aliasing.

Original Image256x256

CorrespondingFourier Transforms

LOW PASS FILTERING

Gaussian σ=2 pixels

CSc 83020 3-D Computer Vision / Ioannis StamosCSc 83020 3-D Computer Vision / Ioannis Stamos

Figure 8.12. Left: Resampled versions of the image of figure 8.11, again by factors of two, but this time each image is smoothed with a Gaussian of σ one pixel before resampling.This filter is a low-pass filter, and so suppresses high spatial frequency components, reducing aliasing. Right: The effect of the low-pass filter is easily seen in these logmagnitude images; the low pass filter suppresses the high spatial frequency components so that components interfere less, to reduce aliasing.

CorrespondingFourier Transforms

LOW PASS FILTERING

σ=2 pixels

FromForsyth & Ponce

Gaussian Smoothing versus Averaging

Filter mask (averaging) Filter mask (gaussian)

Original image (grass)

Result of averaging

Result of Gaussian smoothing

From Forsyth & Ponce

CSc 83020 3-D Computer Vision / Ioannis StamosCSc 83020 3-D Computer Vision / Ioannis Stamos

Figure 8.1. Although a uniform local average may seem to give a good blurring model, it generates effects that are not usually seen in defocussing a lens. The images above compare the effects of a uniform local average with weighted average. The image at the top shows a view of grass. On the left in the second row, the result of blurring this image using a uniform local model and on the right, the result of blurring this image using a set of Gaussian weights. The degree of blurring in each case is about the same, but the uniform average produces a set of narrow vertical and horizontal bars, an effect often known as ringing. The bottom row shows the weights used to blur the image, themselves rendered as an image; bright points represent large values and dark points represent small values (in this example the smallest values are zero).

FromShreeNayar’snotes.

FromShreeNayar’snotes.

FromShreeNayar’snotes.