image gradients and gradient filtering
play

Image Gradients and Gradient Filtering 16-385 Computer Vision What - PowerPoint PPT Presentation

Image Gradients and Gradient Filtering 16-385 Computer Vision What is an image edge? Recall that an image is a 2D function f ( x ) edge edge How would you detect an edge? What kinds of filter would you use? The Sobel filter 1 0 -1


  1. Image Gradients and Gradient Filtering 16-385 Computer Vision

  2. What is an image edge?

  3. Recall that an image is a 2D function f ( x )

  4. edge edge How would you detect an edge? What kinds of filter would you use?

  5. The ‘Sobel’ filter 1 0 -1 2 0 -2 1 0 -1 a derivative filter (with some smoothing) Filter returns large response on vertical or horizontal lines?

  6. The ‘Sobel’ filter 1 2 1 0 0 0 -1 -2 -1 a derivative filter (with some smoothing) Filter returns large response on vertical or horizontal lines? Is the output always positive?

  7. The ‘Sobel’ filter 1 2 1 0 0 0 -1 -2 -1 a derivative filter (with some smoothing) Responds to horizontal lines Output can be positive or negative

  8. Output of which Sobel filter? Output of which Sobel filter? How do you visualize negative derivatives/gradients?

  9. Derivative in X direction Derivative in Y direction Visualize with scaled absolute value

  10. The ‘Sobel’ filter 1 0 -1 2 0 -2 1 0 -1 Where does this filter come?

  11. Do you remember this from high school? f ( x + h ) − f ( x ) f 0 ( x ) = lim h h ! 0

  12. Do you remember this from high school? The derivative of a function f at a point x is defined by the limit f ( x + h ) − f ( x ) f 0 ( x ) = lim h h ! 0 Approximation of the derivative when h is small This definition is based on the ‘forward difference’ but ...

  13. it turns out that using the ‘central difference’ is more accurate f ( x + 0 . 5 h ) − f ( x − 0 . 5 h ) f 0 ( x ) = lim h h ! 0 How do we compute the derivative of a discrete signal? 10 20 10 200 210 250 250

  14. it turns out that using the ‘central difference’ is more accurate f ( x + 0 . 5 h ) − f ( x − 0 . 5 h ) f 0 ( x ) = lim h h ! 0 How do we compute the derivative of a discrete signal? 10 20 10 200 210 250 250 -1 0 1 f 0 ( x ) = f ( x + 1) − f ( x − 1) = 210 − 10 = 100 1D derivative filter 2 2

  15. Decomposing the Sobel filter 1 0 -1 1 1 0 -1 = 2 2 0 -2 1 1 0 -1 What this? Sobel

  16. Decomposing the Sobel filter 1 0 -1 1 1 0 -1 = 2 2 0 -2 1 1 0 -1 Sobel weighted average and scaling

  17. Decomposing the Sobel filter What this? 1 0 -1 1 1 0 -1 = 2 2 0 -2 1 1 0 -1 Sobel weighted average and scaling

  18. Decomposing the Sobel filter What this? 1 0 -1 1 1 0 -1 = 2 2 0 -2 x-derivative 1 1 0 -1 Sobel weighted average and scaling

  19. The Sobel filter only returns the x and y edge responses. How can you compute the image gradient ?

  20. How do you compute the image gradient? 1 2 1 1 0 -1 S y = S x = Choose a derivative filter 0 0 0 2 0 -2 -1 -2 -1 1 0 -1 What is this filter called? ∂ f ∂ f ∂ y = S y ⊗ f ∂ x = S x ⊗ f Run filter over image What are the dimensions?  ∂ f � ∂ x , ∂ f Image gradient r f = ∂ y What are the dimensions?

  21. Matching that Gradient !  � 0 , ∂ f (a) (1) r f = ∂ y  ∂ f � (b) (2) r f = ∂ x, 0  ∂ f � ∂ x, ∂ f r f = (c) (3) ∂ y

  22. Image Gradient Gradient in x only Gradient in y only Gradient in both x and y  ∂ f �  ∂ f �  � ∂ x, ∂ f 0 , ∂ f r f = ∂ x, 0 r f = r f = ∂ y ∂ y Gradient magnitude Gradient direction ? ?

  23. Image Gradient Gradient in x only Gradient in y only Gradient in both x and y  ∂ f �  ∂ f �  � ∂ x, ∂ f 0 , ∂ f r f = ∂ x, 0 r f = r f = ∂ y ∂ y Gradient magnitude Gradient direction s✓ ∂ f ◆ 2 ◆ 2 ✓ ∂ f ◆ ∂ y / ∂ f ✓ ∂ f θ = tan − 1 || � f || = + ∂ x ∂ x ∂ y How does the gradient direction relate to the edge? What does a large magnitude look like in the image?

  24. Common ‘derivative’ filters 1 0 -1 1 2 1 3 0 -3 3 10 3 Sobel Scharr 2 0 -2 0 0 0 10 0 -10 0 0 0 1 0 -1 -1 -2 -1 3 0 -3 -3 -10 -3 1 0 -1 1 1 1 Prewitt 0 1 1 0 Roberts 1 0 -1 0 0 0 -1 0 0 -1 1 0 -1 -1 -1 -1

  25. How do you find the edge from this signal? Intensity plot

  26. How do you find the edge from this signal? Intensity plot Use a derivative filter!

  27. How do you find the edge from this signal? Intensity plot Use a derivative filter! Derivative plot What happened?

  28. How do you find the edge from this signal? Intensity plot Use a derivative filter! Derivative plot Derivative filters are sensitive to noise

  29. Input Gaussian Smoothed input Derivative Output Don’t forget to smooth before running derivative filters!

  30. Laplace filter A.K.A. Laplacian, Laplacian of Gaussian (LoG), Marr filter, Mexican Hat Function

  31. Laplace filter A.K.A. Laplacian, Laplacian of Gaussian (LoG), Marr filter, Mexican Hat Function

  32. Laplace filter A.K.A. Laplacian, Laplacian of Gaussian (LoG), Marr filter, Mexican Hat Function

  33. first-order f ( x + 0 . 5 h ) − f ( x − 0 . 5 h ) f 0 ( x ) = lim finite difference h h ! 0 derivative filter 1 0 -1 second-order finite difference Laplace filter ? ? ?

  34. first-order f ( x + 0 . 5 h ) − f ( x − 0 . 5 h ) f 0 ( x ) = lim finite difference h h ! 0 derivative filter 1 0 -1 second-order finite difference Laplace filter 1 -2 1

  35. Input Laplacian ? Output

  36. Input Laplacian Output Zero crossings are more accurate at localizing edges Second derivative is noisy

  37. 2D Laplace filter ? ? ? ? ? ? 1 -2 1 ? ? ? 1D Laplace filter 2D Laplace filter

  38. 2D Laplace filter ? ? ? ? ? ? 1 -2 1 ? ? ? 1D Laplace filter 2D Laplace filter hint

  39. 2D Laplace filter 0 1 0 1 -4 1 1 -2 1 0 1 0 1D Laplace filter 2D Laplace filter If the Sobel filter approximates the first derivative, the Laplace filter approximates ....?

  40. Laplace filter Laplace filter with smoothing without smoothing

  41. Laplace filter Sobel filter What’s different between the two results?

  42. zero-crossing peak Laplace Sobel Zero crossings are more accurate at localizing edges (but not very convenient)

  43. Gaussian Derivative of Gaussian 2D Gaussian Filters Laplacian of Gaussian

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend