e he i
play

E he i m COMPSCI 527 Computer Vision Correlation, Convolution, - PowerPoint PPT Presentation

Image Convolution Image Boundaries: Valid Convolution If I is m n and H is k ` , then J is ( m k + 1 ) ( n ` + 1 ) E he i m COMPSCI 527 Computer Vision Correlation, Convolution, Filtering 14 / 26 Image Convolution


  1. Image Convolution Image Boundaries: “Valid” Convolution If I is m × n and H is k × ` , then J is ( m − k + 1 ) × ( n − ` + 1 ) E he i m COMPSCI 527 — Computer Vision Correlation, Convolution, Filtering 14 / 26

  2. Image Convolution Image Boundaries: “Full” Convolution If I is m × n and H is k × ` , then J is ( m + k − 1 ) × ( n + ` − 1 ) [Pad with either zeros or copies of boundary pixels] I I COMPSCI 527 — Computer Vision Correlation, Convolution, Filtering 15 / 26

  3. Image Convolution Image Boundaries: “Same” Convolution i If I is m × n and H is k × ` , then J is m × n t i COMPSCI 527 — Computer Vision Correlation, Convolution, Filtering 16 / 26

  4. Filters Filters • What is convolution for? • Smoothing for noise reduction • Image differentiation • Convolutional Neural Networks (CNNs) • . . . • We’ll see the first two next, CNNs later • Smoothing and differentiation are examples of filtering : Local, linear image → image transformations COMPSCI 527 — Computer Vision Correlation, Convolution, Filtering 17 / 26

  5. Filters if 4 jez Hlj ft Smoothing for Noise Reduction 0 otherwise • Assume: Image varies slowly enough to be locally linear • Assume: Noise is zero-mean and white fuse x x x x x x x x x x x x x x x x x x x x x x x x x A th c X rn r 1/5 N MEAS Mlc I c t N c j j t I I KL Is IN Eine j J c q H j n c I c COMPSCI 527 — Computer Vision Correlation, Convolution, Filtering 18 / 26

  6. Filters 2 Dimensions: The Pillbox Kernel Ig µ BOX FILTER Ft a COMPSCI 527 — Computer Vision Correlation, Convolution, Filtering 19 / 26

  7. Filters Issues with the Pillbox f o COMPSCI 527 — Computer Vision Correlation, Convolution, Filtering 20 / 26

  8. Filters aye I The Gaussian Kernel o Hca mn trTIttFe zf DISCRETE version e zfEY ER.EE EuEEiIEEDA gcx 1 RANK TRUNCATED GAUSSIAN COMPSCI 527 — Computer Vision Correlation, Convolution, Filtering 21 / 26

  9. Filters Gaussian versus Pillbox COMPSCI 527 — Computer Vision Correlation, Convolution, Filtering 22 / 26

  10. Filters Truncation u 2 + v 2 G ( u , v ) = e − 1 σ 2 2 • The larger � , the more smoothing • u , v integer, and cannot keep them all • Truncate at 3 � or so tH COMPSCI 527 — Computer Vision Correlation, Convolution, Filtering 23 / 26

  11. Filters Normalization u 2 + v 2 G ( u , v ) = e − 1 2 σ 2 • We want I ∗ G ≈ I get • For I = c (constant), I ∗ G = I D • Normalize by computing � = 1 ∗ G , and then let G ← G / � COMPSCI 527 — Computer Vision Correlation, Convolution, Filtering 24 / 26

  12. Separable Convolution E.IE.El Separability I • A kernel that satisfies H ( u , v ) = h ( u ) ` ( v ) is separable • The Gaussian is separable with h = ` : 7 EI u 2 + v 2 2 G ( u , v ) = e − 1 2 ( u σ ) g ( u ) = e − 1 = g ( u ) g ( v ) with 2 σ 2 • A separable kernel leads to efficient convolution: h k X X J ( r , c ) = H ( u , v ) I ( r − u , c − v ) HOO u = − h v = − k h k X X = h ( u ) ` ( v ) I ( r − u , c − v ) H u = − h v = − k h h X X = h ( u ) � ( r − u , c ) where � ( r , c ) = ` ( v ) I ( r , c − v ) u = − h v = − h COMPSCI 527 — Computer Vision Correlation, Convolution, Filtering 25 / 26

  13. Separable Convolution Computational Complexity ympheduots1pixee F 2mnops General: J ( r , c ) = P h P k v = − k H ( u , v ) I ( r − u , c − v ) u = − h Separable: J ( r , c ) = P h u = − h h ( u ) � ( r − u , c ) where � ( r , c ) = P h v = − h ` ( v ) I ( r , c − v ) 2mops1pixee_r X2n.o psl pixel Let m = 2 h + 1 and n = 2 k + 1 General: About 2 mn operations per pixel Separable: About 2 m + 2 n operations per pixel a Example: When m = n (square kernel), the gain is 2 m 2 / 4 m = m / 2 With m = 20: About 80 operations per pixel instead of 800 COMPSCI 527 — Computer Vision Correlation, Convolution, Filtering 26 / 26

Recommend


More recommend