edge detection
play

- ? Edge detection Goal : - PowerPoint PPT Presentation

- ? Edge detection Goal : map image from 2d array of pixels to a set of curves or line segments or contours. Why? Figure from J. Shotton et al., PAMI 2007 Main idea :


  1. רותיא - ףס – יאהנומתב םיוקה םירבוע הפ ?

  2. Edge detection • Goal : map image from 2d array of pixels to a set of curves or line segments or contours. • Why? Figure from J. Shotton et al., PAMI 2007 • Main idea : look for strong gradients, post-process

  3. What can cause an edge? Depth discontinuity: Reflectance change: object boundary appearance information, texture Cast shadows Change in surface orientation: shape

  4. Recall : Images as functions • Edges look like steep cliffs Source: S. Seitz

  5. Derivatives and edges An edge is a place of rapid change in the image intensity function. intensity function image (along horizontal scanline) first derivative edges correspond to extrema of derivative Source: L. Lazebnik

  6. Differentiation and convolution For 2D function, f(x,y), the partial derivative is:     f ( x , y ) f ( x , y ) f ( x , y )  lim     x 0 For discrete data, we can approximate using finite differences:    f ( x , y ) f ( x 1 , y ) f ( x , y )   x 1 To implement above as convolution, what would be the associated filter?

  7. Side note: Filters and Convolutions • First, consider a signal in 1D… • Let’s replace each pixel with an average of all the values in its neighborhood • Moving average in 1D: Source: S. Marschner

  8. Weighted Moving Average • Can add weights to our moving average • Weights [1, 1, 1, 1, 1] / 5 Source: S. Marschner

  9. Weighted Moving Average • Non-uniform weights [1, 4, 6, 4, 1] / 16 Source: S. Marschner

  10. Moving Average In 2D 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 90 90 90 90 90 90 90 90 90 90 0 0 0 0 0 0 0 0 0 0 90 90 90 90 90 90 90 90 90 90 0 0 0 0 0 0 0 0 0 0 90 90 90 90 90 90 90 90 90 90 0 0 0 0 0 0 0 0 0 0 90 90 0 0 90 90 90 90 90 90 0 0 0 0 0 0 0 0 0 0 90 90 90 90 90 90 90 90 90 90 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 0 0 0 90 90 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 0 0 0 0 0 0 0 0 0 Source: S. Seitz

  11. Moving Average In 2D 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 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 0 90 90 90 90 90 90 90 90 90 90 0 0 0 0 0 0 0 0 0 0 90 90 90 90 90 90 90 90 90 90 0 0 0 0 0 0 0 0 0 0 90 90 90 90 90 90 90 90 90 90 0 0 0 0 0 0 0 0 0 0 90 90 0 0 90 90 90 90 90 90 0 0 0 0 0 0 0 0 0 0 90 90 90 90 90 90 90 90 90 90 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 0 0 0 90 90 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 0 0 0 0 0 0 0 0 0 Source: S. Seitz

  12. Moving Average In 2D 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 20 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 0 90 90 90 90 90 90 90 90 90 90 0 0 0 0 0 0 0 0 0 0 90 90 90 90 90 90 90 90 90 90 0 0 0 0 0 0 0 0 0 0 90 90 90 90 90 90 90 90 90 90 0 0 0 0 0 0 0 0 0 0 90 90 0 0 90 90 90 90 90 90 0 0 0 0 0 0 0 0 0 0 90 90 90 90 90 90 90 90 90 90 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 0 0 0 90 90 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 0 0 0 0 0 0 0 0 0 Source: S. Seitz

  13. Moving Average In 2D 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 20 30 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 0 90 90 90 90 90 90 90 90 90 90 0 0 0 0 0 0 0 0 0 0 90 90 90 90 90 90 90 90 90 90 0 0 0 0 0 0 0 0 0 0 90 90 90 90 90 90 90 90 90 90 0 0 0 0 0 0 0 0 0 0 90 90 0 0 90 90 90 90 90 90 0 0 0 0 0 0 0 0 0 0 90 90 90 90 90 90 90 90 90 90 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 0 0 0 90 90 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 0 0 0 0 0 0 0 0 0 Source: S. Seitz

  14. Moving Average In 2D 0 0 0 0 0 0 0 0 0 0 0 10 20 30 30 0 0 0 0 0 0 0 0 0 0 0 0 0 90 90 90 90 90 0 0 0 0 0 90 90 90 90 90 0 0 0 0 0 90 90 90 90 90 0 0 0 0 0 90 0 90 90 90 0 0 0 0 0 90 90 90 90 90 0 0 0 0 0 0 0 0 0 0 0 0 0 0 90 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Source: S. Seitz

  15. Moving Average In 2D 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 20 30 30 30 20 10 0 0 0 90 90 90 90 90 0 0 0 20 40 60 60 60 40 20 0 0 0 90 90 90 90 90 0 0 0 30 60 90 90 90 60 30 0 0 0 90 90 90 90 90 0 0 0 30 50 80 80 90 60 30 0 0 0 90 0 90 90 90 0 0 0 30 50 80 80 90 60 30 0 0 0 90 90 90 90 90 0 0 0 20 30 50 50 60 40 20 0 0 0 0 0 0 0 0 0 0 10 20 30 30 30 30 20 10 0 0 90 0 0 0 0 0 0 0 10 10 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Source: S. Seitz

  16. Correlation filtering Say the averaging window size is 2k+1 x 2k+1: Attribute uniform weight Loop over all pixels in neighborhood around to each pixel image pixel F[i,j] Now generalize to allow different weights depending on neighboring pixel’s relative position: Non-uniform weights

  17. Correlation filtering This is called cross-correlation, denoted Filtering an image: replace each pixel with a linear combination of its neighbors. The filter “ kernel ” or “ mask ” H [ u,v ] is the prescription for the weights in the linear combination.

  18. Averaging filter • What values belong in the kernel H for the moving average example? 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 10 20 30 30 0 0 0 90 90 90 90 90 0 0 ? 1 1 1 0 0 0 90 90 90 90 90 0 0 0 0 0 90 90 90 90 90 0 0 1 1 1 0 0 0 90 0 90 90 90 0 0 0 0 0 90 90 90 90 90 0 0 0 0 0 0 0 0 0 0 0 0 “box filter” 0 0 90 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

  19. Smoothing by averaging depicts box filter: white = high value, black = low value filtered original

  20. Gaussian filter • What if we want nearest neighboring pixels to have the most influence on the output? This kernel is an 0 0 0 0 0 0 0 0 0 0 approximation of a 0 0 0 0 0 0 0 0 0 0 Gaussian function: 0 0 0 90 90 90 90 90 0 0 0 0 0 90 90 90 90 90 0 0 1 2 1 0 0 0 90 90 90 90 90 0 0 2 4 2 0 0 0 90 0 90 90 90 0 0 1 2 1 0 0 0 90 90 90 90 90 0 0 0 0 0 0 0 0 0 0 0 0 0 0 90 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Source: S. Seitz

  21. Smoothing with a Gaussian

  22. Gaussian filters • What parameters matter here? • Size of kernel or mask – Note, Gaussian function has infinite support, but discrete filters use finite kernels σ = 5 with 10 σ = 5 with 30 x 10 kernel x 30 kernel

  23. Gaussian filters • What parameters matter here? • Variance of Gaussian: determines extent of smoothing σ = 2 with 30 σ = 5 with 30 x 30 kernel x 30 kernel

  24. Matlab >> hsize = 10; >> sigma = 5; >> h = fspecial(‘gaussian’ hsize, sigma); >> mesh(h); >> imagesc(h); >> outim = imfilter(im, h); >> imshow(outim); outim

  25. Smoothing with a Gaussian Parameter σ is the “scale” / “width” / “spread” of the Gaussian kernel, and controls the amount of smoothing. … for sigma=1:3:10 h = fspecial('gaussian‘, fsize, sigma); out = imfilter(im, h); imshow(out); pause; end

  26. Predict the filtered outputs 0 0 0 0 0 0 = ? = ? 0 1 0 * * 0 0 1 0 0 0 0 0 0 - 0 0 0 1 1 1 = ? 0 2 0 1 1 1 * 0 0 0 1 1 1

  27. Practice with linear filters 0 0 0 ? 0 1 0 0 0 0 Original Source: D. Lowe

  28. Practice with linear filters 0 0 0 0 1 0 0 0 0 Original Filtered (no change) Source: D. Lowe

  29. Practice with linear filters 0 0 0 ? 0 0 1 0 0 0 Original Source: D. Lowe

  30. Practice with linear filters 0 0 0 0 0 1 0 0 0 Original Shifted left by 1 pixel with correlation Source: D. Lowe

  31. Practice with linear filters ? 1 1 1 1 1 1 1 1 1 Original Source: D. Lowe

  32. Practice with linear filters 1 1 1 1 1 1 1 1 1 Original Blur (with a box filter) Source: D. Lowe

  33. Practice with linear filters - 0 0 0 1 1 1 ? 0 2 0 1 1 1 0 0 0 1 1 1 Original Source: D. Lowe

  34. Practice with linear filters - 0 0 0 1 1 1 0 2 0 1 1 1 0 0 0 1 1 1 Original Sharpening filter - Accentuates differences with local average Source: D. Lowe

  35. Filtering examples: sharpening

  36. Convolution • Convolution: – Flip the filter in both dimensions (bottom to top, right to left) – Then apply cross-correlation F H Notation for convolution operator

  37. Convolution vs. correlation Convolution Cross-correlation Back to our question: To implement the derivates, what would be the    associated filter? f ( x , y ) f ( x 1 , y ) f ( x , y )   x 1

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