digital image processing csc331 image enhancement 1

55
Digital Image Processing CSC331 Image Enhancement 1

Upload: frederica-knight

Post on 13-Jan-2016

245 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Digital Image Processing CSC331 Image Enhancement 1

1

Digital Image ProcessingCSC331

Image Enhancement

Page 2: Digital Image Processing CSC331 Image Enhancement 1

2

Summery of previous lecture

• First order derivatives using the gradient operator

• Shobel operator using first order derivatives• What are Edges in image?• Modeling intensity changes• Steps of edge detection

Page 3: Digital Image Processing CSC331 Image Enhancement 1

3

Todays lecture

• Frequency domain Filters • Ideal Lowpass Filters • Butterworth Highpass Filters• Gaussian Highpass Filters• The Laplacian in the Frequency Domain• High boost filtering• Homomorphic Filtering

Page 4: Digital Image Processing CSC331 Image Enhancement 1

Background

• Any function that periodically repeats itself can be expressed as the sum of sines and/or cosines of different frequencies, each multiplied by a different coefficient (Fourier series).

• Even functions that are not periodic (but whose area under the curve is finite) can be expressed as the integral of sines and/or cosines multiplied by a weighting function (Fourier transform).

Page 5: Digital Image Processing CSC331 Image Enhancement 1

Background

• The frequency domain refers to the plane of the two dimensional discrete Fourier transform of an image.

• The purpose of the Fourier transform is to represent a signal as a linear combination of sinusoidal signals of various frequencies.

Page 6: Digital Image Processing CSC331 Image Enhancement 1

Introduction to the Fourier Transform and the Frequency Domain

• The one-dimensional Fourier transform and its inverse– Fourier transform (continuous case)

– Inverse Fourier transform:

• The two-dimensional Fourier transform and its inverse– Fourier transform (continuous case)

– Inverse Fourier transform:

dueuFxf uxj 2)()(

dydxeyxfvuF vyuxj )(2),(),(

1 where)()( 2

jdxexfuF uxj

dvduevuFyxf vyuxj )(2),(),(

Page 7: Digital Image Processing CSC331 Image Enhancement 1

Introduction to the Fourier Transform and the Frequency Domain

• The one-dimensional Fourier transform and its inverse– Fourier transform (discrete case) DTC

– Inverse Fourier transform:

1,...,2,1,0for )(1

)(1

0

/2

MuexfM

uFM

x

Muxj

1,...,2,1,0for )()(1

0

/2

MxeuFxfM

u

Muxj

Page 8: Digital Image Processing CSC331 Image Enhancement 1

8

Frequency Domain Methods

Spatial Domain Frequency Domain

Page 9: Digital Image Processing CSC331 Image Enhancement 1

9

Major filter categories

• Typically, filters are classified by examining their properties in the frequency domain:

(1) Low-pass (2) High-pass (3) Band-pass (4) Band-stop

Page 10: Digital Image Processing CSC331 Image Enhancement 1

10

Example

Original signal

Low-pass filtered

High-pass filtered

Band-pass filtered

Band-stop filtered

Page 11: Digital Image Processing CSC331 Image Enhancement 1

11

Page 12: Digital Image Processing CSC331 Image Enhancement 1

12

Frequency Domain Methods

Page 13: Digital Image Processing CSC331 Image Enhancement 1

13

Page 14: Digital Image Processing CSC331 Image Enhancement 1

14

Low pass filter functions• left hand side: frequency

domain filter H (u) as a function of u

• right hand side: spatial domain filter h (x) which is a function of x.

• filter H (u) as a function of u in the frequency domain, the corresponding filter h (x) in the spatial domain, will have all positive values.

• A low-pass filter leaves the low frequencies alone.

• We expect a low-pass filter to smooth the image. This is good for removing noise, but blurs the image.

Page 15: Digital Image Processing CSC331 Image Enhancement 1

15

Low pass filter Mask

Page 16: Digital Image Processing CSC331 Image Enhancement 1

16

Page 17: Digital Image Processing CSC331 Image Enhancement 1

17

Page 18: Digital Image Processing CSC331 Image Enhancement 1

18

high pass filters in the Gaussian domain

• A high-pass filter leaves the high frequencies alone.

• We expect a high-pass filter to sharpen the edges.

• This is good for edge detection.

Page 19: Digital Image Processing CSC331 Image Enhancement 1

19

Plot high pass filter • The plot in the frequency

domain, shows the high pass filter in the frequency domain.

• It attenuate the low frequency components whereas it will pass the high frequency components and the corresponding filter in the spatial domain is in form of h (x) as the function of x.

• The function h (x) can be positive as well as negative;

• In the spatial domain, the Laplacian operator is of similar nature.

Page 20: Digital Image Processing CSC331 Image Enhancement 1

20

Laplacian mask as a high pass filtering

Page 21: Digital Image Processing CSC331 Image Enhancement 1

21

Page 22: Digital Image Processing CSC331 Image Enhancement 1

22

Page 23: Digital Image Processing CSC331 Image Enhancement 1

Correspondence between Filtering in the Spatial and Frequency Domain

Page 24: Digital Image Processing CSC331 Image Enhancement 1

Correspondence between Filtering in the Spatial and Frequency Domain

• One very useful property of the Gaussian function is that both it and its Fourier transform are real valued; there are no complex values associated with them.

• In addition, the values are always positive. So, if we convolve an image with a Gaussian function, there will never be any negative output values to deal with.

• There is also an important relationship between the widths of a Gaussian function and its Fourier transform. If we make the width of the function smaller, the width of the Fourier transform gets larger. This is controlled by the variance parameter 2 in the equations.

• These properties make the Gaussian filter very useful for lowpass filtering an image. The amount of blur is controlled by 2. It can be implemented in either the spatial or frequency domain.

• Other filters besides lowpass can also be implemented by using two different sized Gaussian functions.

Page 25: Digital Image Processing CSC331 Image Enhancement 1

25

Basic model for filtering operation

Page 26: Digital Image Processing CSC331 Image Enhancement 1

Ideal Lowpass Filters (ILPFs)

Page 27: Digital Image Processing CSC331 Image Enhancement 1

Ideal Lowpass Filters (ILPFs)

Page 28: Digital Image Processing CSC331 Image Enhancement 1

Ideal Lowpass Filters

Page 29: Digital Image Processing CSC331 Image Enhancement 1

Butterworth Lowpass Filters (BLPFs)With order n

nDvuDvuH 2

0/),(1

1),(

Page 30: Digital Image Processing CSC331 Image Enhancement 1

Butterworth LowpassFilters (BLPFs)

n=2D0=5,15,30,80,and 230

Page 31: Digital Image Processing CSC331 Image Enhancement 1

Butterworth Lowpass Filters (BLPFs)Spatial Representation

n=1 n=2 n=5 n=20

Page 32: Digital Image Processing CSC331 Image Enhancement 1

Gaussian Lowpass Filters (FLPFs)

20

2 2/),(),( DvuDevuH

Page 33: Digital Image Processing CSC331 Image Enhancement 1

Gaussian Lowpass Filters (FLPFs)

D0=5,15,30,80,and 230

Page 34: Digital Image Processing CSC331 Image Enhancement 1

Additional Examples of Lowpass Filtering

Page 35: Digital Image Processing CSC331 Image Enhancement 1

Additional Examples of Lowpass Filtering

Page 36: Digital Image Processing CSC331 Image Enhancement 1

Sharpening Frequency Domain FilterIdeal high pass filter

),(),( vuHvuH lphp Ideal highpass filter

Butterworth highpass filter

Gaussian highpass filter

),( if 1

),( if 0),(

0

0

DvuD

DvuDvuH

nvuDDvuH 2

0 ),(/1

1),(

20

2 2/),(1),( DvuDevuH

Page 37: Digital Image Processing CSC331 Image Enhancement 1

Highpass FiltersSpatial Representations

Page 38: Digital Image Processing CSC331 Image Enhancement 1

Ideal Highpass Filters

),( if 1

),( if 0),(

0

0

DvuD

DvuDvuH

Page 39: Digital Image Processing CSC331 Image Enhancement 1

Butterworth Highpass Filters

nvuDDvuH 2

0 ),(/1

1),(

Page 40: Digital Image Processing CSC331 Image Enhancement 1

Gaussian Highpass Filters

20

2 2/),(1),( DvuDevuH

Page 41: Digital Image Processing CSC331 Image Enhancement 1

• The Laplacian filter

• Shift the center:

The Laplacian in the Frequency Domain

)(),( 22 vuvuH

22 )

2()

2(),(

Nv

MuvuH

Frequencydomain

Spatial domain

Page 42: Digital Image Processing CSC331 Image Enhancement 1

domain spatial in the image

filtered-Laplacian the:),(

where

),(),(),(

2

2

yxf

yxfyxfyxg

For display purposes only

Page 43: Digital Image Processing CSC331 Image Enhancement 1

43

High boost filtering

Page 44: Digital Image Processing CSC331 Image Enhancement 1

44

High boost filtering results

Page 45: Digital Image Processing CSC331 Image Enhancement 1

Homomorphic filtering• Many times, we want to remove shading

effects from an image (i.e., due to uneven illumination)– Enhance high frequencies– Attenuate low frequencies but preserve fine

detail.

Page 46: Digital Image Processing CSC331 Image Enhancement 1

Homomorphic Filtering (cont’d)

• Consider the following model of image formation:

• In general, the illumination component i(x,y) varies slowly and affects low frequencies mostly.

• In general, the reflection component r(x,y) varies faster and affects high frequencies mostly.

i(x,y): illuminationr(x,y): reflection

IDEA: separate low frequencies due to i(x,y) from high frequencies due to r(x,y)

Page 47: Digital Image Processing CSC331 Image Enhancement 1

How are frequencies mixed together?

• When applying filtering, it is difficult to handle low/high frequencies separately.

• Low and high frequencies from i(x,y) and r(x,y) are mixed together.

( , ) ( , )* ( , )F u v I u v R u v

( , ) ( , ) [ ( , )* ( , )] ( , )F u v H u v I u v R u v H u v

Page 48: Digital Image Processing CSC331 Image Enhancement 1

Can we separate them?

• Idea:

Take the ln( ) of

Page 49: Digital Image Processing CSC331 Image Enhancement 1

Steps of Homomorphic Filtering

(1) Take

(2) Apply FT:

or

(3) Apply H(u,v)

Page 50: Digital Image Processing CSC331 Image Enhancement 1

Steps of Homomorphic Filtering (cont’d)

(4) Take Inverse FT:

or

(5) Take exp( ) or ),(),(),( 00 yxryxiyxg

Page 51: Digital Image Processing CSC331 Image Enhancement 1

Example using high-frequency emphasis

Attenuate the contribution made by

illumination and amplify the contribution made by

reflectance

Attenuate the contribution made by

illumination and amplify the contribution made by

reflectance

2 2 20( )/

( , ) ( ) 1c u v D

H L LH u v e

Page 52: Digital Image Processing CSC331 Image Enhancement 1

Homomorphic Filtering: Example

Page 53: Digital Image Processing CSC331 Image Enhancement 1

Homomorphic Filtering: Example

0

0.25

2

1

80

L

H

c

D

Page 54: Digital Image Processing CSC331 Image Enhancement 1

54

Summery of the lecture

• Frequency domain Filters • Ideal Lowpass Filters • Butterworth Highpass Filters• Gaussian Highpass Filters• The Laplacian in the Frequency Domain• High boost filtering• Homomorphic Filtering

Page 55: Digital Image Processing CSC331 Image Enhancement 1

55

References • Prof .P. K. Biswas

Department of Electronics and Electrical Communication Engineering Indian Institute of Technology, Kharagpur

• Gonzalez R. C. & Woods R.E. (2008). Digital Image Processing. Prentice Hall.

• Forsyth, D. A. & Ponce, J. (2011).Computer Vision: A Modern Approach. Pearson Education.