Filter Designcse.iitkgp.ac.in/~ksrao/pdf/ip-19/rcg-ch4b.pdf · Filtering Steps f(x,y) is MxN. Pad...

Preview:

Citation preview

Filter Design

Lecture 20: 10-Sep-12

Dr. P P Das

Filtering in Frequency Domain

yxyxf

vuF

vuH

vuH

vuFvuHyxg

)1(by ),(y premultipl

- centered is ),( Needs

centerabout symmetric is ),(Usually

unctionTransfer F Filter :),(

),(),(),( 1

Example: Frequency Domain Filter

otherwise

QvPuvuH

,1

2/,2/,0),(

),(),(),( 1 vuFvuHyxg

Wraparound Effect & Zero Padding

Can we pad the filter?

Filtering Steps

f(x,y) is MxN. Pad to PxQ. Typically, P=2M, Q=2N Form fp(x,y) of size PxQ by adding necessary zeros to f(x,y) Multiply fp(x,y) by (–1)^(x+y) to center transform Compute F(u,v) by DFT of fp(x,y) Use real symmetric filter H(u,v), of size PxQ & center at (P/2,

Q/2). Form G(u,v)=H(u,v)F(u,v) Compute gp(x,y) by product of real part of IDFT of G(u,v) and

(–1)^(x+y). Extract g(x,y) taking MxN at left top corner of gp(x,y)

Filter Design

Lecture 21-22: 11-Sep-12

Dr. P P Das

Filtering Steps

f(x,y) is MxN. Pad to PxQ. Typically, P=2M, Q=2N Form fp(x,y) of size PxQ by adding necessary zeros to f(x,y) Multiply fp(x,y) by (–1)^(x+y) to center transform Compute F(u,v) by DFT of fp(x,y) Use real symmetric filter H(u,v), of size PxQ & center at (P/2,

Q/2). Form G(u,v)=H(u,v)F(u,v) Compute gp(x,y) by product of real part of IDFT of G(u,v) and

(–1)^(x+y). Extract g(x,y) taking MxN at left top corner of gp(x,y)

Filtering in Spatial vis-à-vis Frequency Domains

Filter(FIR) ResponseImpulse Finite:),(

: Hencefinite. are ),( in Quantities

),( of ResponseImpulse :y)(x,

)},({),(Output

: Hence.1),(),,(),(Let

),( : Filter DomainSpatial

),( : FilterDomainFrequency

1

yxh

yxh

vuHh

vuHyxh

vuFyxyxf

yxh

vuH

Example Gaussian Filter

222

22

2

2/

2)(

)(

: FilterLowpass

x

u

Aexh

AeuH

21

22

21

2/2/

and

22)(

)(

: FilterHighpass

222

2221

2

22

221

2

BA

BeAexh

BeAeuHxx

uu

versa- viceand

)( of profileNarrow

)( of profile Broad

High

xh

uH

222

22

2

2/

2)(

)(x

u

Aexh

AeuH

22

2222

12

22

221

2

22

21

2/2/

22)(

)(xx

uu

BeAexh

BeAeuH

Image Smoothing

Frequency Domain Filters

Image Smoothing – Low-pass Filter

Low-pass Filtering– Ideal: Very sharp– Butterworth– Gaussian: Very Smooth

Butterworth Filter is parameterized by Filter Order– High Order Ideal– Low Order Gaussian

Ideal Low-Pass Filter (ILPF)

Frequencyoff-Cut :

)2/()2/(),(

),(,0

),(,1),(

0

2/122

0

0

D

QvPuvuD

DvuD

DvuDvuH

Ideal Low-Pass Filter (ILPF)

Ideal Low-Pass Filter (ILPF)

),(),(),(),( where

),( : PowerImage Total

222

1

0

1

0

vuIvuRvuFvuP

vuPPP

u

Q

vT

}),(:,{ 0

/),(100

:filterby off-cutpower ofPercent

DvuDvuTPvuP

Ideal Low-Pass Filter (ILPF)

ILPF

Radius Power (α)

10 87.0

30 93.1

60 95.7

160 97.8

460 99.2

Blurring & Ringing decreases with increase of radius / power

Blurring & Ringing in ILPF

ILPF Box Filter Sinc in Spatial Domain

Butterworth Low-Pass Filter (BLPF)

BLPFofOrder :

Frequencyoff-Cut :

)2/()2/(),(

/),(1

1),(

0

2/122

20

n

D

QvPuvuD

DvuDvuH n

Butterworth Low-Pass Filter (BLPF)

Unlike ILPF, no sharp cut-off

BLPF

Radius

10

30

60

160

460

ILPF BLPF

- Smooth transition in blurring- No ringing

- Sharp transition in response causing heavy blurring & ringing

BLPF: Ringing increases with order

Gaussian Low Pass Filter (GLPF)

Frequencyoff-Cut :

),(

centerabout spread of Measure:

)2/()2/(),(

),(

0

2/),(

2/122

2/),(

20

2

22

D

evuH

QvPuvuD

evuH

DvuD

vuD

Gaussian Low Pass Filter (GLPF)

Radius

10

30

60

160

460

GLPF

- No ringing as IDFT of Gaussian is Gaussian

ILPF BLPF-Smooth transition in blurring- No ringing

GLPF- No ringing- Sharp transition in

response causing heavy blurring & ringing

Radius: 10, 30, 60, 160, 460

GLFP

BLFP

ILFP

Image Smoothing: Low-Pass Filters

LPF: Character Recognition

LFT: Printing & Publishing

LFT: Printing & Publishing

LPF: Satellite Imagery

Image Sharpening

Frequency Domain Filters

High-Pass Filter (HPF)

),(1),( vuHvuH LPHP

Image Sharpening – High-pass Filter

High-pass Filtering– Ideal: Very sharp– Butterworth– Gaussian: Very Smooth

Butterworth Filter is parameterized by Filter Order– High Order Ideal– Low Order Gaussian

Ideal High-Pass Filter (IHPF)

Frequencyoff-Cut :

)2/()2/(),(

),(,1

),(,0),(

0

2/122

0

0

D

QvPuvuD

DvuD

DvuDvuH

IHFP

BHFP

GHFP

Image Sharpening: High-Pass Filters

Ideal High-Pass Filter (IHPF)

Butterworth High-Pass Filter (BHPF)

BLPFofOrder :

Frequencyoff-Cut :

)2/()2/(),(

),(/1

1),(

0

2/122

20

n

D

QvPuvuD

vuDDvuH n

Butterworth High-Pass Filter (BHPF)

Gaussian High Pass Filter (GHPF)

Frequencyoff-Cutt :

)2/()2/(),(

1),(

0

2/122

2/),( 20

2

D

QvPuvuD

evuH DvuD

Gaussian High Pass Filter (GHPF)

IHPFBHPF GHPF

Radius: 30, 60, 160

Image Sharpening: High-Pass Filters

HPF: Finger Print

BHPF: n=4, D0=50

Thank you

Filter Design

Lecture 23: 17-Sep-12

Dr. P P Das

Laplacian in Spatial Domain

Laplacian– Isotropic – Rotation Invariant

),(4)1,()1,(

),1(),1(2

yxfyxfyxf

yxfyxff

),(),(),( 2 yxfcyxfyxg

2

2

2

22

z

f

t

ff

Laplacian in Frequency Domain

dudteeztfFztf ujtj 22),(),()},({

),()(4}{

),(4}{),(4}{

)},({4

),()2(

),()},({),(

2222

2

2

2

22

222

222

2

2

122

2222

2

221

Ff

z

f

t

ff

Fz

fF

t

f

F

ddeeFjt

f

ddeeFFztf

jtj

jtj

2

2

2

22

z

f

t

ff

Laplacian in Frequency Domain

)},(),{{),(

:image an of Laplacian

),(4

))2/()2/(4),(

:rectanglefrequency ofcenter respect to With

)(4),(

12

22

222

222

vuFvuHyxf

vuD

QvPuvuH

vuvuH

Laplacian in Frequency Domain

Enhancement Eq:

Scales of and as computed by DFT differ widely due to the DFT process

Normalize to [0,1] before DFT Normalize to [-1,1]

1

),(),(),( 2

c

yxfcyxfyxg

),( yxf ),(2 yxf

),( yxf

),(2 yxf

Laplacian in Frequency Domain

Comparative Laplacian in Spatial & Frequency Domains

Unsharp Mask, Highboost Filtering & High-Frequency-Emphasis Filtering

In spatial domain:

Masking Unsharpemphasized- De:1

Filtering Highboost:1

Masking Unsharp:1

),(*),(),(

),(),(),(

k

k

k

yxgkyxfyxg

yxfyxfyxg

mask

mask

Unsharp Mask, Highboost Filtering & High-Frequency-Emphasis Filtering

In frequency domain:

),(),(),(

),(),(),(1 vuFvuHyxf

yxfyxfyxg

LPLP

LPmask

)},(),(*1{

)},(),(1*1{

),(*),(),(

1

1

vuFvuHk

vuFvuHk

yxgkyxfyxg

FilterEmphasisFrequencyHigh

HP

LP

mask

Unsharp Mask, Highboost Filtering & High-Frequency-Emphasis Filtering

In frequency domain:

sfrequencie high of oncontributi theControls:0

origin fromoffset theControls:0

)},(),(*{),(

2

1

211

k

k

vuFvuHkkyxgFilterEmphasisFrequencyHigh

HP

Image: 416x596

D0=40 (5% of short side of padded image)

k1=0.5

k2=0.75

Homomorphic Filtering

Illumination-Reflectance Model in frequency domain Illumination Component

– Slow Spatial Variations– Attenuate contributions by illumination

Reflectance Component– Varies abruptly – junctions of dissimilar objects– Amplify contributions by reflectance

Simultaneous dynamic range compression & contrast enhancement

Homomorphic Filtering

),(),(),(

)},({ln)},({ln

)},({ln)},({

),(ln),(ln

),(ln),(

),(),(),(

vuFvuFvuZ

yxryxi

yxfyxz

yxryxi

yxfyxz

yxryxiyxf

ri

Homomorphic Filtering

),('),('

)},(),({)},(),({

)},({),(

),(),(),(),(

),(),(),(

),(),(),(

11

1

yxryxi

vuFvuHvuFvuH

vuSyxs

vuFvuHvuFvuH

vuZvuHvuS

vuFvuFvuZ

ri

ri

ri

Homomorphic Filtering

),(),(),( 00),('),('),( yxryxieeeyxg yxryxiyxs

Homomorphic Filtering

Illumination Component– Slow Spatial Variations– Low Frequencies log of illumination– attenuate contributions by illumination

Reflectance Component– Varies abruptly – junctions of dissimilar objects– High frequencies log of reflectance– amplify contributions by reflectance

Simultaneous dynamic range compression & contrast enhancement

1L

1H

LDvuDc

HL evuH 20

2 /),(1)(),(

Homomorphic Filtering

Image: 1162x746γL=0.25, γH=2, c=1, D0=80

Band-reject & Band-pass Filters

),(1),( vuHvuH BRBP

Band-reject & Band-pass Filters

D0=80, n=4

Notch Filters – Narrow Filtering

Notch Filters – Narrow Filtering

Q

kkkNR vuHvuHvuH

1

),(),(),(

2/122

2/122

)2/()2/(),(

)2/()2/(),(

kkk

kkk

vNvuMuvuD

vNvuMuvuD

Butterworth Notch Reject Filters

nkkk

nkk

NR

vuDDvuDD

vuH

20

3

12

0 ),(/1

1

),(/1

1

),(

),(1),( vuHvuH NRNP

D0=80, n=4

Thank you

Recommended