ΠΑΝΕΠΙΣΤΗΜΙΟ ΙΩΑΝΝΙΝΩΝ ΑΝΟΙΚΤΑ ΑΚΑΔΗΜΑΪΚΑ ΜΑΘΗΜΑΤΑ Ψηφιακή Επεξεργασία Εικόνας Φιλτράρισμα στο πεδίο των συχνοτήτων Διδάσκων : Αναπληρωτής Καθηγητής Νίκου Χριστόφορος Άδειες Χρήσης Το παρόν εκπαιδευτικό υλικό υπόκειται σε άδειες χρήσης Creative Coos. Για εκπαιδευτικό υλικό, όπως εικόνες, που υπόκειται σε άλλου τύπου άδειας χρήσης, η άδεια χρήσης αναφέρεται ρητώς.
Digital Iage Processig Filterig i the Frequecy Doai (Circulat Matrices ad Covolutio) Christophoros ikou cikou@cs.uoi.gr Uiversity of Ioaia - Departet of Coputer Sciece Toeplitz atrices Eleets with costat value alog the ai diagoal ad sub-diagoals. For a x atrix, its eleets are deteried by t ( ) a (-)-legth sequece { } T(, ) = t t0 t t t ( ) t t t 0 T = t t t t t t t 0
3 Toeplitz atrices (cot.) Each row (colu) is geerated by a shift of the previous row (colu). The last eleet disappears. A ew eleet appears. T(, ) = t t0 t t t ( ) t t t 0 T = t t t t t t t 0 4 Circulat atrices Eleets with costat value alog the ai diagoal ad sub-diagoals. For a x atrix, its eleets are deteried by c 0 a -legth sequece { } c0 c c c C(, ) = c( )od c c 0 c C = c c c c c c c 0
5 Circulat atrices (cot.) Special case of a Toeplitz atrix. Each row (colu) is geerated by a circular shift (odulo ) of the previous row (colu). c0 c c c C(, ) = c( )od c c 0 c C = c c c c c c c 0 6 Covolutio by atrix-vector operatios -D liear covolutio betwee two discrete sigals ay be expressed as the product of a Toeplitz atrix costructed by the eleets of oe of the sigals ad a vector costructed by the eleets of the other sigal. -D circular covolutio betwee two discrete sigals ay be expressed as the product of a circulat atrix costructed by the eleets of oe of the sigals ad a vector costructed by the eleets of the other sigal. Extesio to D sigals. 3
7 D liear covolutio usig Toeplitz atrices f[ ] = {,,}, h[ ] = {, }, = 3, = The liear covolutio g[]=f []*h [] will be of legth = + -=3+-=4. We create a Toeplitz atrix H fro the eleets of h [] (zero-padded if eeded) with =4 lies (the legth of the result). =3 colus (the legth of f []). The two sigals ay be iterchaged. 8 D liear covolutio usig Toeplitz atrices (cot.) f[ ] = {,,}, h[ ] = {, }, = 3, = 0 0 0 H = Legth of the result =4 0 0 0 4 3 otice that H is ot Legth of f [] = 3 Zero-padded h[] i the first colu circulat (e.g. a - appears i the secod lie which is ot preset i the first lie. 4
9 D liear covolutio usig Toeplitz atrices (cot.) f[ ] = {,,}, h[ ] = {, }, = 3, = g=hf 0 0 0 = = 0 0 0 0 g [ ] = {,, 0, } 0 D circular covolutio usig circulat atrices f[ ] = {,,}, h[ ] = {, }, = 3, = The circular covolutio g[]=f [] h [] will be of legth =ax{, }=3. We create a circulat atrix H fro the eleets of h [] (zero-padded if eeded) of size x. The two sigals ay be iterchaged. 5
D circular covolutio usig circulat atrices (cot.) f[ ] = {,,}, h[ ] = {, }, = 3, = 0 H = 0 0 3 3 Zero-padded h[] i the first colu D circular covolutio usig circulat atrices (cot.) f[ ] = {,,}, h[ ] = {, }, = 3, = g=hf 0 = 0 = 0 0 g [ ] == {,, 0} 6
3 Block atrices A A A A A A A A A A = M M M A ij are atrices. If the structure of A, with respect to its sub-atrices, is Toeplitz (circulat) the atrix A is called block-toeplitz (block-circulat). If each idividual A ij is also a Toeplitz (circulat) atrix the A is called doubly block-toeplitz (doubly block-circulat). 4 D liear covolutio usig doubly block Toeplitz atrices 4 5 3 f [,] - h [,] M =, =3 M =, = The result will be of size (M +M -) x ( + -) = 3 x 4 7
D liear covolutio usig doubly 5 block Toeplitz atrices (cot.) 4 5 3 f [,] - h [,] At first, h[,] is zero-padded to 3 x 4 (the size of the result). The, for each row of h[,], a Toeplitz atrix with 3 colus (the uber of colus of f [,]) is costructed. 0 0 0 0 0 0-0 0 h[,] 6 D liear covolutio usig doubly block Toeplitz atrices (cot.) 0 0 0 0 0 0-0 0 h[,] For each row of h[,], a Toeplitz atrix with 3 colus (the uber of colus of f [,]) is costructed. 0 0 0 = 0 0 0 0 0 0 = 0 0 0 H H H 3 0 0 0 0 0 0 = 0 0 0 0 0 0 8
D liear covolutio usig doubly 7 block Toeplitz atrices (cot.) 4 5 3 f [,] - h [,] Usig atrices H, H ad H 3 as eleets, a doubly block Toeplitz atrix H is the costructed with colus (the uber of rows of f [,]). H H3 H = H H H H 3 6 D liear covolutio usig doubly 8 block Toeplitz atrices (cot.) 4 5 3 f [,] We ow costruct a vector fro the eleets of f [,]. - h [,] 5 T 3 ( 5 3) f = = T ( 4 ) 4 9
D liear covolutio usig doubly 9 block Toeplitz atrices (cot.) 4 5 3 - f [,] h [,] 5 H H 3 3 g=hf= H H H 3 H 4 0 D liear covolutio usig doubly block Toeplitz atrices (cot.) 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 3 0 0 0 0 5 3 T ( 3 3) 0 03 0 T g=hf= = = 0 0 5 (3 0 5 ) T ( 5 5 ) 0 0 0 0 4 0 0 0 0 0 0 0 0 0 5 0 0 0 0 5 0 0 0 0 0 0
D liear covolutio usig doubly block Toeplitz atrices (cot.) 4 5 3 f [,] * - h [,] = T 5 5 ( 3 3) T 3 0 5 g= (3 0 5 ) 3-3 T ( 5 5 ) g [,] D liear covolutio usig doubly block Toeplitz atrices (cot.) Aother exaple 3 4 f [,] - h [,] M =, = M =, = The result will be of size (M +M -) x ( + -) = x 3
3 D liear covolutio usig doubly block Toeplitz atrices (cot.) 3 4 f [,] At first, h[,] is zero-padded to x 3 (the size of the result). The, for each lie of h[,], a Toeplitz atrix with colus (the uber of colus of f [,]) is costructed. - h [,] 0 0 0-0 h[,] 4 D liear covolutio usig doubly block Toeplitz atrices (cot.) 0 0 0-0 h[,] 0 0 0 = H = 0 0 0 0 0 H For each row of h[,], a Toeplitz atrix with colus (the uber of colus of f [,]) is costructed.
5 D liear covolutio usig doubly block Toeplitz atrices (cot.) 3 4 f [,] Usig atrices H ad H as eleets, a doubly block Toeplitz atrix H is the costructed with colus (the uber of rows of f [,]). - h [,] H H H = H H 6 4 6 D liear covolutio usig doubly block Toeplitz atrices (cot.) 3 4 f [,] - h [,] We ow costruct a vector fro the eleets of f [,]. T ( ) f = = T 3 (3 4) 4 3
7 D liear covolutio usig doubly block Toeplitz atrices (cot.) 3 4 f [,] - h [,] g=hf H H = H H 3 4 8 D liear covolutio usig doubly block Toeplitz atrices (cot.) g=hf 0 0 0 0 0 T 0 0 0 ( ) = = = T 0 0 0 3 3 (3 4) 0 0 4 0 0 0 4 4
9 D liear covolutio usig doubly block Toeplitz atrices (cot.) 3 4 f [,] * - h [,] = 3 4 - g [,] ( ) g= (3 4) T T 30 D circular covolutio usig doubly block circulat atrices The circular covolutio g[,]=f [,] h [,] with 0 M, 0, ay be expressed i atrix-vector for as: g=hf where H is a doubly block circulat atrix geerated by h [,] ad f is a vectorized for of f [,]. 5
3 D circular covolutio usig doubly block circulat atrices (cot.) H0 HM HM H H H0 HM H H= H H H0 H 3 H M HM HM 3 H0 Each H j, for j=,..m, is a circulat atrix with colus (the uber of colus of f [,]) geerated fro the eleets of the j-th row of h [,]. 3 D circular covolutio usig doubly block circulat atrices (cot.) H j h [ j,0] h[ j, ] h[ j,] h[,] j h[,0] j h[,] j = h[, j ] h[, j ] h[,0] j Each H j, for j=,..m, is a x circulat atrix geerated fro the eleets of the j-th row of h [,]. 6
33 D circular covolutio usig doubly block circulat atrices (cot.) 0 0 0 0 0 3-0 0-0 f [,] h [,] 0 0 0 0 = 0 0 H0 = 0 H 0 0 H 0 0 0 = 0 0 0 0 0 0 34 D circular covolutio usig doubly block circulat atrices (cot.) 0 0 0 0 0 3-0 0-0 f [,] h [,] ( ) ( 3 ) ( 0 0) T H0 H H T g=hf = 0 H H H T H H H0 7
35 D circular covolutio usig doubly block circulat atrices (cot.) g=hf 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 = 0 0 0 0 0 3 = 4 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 36 D circular covolutio usig doubly block circulat atrices (cot.) 0 0 3 - f [,] 0 0 0 0 0-0 h [,] = 4-3 4-3 0 - g [,] ( 0 ) ( 3 4 3) ( 4 ) 0 T T g= T 8
37 Diagoalizatio of circulat atrices Theore: The colus of the iverse DFT atrix are eigevectors of ay circulat atrix. The correspodig eigevalues are the DFT values of the sigal geeratig the circulat atrix. Proof: Let π π j j k Ν k Ν w = e w = e be the DFT basis eleets of legth with: 0 k, 0, 38 Diagoalizatio of circulat atrices (cot.) We kow that the DFT F [k] of a D sigal f [] ay be expressed i atrix-vector for: F=Af where f= f[0], f[],..., f[ ] T, F= F[0], F[],..., F[ ] [ ] [ ] 0 0 0 0 ( w ) ( w ) ( w ) ( w ) ( w) ( w) ( w) ( w) 0 0 A = 0 ( w ) ( w ) ( w ) ( w ) T 9
39 Diagoalizatio of circulat atrices (cot.) A The iverse DFT is the expressed by: where T = ( A ) = * - f=a F 0 0 0 0 ( w) ( w) ( w) ( w) ( w) ( w) ( w) ( w) 0 0 ( w ) ( w ) ( w ) ( w ) 0 T * The theore iplies that ay circulat atrix has eigevectors the colus of A -. 40 Diagoalizatio of circulat atrices (cot.) Let H be a x circulat atrix geerated by the D -legth sigal h[], that is: [ ] H(, ) = h( ) h [ ] od Let also α k be the k-th colu of the iverse DFT atrix A -. We will prove that α k, for ay k, is a eigevector of H. The -th eleet of the vector Hα k, deoted by is the result of the circular covolutio of the sigal h[] with α k. [ ] Hα k 0
4 Diagoalizatio of circulat atrices (cot.) [ Hα ] = h [ ] α [ ] k k = 0 = 0 = h [ ] w k = l= ( ) l= hl [] w k( l) = w h l w ( ) k kl [] l= k kl kl w h[] l w h[] l w l= ( ) l= 0 = + We will break it ito two parts 4 Diagoalizatio of circulat atrices (cot.) k kl kl kl = w h [] l w + h [] l w h [] l w l= ( ) l= 0 l= + Periodic with respect to. = w h l w + h l w h l w k kl kl kl [] [] [] l= + ( ) l= 0 l= + = w h l w + h l w h l w k kl kl kl [] [] [] l= + l= 0 l= +
43 Diagoalizatio of circulat atrices (cot.) = l = 0 k kl [ Hα k] w h[] l w = Hk[ α ] DFT of h[] at k. [ ] k This holds for ay value of. Therefore: Hα k = H[ k] α k which eas that α k, for ay k, is a eigevector of H with correspodig eigevalue the k-th eleet of H[k], the DFT of the sigal geeratig H. 44 Diagoalizatio of circulat atrices (cot.) The above expressio ay be writte i ters of the iverse DFT atrix: HA = A Λ { H H H } Λ=diag [0], [],..., [ ] or equivaletly: Λ = ΑHA Based o this diagoalizatio, we ca prove the property betwee circular covolutio ad DFT.
45 Diagoalizatio of circulat atrices (cot.) g=hf - g=ha Af - Ag = AHA Af G=ΛF G[0] H[0] 0 0 F[0] G[0] 0 H[] 0 F[0] = G [ ] 0 0 H [ ] F [ ] DFT of g[] DFT of h [] DFT of f [] 46 Diagoalizatio of doubly block circulat atrices These properties ay be geeralized i D. We eed to defie the Kroecker product: A, B M K L ab ab a B a a a B B B A B= a B a B a B M M M MK L 3
47 Diagoalizatio of doubly block circulat atrices (cot.) The D sigal f [,], 0 M, 0, ay be vectorized i lexicographic orderig (stackig oe colu after the other) to a vector: M f The DFT of f [,], ay be obtaied i atrix-vector for: F = ( A ) A f 48 Diagoalizatio of doubly block circulat atrices (cot.) Theore: The colus of the iverse D DFT atrix A A ( ) are eigevectors of ay doubly block circulat atrix. The correspodig eigevalues are the D DFT values of the D sigal geeratig the doubly block circulat atrix: ( ) ( ) Λ = A A H A A Diagoal, cotaiig the D DFT of h[,] geeratig H Doubly block circulat 4
Τέλος Ενότητας Χρηματοδότηση Το παρόν εκπαιδευτικό υλικό έχει αναπτυχθεί στα πλαίσια του εκπαιδευτικού έργου του διδάσκοντα. Το έργο «Ανοικτά Ακαδημαϊκά Μαθήματα στο Πανεπιστήμιο Ιωαννίνων» έχει χρηματοδοτήσει μόνο τη αναδιαμόρφωση του εκπαιδευτικού υλικού. Το έργο υλοποιείται στο πλαίσιο του Επιχειρησιακού Προγράμματος «Εκπαίδευση και Δια Βίου Μάθηση» και συγχρηματοδοτείται από την Ευρωπαϊκή Ένωση (Ευρωπαϊκό Κοινωνικό Ταμείο) και από εθνικούς πόρους.
Σημειώματα Σημείωμα Ιστορικού Εκδόσεων Έργου Το παρόν έργο αποτελεί την έκδοση.0. Έχουν προηγηθεί οι κάτωθι εκδόσεις: Έκδοση.0 διαθέσιμη εδώ. http://ecourse.uoi.gr/course/view.php?id=6.
Σημείωμα Αναφοράς Copyright Πανεπιστήμιο Ιωαννίνων, Διδάσκων : Αναπληρωτής Καθηγητής Νίκου Χριστόφορος. «Ψηφιακή Επεξεργασία Εικόνας. Φιλτράρισμα στο πεδίο των συχνοτήτων». Έκδοση:.0. Ιωάννινα 04. Διαθέσιμο από τη δικτυακή διεύθυνση: http://ecourse.uoi.gr/course/view.php?id=6. Σημείωμα Αδειοδότησης Το παρόν υλικό διατίθεται με τους όρους της άδειας χρήσης Creative Coos Αναφορά Δημιουργού - Παρόμοια Διανομή, Διεθνής Έκδοση 4.0 [] ή μεταγενέστερη. [] https://creativecoos.org/liceses/by-sa/4.0/