im image form rmation basic ic im image processing
play

Im Image Form rmation, , Basic ic Im Image Processing Wei-Chih - PowerPoint PPT Presentation

Lecture 2: Im Image Form rmation, , Basic ic Im Image Processing Wei-Chih Tu ( ) National Taiwan University Fall 2018 Vision How vision is formed Physical world Sensing device Interpreting device Interpretations cat,


  1. Image Filtering • Gaussian filter • The kernel weight is a Gaussian function • Center pixels contribute more weights 𝜏 = 1 𝜏 = 2 𝜏 = 3 1D illustration of Gaussian functions 64

  2. Image Filtering • Gaussian filter • 2D case: • Complexity: 𝑃(𝑠 2 ) 65

  3. Image Filtering • Gaussian filter in 𝑃(𝑠) • Gaussian kernel is separable (The same technique can be applied to other separable kernels) 66

  4. Image Filtering • Gaussian filter in 𝑃(𝑠) Direct 2D implementation: 𝑃(𝑠 2 ) Input Image 2D Sliding Window Separable implementation: 𝑃(𝑠) Input Image 1D Pass 1D Pass 67

  5. Image Filtering • Gaussian filter in 𝑃(1) • FFT • Iterative box filtering • Recursive filter 68

  6. Image Filtering • 𝑃(1) Gaussian filter by FFT approach • Complexity: • Take FFT: 𝑃(𝑥ℎ ln(𝑥) ln(ℎ)) • Multiply by FFT of Gaussian: 𝑃(𝑥ℎ) • Take inverse FFT: 𝑃(𝑥ℎ ln(𝑥) ln(ℎ)) • Cost independent of filter size 69

  7. Image Filtering • 𝑃(1) Gaussian filter by iterative box filtering • Based on the central limit theorem • Pros: easy to implement! • Cons: limited choice of box size (3, 5, 7, …) results in limited choice of Gaussian function 𝜏 2 Box 3 Box 4 Box Box * Box 70

  8. Image Filtering • 𝑃(1) Gaussian filter by recursive implementation • All filters we discussed above are FIR filters • We can use IIR (infinite impulse response) filters to approximate Gaussians… 1 st order IIR filter: 2 nd order IIR filter: 71

  9. IIR Filters 0 0 64 0 0 0 0 0 0 0 + + ÷ 2 0 0 72

  10. IIR Filters • The example above is an exponential decay • Equivalent to convolution by: 73

  11. IIR Filters • Makes large, smooth filters with very little computation!  • One forward pass (causal), one backward pass (anti-causal), equivalent to convolution by: 74

  12. Image Filtering • 𝑃(1) Gaussian filter by recursive implementation • 2 nd order IIR filter approximation “Recursively implementing the Gaussian and its derivatives”, ICIP 1992 75

  13. Image Filtering • Median filter 11 19 22 • 3x3 example: 12 25 27 18 26 23 A local patch Sort 11, 12, 18, 19, 22, 23, 25, 26, 27 Replace center pixel value by median 11 19 22 12 22 27 18 26 23 76

  14. Image Filtering • Median filter • Useful to deal with salt and pepper noise Original Add salt & pepper Gaussian filter Median filter Source: https://www.pinterest.com/pin/304485624782669932 77

  15. Edge Detection Convert a 2D image into a set of curves • Extract salient features of the scene • More compact than pixels Slide by Steve Seitz 78

  16. Edge Detection • We know edges are special from mammalian vision studies Hubel & Wiesel (1962) 79

  17. Edge Detection • Origin of edges surface normal discontinuity depth discontinuity surface color discontinuity illumination discontinuity Slide by Steve Seitz 80

  18. Edge Detection • Characterizing edges Intensity profile Gradient magnitude 81

  19. Edge Detection • How to compute gradient for digital images? • Take discrete derivative • Gradient direction and magnitude 82

  20. Discrete Derivative • Backward difference Equivalent to convolve with: [1, -1] • Forward difference [-1, 1] • Central difference [1, 0, -1] 83

  21. Edge Detection • Sobel filter 𝐻 After thresholding Input image Wiki: Sobel operator 84

  22. Edge Detection • Effect of noise • Difference filters respond strongly to noise • Solution: smooth first Slide by Steve Seitz 85

  23. Derivative Theorem of Convolution • Differentiation is convolution, which is associative: 86

  24. Edge Detection • Tradeoff between smoothing and localization • Smoothing filter removes noise but blurs edges  Gaussian filter, 𝜏 = 5 No filtering Gaussian filter, 𝜏 = 2 87

  25. Edge Detection • Criteria for a good edge detector • Good detection • Find all real edges, ignoring noise • Good localization • Locate edges as close as possible to the true edges • Edge width is only one pixel Bad localization Missing edge Not edge 88

  26. Edge Detection • Canny edge detector • The most widely used edge detector • The best you can find in existing tools like MATLAB, OpenCV … • Algorithm: • Apply Gaussian filter to reduce noise • Find the intensity gradients of the image • Apply non-maximum suppression to get rid of false edges • Apply double threshold to determine potential edges • Track edge by hysteresis : suppressing weak edges that are not connected to strong edges 89

  27. Non-Maximum Suppression Gradient magnitude Bilinear interpolation After NMS 90

  28. Double Thresholding Strong edges Weak edges 91

  29. Hysteresis • Find connected components from strong edge pixels to finalize edge detection 92

  30. More Image Filtering • Bilateral filter • Smoothing images while preserving edges Edge remains sharp Input Output Small fluctuations are removed 93

  31. Bilateral Filtering • Bilateral filter Range kernel Spatial kernel • Spatial kernel : weights are larger for pixels near the window center • Range kernel : weights are larger if the neighbor pixel has similar intensity (color) to the center pixel 94

  32. Bilateral Filtering 95

  33. Joint Bilateral Filtering • The range kernel takes another guidance image as reference Flash No flash Joint bilateral filtering 96 http://hhoppe.com/proj/flash/

  34. Bilateral Filtering • Fast bilateral filtering also exists • “A fast approximation of the bilateral filter using a signal processing approach”, ECCV 2006 • “Constant time O(1) bilateral filtering”, CVPR 2008 • “Real - time O(1) bilateral filtering”, CVPR 2009 • “Fast high - dimensional filtering using the permutohedral lattice”, EG 2010 • and many more… • We also contribute some works in this field • “Constant time bilateral filtering for color images”, ICIP 2016 • “VLSI architecture design of layer-based bilateral and median filtering for 4k2k videos at 30fps”, ISCAS 2017 97

  35. Guided Image Filtering [He et al. ECCV 2010] • Local linear assumption • Per pixel 𝑃(1) http://kaiminghe.com/eccv10/index.html 98

  36. Guided Image Filtering [He et al. ECCV 2010] • Local linear assumption Linear regression 99

  37. Edge-Preserving Filtering • Both the bilateral filter and the guided image filter are called edge-preserving filters (EPF) • They can smooth images while preserving edges • Other widely used EPFs with source code • Weighted least square filter, SIGGRAPH 2008 • Domain transform filter, SIGGRAPH 2011 • 𝑀 0 filter, SIGGRAPH Asia 2011 • Fast global smoothing filter, TIP 2014 100

Recommend


More recommend