Flterng Announcements HW2 wll be posted later today Constructng a mosac by warpng mages. CSE252A Lecture 10a Flterng Exampel: Smoothng by Averagng Kernel: (From Bll Freeman) m=2 I Kernel sze s m+1 by m+1 Convoluton: R= K*I R(, j) = m/2 m/2 h= m/2 k= m/2 R K( h, k) I( h, j k) Propertes of convoluton Let f,g,h be mages and * denote convoluton f * g( x, y) = f ( x u, y v) g( u, v) dudv Commutatve: f*g=g*f Assocatve: f*(g*h)=(f*g)*h Lnear: for scalars a & b and mages f,g,h (af+bg)*h=a(f*h)+b(g*h) Dfferentaton rule f g ( f * g) = * g = f * x x x
Addtve nose I = S + N. Nose doesn t depend on sgnal. We ll consder: I = s + n wth E( n ) = 0 s determnstc. n, n n, n j j ndependent for n dentcally dstrbuted n j Fourer Transform 1-D (sgnal processng) 2-D (mage processng) Consder 1-D Tme doman Frequency Doman Real Complex Consder tme doman sgnal to be expressed as weghted sum of snusod. A snusod cos(ut+φ) s characterzed by ts phase φ and ts frequency u The Fourer sgnal s a functon gvng the weghts (and phase) as a functon of frequency u. Fourer Tansform Dscrete Fourer Transform (DFT) of I[x,y] Fourer bass element 2π e ( ux+vy ) Transform s sum of orthogonal bass functons Inverse DFT Vector (u,v) Magntude gves frequency Drecton gves orentaton. x,y: spatal doman u,v: frequence doman Implemented va the Fast Fourer Transform algorthm (FFT) Here u and v are larger than n the prevous slde. And larger stll...
Usng Fourer Representatons Domnant Orentaton Phase and Magntude e θ = cosθ + sn θ Lmtatons: not useful for local segmentaton Fourer of a real functon s complex dffcult to plot, vsualze nstead, we can thnk phase and magntude Phase s the phase complex Magntude s the magntude complex Curous fact all natural mages have about the same magntude hence, phase seems to matter, but magntude largely doesn t Demonstraton Take two pctures, swap the phase s, compute the nverse - what does the result look lke? Ths s the magntude cheetah pc Ths s the phase cheetah pc
Ths s the magntude zebra pc Ths s the phase zebra pc Reconstructon wth zebra phase, cheetah magntude Reconstructon wth cheetah phase, zebra magntude The Fourer Transform and Convoluton If H and G are mages, and F(.) represents Fourer, then F(H*G) = F(H)F(G) Thus, one way of thnkng about the propertes of a convoluton s by thnkng of how t modfes the frequences mage to whch t s appled. In partcular, f we look at the power spectrum, then we see that convolvng mage H by G attenuates frequences where G has low power, and amplfes those whch have hgh power. Varous Fourer Transform Pars Important facts scale functon down scale up.e. hgh frequency = small detals The FT of a Gaussan s a Gaussan. compare to box functon Ths s referred to as the Convoluton Theorem
Smoothng by Averagng Kernel: An Isotropc Gaussan The pcture shows a smoothng kernel proportonal to exp x2 + y 2 2σ 2 (whch s a reasonable model of a crcularly symmetrc fuzzy blob) Smoothng wth a Gaussan Kernel: Effcent Implementaton Both, the BOX flter and the Gaussan flter are separable: Frst convolve each row wth a 1D flter Then convolve each column wth a 1D flter. Other Types of Nose Impulsve nose randomly pck a pxel and randomly set ot a value saturated verson s called salt and pepper nose Some other useful flterng technques Medan flter Ansotropc dffuson Quantzaton effects Often called nose although t s not statstcal Unantcpated mage structures Also often called nose although t s a real repeatable sgnal.
Medan flters : prncple Medan flters: Example for wndow sze of 3 Method : 1. rank-order neghborhood ntenstes 2. take mddle value Input Sgnal Medan Fltered sgnal 1,1,1,7,1,1,1,1?,1,1,1.1,1,1,? non-lnear flter no new grey levels emerge... Advantage of ths type of flter s that t Elmnates spkes (salt & peper nose). Medan flters : example flters have wdth 5 : Medan flters : analyss medan completely dscards the spke, lnear flter always responds to all aspects medan flter preserves dscontnutes, lnear flter produces roundng-off effects DON T become all too optmstc Medan flter : mages 3 x 3 medan flter : Medan flters : Gauss revsted Comparson wth Gaussan : sharpens edges, destroys edge cusps and protrusons e.g. upper lp smoother, eye better preserved
Example of medan 10 tmes 3 X 3 medan Flters are templates Applyng a flter at some pont can be seen as takng a dotproduct between the mage and some vector Flterng the mage s a set of dot products Insght flters look lke the effects they are ntended to fnd flters fnd effects they look lke patchy effect mportant detals lost (e.g. ear-rng)