Lec-2 Image Enhancement in the Frequency Domain

Post on 21-Jul-2016

26 views 1 download

description

jhhjjj

transcript

1

Image Enhancement in the Frequency Domain

Frequency Domain Filtering

Basic steps for filtering in the frequency domain

Basics of filtering in the frequency domain1. multiply the input image by (-1)x+y to center the

transform to u = M/2 and v = N/2 (if M and N are even numbers, then the shifted coordinates will be integers)

2. compute F(u,v), the DFT of the image from (1)3. multiply F(u,v) by a filter function H(u,v)4. compute the inverse DFT of the result in (3)5. obtain the real part of the result in (4)6. multiply the result in (5) by (-1)x+y to cancel the

multiplication of the input image.

Images Black and white image is a 2D matrix. Intensities represented as pixels. Color images are 3D matrix, RBG.

Linear Filtering About modifying pixels based on neighborhood.

Local methods simplest. Linear means linear combination of neighbors.

Linear methods simplest. Useful to:

• Integrate information over constant regions.• Scale.• Detect changes.

Fourier analysis. Many nice slides taken from image database.

Filtering to reduce noise Noise is what we’re not interested in.

• We’ll discuss simple, low-level noise: Light fluctuations; Sensor noise; Quantization effects; Finite precision

• Not complex: shadows; extraneous objects. A pixel’s neighborhood contains

information about its intensity. Averaging noise reduces its effect.

Additive noise I = S + N. Noise doesn’t depend on

signal. We’ll consider:

ddistributey identicall ,

for t independen , tic.determinis

0)( with

ji

jiji

i

iiii

nn

nnnns

nEnsI

Average Filter• Mask with positive

entries, that sum 1.• Replaces each pixel

with an average of its neighborhood.

• If all weights are equal, it is called a BOX filter.

111111

1111 11

1111

11

FF

1/91/9

Does it reduce noise?

• Intuitively, takes out small variations.

),0(~),(ˆ1)),(ˆ(

0)),(ˆ(

),(1),(ˆm1

),(),(ˆm1 j)O(i,

)N(0,~j)N(i, with ),(),(ˆ),(

22

22

2/

2/

2/

2/

),(ˆ

2/

2/

2/

2/

2/

2/

2/

2/

mNjiN

mm

mjiNE

jiNE

kjhiNm

kjhiI

kjhiNkjhiI

jiNjiIjiI

m

mh

m

mk

jiN

m

mh

m

mk

m

mh

m

mk

2

2 2

Example: Smoothing by Averaging

Smoothing as Inference About the Signal

+ =

Nearby points tell more about the signal than distant ones.

Neighborhood for averaging.

Gaussian Averaging Rotationally

symmetric. Weights nearby

pixels more than distant ones.• This makes sense

as probabalistic inference. A Gaussian gives a

good model of a fuzzy blob

exp x2 y2

22

An Isotropic Gaussian The picture shows a

smoothing kernel proportional to

(which is a reasonable model of a circularly symmetric fuzzy blob)

Smoothing with a Gaussian

The effects of smoothing Each row shows smoothingwith gaussians of differentwidth; each column showsdifferent realizations of an image of gaussian noise.

Efficient Implementation

Both, the BOX filter and the Gaussian filter are separable:• First convolve each row with a 1D filter• Then convolve each column with a 1D filter.

Smoothing as Inference About the Signal: Non-linear Filters.

+ =

What’s the best neighborhood for inference?

Filtering to reduce noise: Lessons Noise reduction is probabilistic inference. Depends on knowledge of signal and

noise. In practice, simplicity and efficiency

important.

Filtering and Signal Smoothing also smooths signal. Removes detail This is good and bad: - Bad: can’t remove noise w/out blurring

shape. - Good: captures large scale structure

Notch filter

otherwise 1

N/2 (M/2, v)(u, if 0),(

) vuH

• this filter is to force the F(0,0) which is the average value of an image (dc component of the spectrum)• the output has prominent edges• in reality the average of the displayed image can’t be zero as it needs to have negative gray levels. the output image needs to scale the gray level

Low pass filter

high pass filter

Add the ½ of filter height to F(0,0) of the high pass filter

Correspondence between filter in spatial and frequency domains

Convolution

Convolution kernel g, represented as matrix.• it’s associative

Result is:

Smoothing Frequency-domain filters: Ideal Lowpass filter

image power circles

Result of ILPF

Example

Butterworth Lowpass Filter: BLPF

Example

Spatial representation of BLPFs

Gaussian Lowpass Filter: GLPF

Example

Example

Example

Example

Sharpening Frequency Domain Filter: Ideal highpass filter

Butterworth highpass filter

Gaussian highpass filter

0

0

Dv)D(u, if 1Dv)D(u, if 0

),( vuH

nvuDvuH 2

0 ),(D11),(

20

2 2/),(1),( DvuDevuH

Spatial representation of Ideal, Butterworth and Gaussian highpass filters

Example: result of IHPF

Example: result of BHPF

Example: result of GHPF

Laplacian in the Frequency domain

Example: Laplacian filtered image

Example: high-boost filter

Examples

2-D Fourier Transform Properties