You are on page 1of 5

7/26/2011

1
COMP 9517 Computer Vision
26/07/2011 COMP9517 S2 2011
Frequency Domain Techniques
1
FrequencyVersusSpatialDomain
Spatialdomain
Theimageplaneitself
Directmanipulationofpixels
Changesinpixelpositioncorrespondtochangesin
26/07/2011 COMP9517 S2 2011 2
thescene
Frequencydomain
Fouriertransformofanimage
Directlyrelatedtorateofchangesintheimage
Changesinpixelpositioncorrespondtochangesin
thespatialfrequency
FrequencyDomainOverview
Frequencyinimage
Highfrequenciescorrespondtopixelvaluesthat
changerapidlyacrosstheimage
Lowfrequencycomponentscorrespondtolarge
26/07/2011 COMP9517 S2 2011 3
scalefeaturesintheimage
Frequencydomain
DefinedbyvaluesoftheFouriertransformandits
frequencyvariables(u,v)
FrequencyDomainOverview
Frequencydomainprocessing
26/07/2011 COMP9517 S2 2011 4
FourierSeries
Periodicfunctioncanberepresentedasaweightedsumofsines
andcosines
Evenfunctionsthatarenotperiodic(butwhoseareaunderthe
curveisfinite)canbeexpressedastheintegralofsinesand/or
cosinesmultipliedbyaweightfunction
26/07/2011 COMP9517 S2 2011 5
sum=
OneDimFourierTransformandInverse
Forasinglevariablecontinuousfunctionf(x),
theFouriertransformF(u)isdefinedby:
where .
}


(1) dx ux) exp(-j2 f(x) = F(u) t
1 = j
26/07/2011 COMP9517 S2 2011 6
where.
GivenF(u),werecovergetf(x)usingtheinverse
Fouriertransform:
(1)and(2)constituteaFouriertransformpair
1 j
}


(2) du ux) exp(j2 F(u) = f(x) t
7/26/2011
2
TwoDimFourierTransformandInverse
Intwodimensions,wehave:
(3) dxdy vy)) ux ( exp(-j2 y) f(x, = v) F(u,
-
} }


+ t
(4) dudv vy)) ux ( exp(j2 v) F(u = y) f(x
} }

+ t
26/07/2011 COMP9517 S2 2011 7
(4) dudv vy)) ux ( exp(j2 v) F(u, = y) f(x,
-
} }

+ t
DiscreteFourierTransform
Inonedimension,
(5) 1. - M , 0,1,2, u for ux/M) exp(-j2 f(x)
M
1
= F(u)
1
0
=

=
M
x
t
(6) 1. - M , 0,1,2, for x ux/M) exp(j2 F(u) = f(x)
1
=

M
t
26/07/2011 COMP9517 S2 2011 8
Notethatthelocationof1/Mdoesnotmatter,
solongastheproductofthetwomultipliersis
1/M
Alsointhediscretecase,theFourier
transformanditsinversealwaysexist
0

= x
DiscreteFourierTransform
ConsiderEulersformula:
Substitutingthisexpressioninto(5),andnotingcos(
)=cos(),weobtain
(7) ) jsin( i) cos( exp
j
u u
u
+ =
1
1 M
26/07/2011 COMP9517 S2 2011 9
EachtermofFdependsonallvaluesoff(x),and
valuesoff(x)aremultipliedbysinesandcosinesof
differentfrequencies.
ThedomainoverwhichvaluesofF(u)rangeiscalled
thefrequencydomain,asu determinesthe
frequencyofthecomponentsofthetransform.
(8) 1. - M , 0,1,2, u for , ux/m] jsin2 - ux/M [cos2 f(x)
M
1
= F(u)
0
=

= x
t t
2DDiscreteFourierTransform
Digitalimagesare2Ddiscretefunctions:
(9) 1. - N , 0,1,2, v and 1 - M , 0,1,2, u for
, vy/N)) ux/M ( exp(-j2 y) f(x,
MN
1
= v) F(u,
1
0
1 - N
0 y
= =

= =
M
x
t
26/07/2011 COMP9517 S2 2011 10
(10) 1. - N , 0,1,2, y and 1 - M , 0,1,2, for x
, vy/N)) ux/M ( exp(j2 v) F(u,
MN
1
= y) f(x,
1
0
1 - N
0 v
= =

= =
M
u
t
FrequencyDomainFiltering
Frequencyisdirectlyrelatedtorateofchange,so
frequenciesintheFouriertransformmayberelated
topatternsofintensityvariationsintheimage.
Slowestvaryingfrequencyatu=v=0correspondsto
average gray level of the image
26/07/2011 COMP9517 S2 2011 11
averagegrayleveloftheimage.
Lowfrequenciescorrespondtoslowlyvarying
componentsintheimage forexample,largeareasof
similargraylevels.
Higherfrequenciescorrespondtofastergraylevel
changes suchasedges,noiseetc.
ProcedureforFilteringintheFrequencyDomain
1. Multiplytheinputimageby(1)
x+y
tocentrethe
transform
2. ComputetheDFTF(u,v)oftheresultingimage
3. MultiplyF(u,v)byafilterH(u,v)
26/07/2011 COMP9517 S2 2011 12
4. ComputetheinverseDFTtransformg*(x,y)
5. Obtaintherealpartg(x,y)of4
6. Multiplytheresultby(1)
x+y
7/26/2011
3
Example:NotchFilter
Wewishtoforcetheaveragevalueofanimagetozero.We
canachievethisbysettingF(0,0)=0,andthentakingits
inversetransform.
Sochoosethefilterfunctionas:

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


26/07/2011 COMP9517 S2 2011 13
Calledthenotchfilter constantfunctionwithahole(notch)
attheorigin.
Afilterthatattenuateshighfrequencieswhileallowinglow
frequenciestopassthroughiscalledalowpassfilter.
Afilterthatattenuateslowfrequencieswhileallowinghigh
frequenciestopassthroughiscalledahighpassfilter.

= otherwise. 1 v) (u, H
ConvolutionTheorem:correspondencebetween
spatialandfrequencyfiltering
LetF(u,v)andH(u,v)betheFouriertransformsoff(x,y)and
h(x,y).Let*bespatialconvolution,andmultiplicationbe
elementbyelementproduct.Then
f(x,y)*h(x,y)andF(u,v)H(u,v)constituteaFourier
transformpair,i.e.spatialconvolution(LHS)canbe
b i d b ki h i f f RHS d
26/07/2011 COMP9517 S2 2011 14
obtainedbytakingtheinversetransformofRHS,and
conversely,theRHScanbeobtainedastheforwardFourier
transformofLHS.
Analogously,convolutioninthefrequencydomainreduces
tomultiplicationinthespatialdomain,andviceversa.
Usingthistheorem,wecanalsoshowthatfiltersinthespatial
andfrequencydomainsconstituteaFouriertransformpair.
Exploitingthecorrespondence
Iffiltersinthespatialandfrequencydomainsareof
thesamesize,thenfilteringismoreefficient
computationallyinfrequencydomain.
Spatialfilterstendtobesmallerinsize.
Filt i i l i t iti i f d i
26/07/2011 COMP9517 S2 2011 15
Filteringisalsomoreintuitiveinfrequencydomain
sodesignitthere.
Then,taketheinversetransform,andusethe
resultingfilterasaguidetodesignsmallerfiltersin
thespatialdomain.
ExampleofSmoothinganImage
Inspatialdomain,wejustconvolvetheimagewitha
Gaussiankerneltosmoothit
Infrequencydomain,wecanmultiplytheimagebya
filterachievethesameeffect
26/07/2011 COMP9517 S2 2011 16
ExampleofSmoothinganImage
1. Multiplytheinputimageby(1)
x+y
tocenterthe
transform
2. ComputetheDFTF(u,v)oftheresultingimage
3. MultiplyF(u,v)byafilterG(u,v)
26/07/2011 COMP9517 S2 2011 17
4. ComputertheinverseDFTtransformh*(x,y)
5. Obtaintherealparth(x,y)of4
6. Multiplytheresultby(1)
x+y
ExampleofSmoothinganImage
1. Multiplytheinputimageby(1)
x+y
tocenterthe
transform
2. ComputetheDFTF(u,v)oftheresultingimage
3. MultiplyF(u,v)byafilterG(u,v)
26/07/2011 COMP9517 S2 2011 18
4. ComputertheinverseDFTtransformh*(x,y)
5. Obtaintherealparth(x,y)of4
6. Multiplytheresultby(1)
x+y
7/26/2011
4
ExampleofSmoothinganImage
1. Multiplytheinputimageby(1)
x+y
tocenterthe
transform
2. ComputetheDFTF(u,v)oftheresultingimage
3. MultiplyF(u,v)byafilterG(u,v)
26/07/2011 COMP9517 S2 2011 19
4. ComputertheinverseDFTtransformh*(x,y)
5. Obtaintherealparth(x,y)of4
6. Multiplytheresultby(1)
x+y
ExampleofSmoothinganImage
1. Multiplytheinputimageby(1)
x+y
tocenterthe
transform
2. ComputetheDFTF(u,v)oftheresultingimage
3. MultiplyF(u,v)byafilterG(u,v)
4. ComputertheinverseDFTtransformh*(x,y)
26/07/2011 COMP9517 S2 2011 20
p ( ,y)
5. Obtaintherealparth(x,y)of4
6. Multiplytheresultby(1)
x+y
ExampleofSmoothinganImage
1. Multiplytheinputimageby(1)
x+y
tocenterthe
transform
2. ComputetheDFTF(u,v)oftheresultingimage
3. MultiplyF(u,v)byafilterG(u,v)
4. ComputertheinverseDFTtransformh*(x,y)
26/07/2011 COMP9517 S2 2011 21
p ( ,y)
5. Obtaintherealparth(x,y)of4
6. Multiplytheresultby(1)
x+y
f(x,y)*g(x,y)
F(u,v)G(u,v)
GaussianFilter
Gaussianfiltersareimportantbecausetheirshapesareeasy
tospecify,andboththeforwardandinverseFourier
transformsofaGaussianfunctionarerealGaussianfunctions.
LetH(u)beaonedimensionalGaussianfilterspecifiedby:
2
2
2
A H( )
u

26/07/2011 COMP9517 S2 2011 22


where isthestandarddeviationoftheGaussiancurve.
Thecorrespondingfilterinthespatialdomainis
Thisisusuallyalowpassfilter.
2
2
exp A = H(u)
o
2 2 2
2
exp A 2 = h(x)
x o t
to

DoGFilter
DifferenceofGaussiansmaybeusedtoconstructhighpass
filters:
withand
1
>
2
.
2
2
2
2
1
2
2 2
exp B exp A = H(u)
o o
u u

B A >
26/07/2011 COMP9517 S2 2011 23
1 2
Thecorrespondingfilterinthespatialdomainis
2 2
2
2 2 2
1
2
2
2
2
1
exp B 2 exp A 2 = h(x)
x x o t o t
to to

ImagePyramids
Animagepyramidisacollectionofdecreasing
resolutionimagesarrangedintheshapeofa
pyramid.
26/07/2011 COMP9517 S2 2011 24
7/26/2011
5
ImagePyramids
Systemblockdiagramforcreatingimagepyramids
26/07/2011 COMP9517 S2 2011 25
1. Computeareducedresolutionapproximationoftheinputimage
byfilteringanddownsampling(mean,Gaussian,subsampling)
2. Upsampletheoutputofstep1andfiltertheresult(possiblywith
interpolation)
3. Computethedifferencebetweenthepredictionofstep2andthe
inputtostep1
Repeating,produceapproximationandpredictionresidualpyramids
ImagePyramids
Twoimagepyramidsandtheirstatistics
26/07/2011 COMP9517 S2 2011 26
Upsampleandfilteringthelowestresolution
approximationimage
Addthe1levelhigherLaplacianspredictionresidual
ReferencesandAcknowledgement
Gonzalez andWoods,2002,Chapter4.14.4,7.1
SzeliskiChapter3.13.5
Somematerial,includingimagesandtables,
weredrawnfromthetextbook,DigitalImage
26/07/2011 COMP9517 S2 2011
Processing byGonzalezandWoods,andP.C.
Rossinspresentation.
27

You might also like