6 891
play

6.891 Computer Vision and Applications Prof. Trevor. Darrell - PowerPoint PPT Presentation

6.891 Computer Vision and Applications Prof. Trevor. Darrell Lecture 2: Linear Filters and Convolution (review) Fourier Transform (review) Sampling and Aliasing (review) Readings: F&P Chapter 7.1-7.6 1 Recap: Cameras,


  1. 282 56

  2. 538 57

  3. 1088 58

  4. 2094 59

  5. 4052. 4052 60

  6. 8056. 61

  7. 15366 62

  8. 28743 63

  9. 49190. 64

  10. 65536. 65

  11. Fourier transform magnitude 66

  12. Masking out the fundamental and harmonics from periodic pillars 67

  13. Name as many functions as you can that retain that same functional form in the transform domain 68

  14. 69 Forsyth&Ponce

  15. Discrete-time, continuous frequency Fourier transform Oppenheim, Schafer and Buck, Discrete-time signal processing, Prentice Hall, 1999 70

  16. Discrete-time, continuous frequency Fourier transform pairs Oppenheim, Schafer and Buck, Discrete-time signal processing, Prentice Hall, 1999 71

  17. Bracewell’s pictorial dictionary of Fourier transform pairs 73 Bracewell, The Fourier Transform and its Applications, McGraw Hill 1978

  18. Bracewell’s pictorial dictionary of Fourier transform pairs 74 Bracewell, The Fourier Transform and its Applications, McGraw Hill 1978

  19. Bracewell’s pictorial dictionary of Fourier transform pairs 75 Bracewell, The Fourier Transform and its Applications, McGraw Hill 1978

  20. Bracewell’s pictorial dictionary of Fourier transform pairs 76 Bracewell, The Fourier Transform and its Applications, McGraw Hill 1978

  21. Why is the Fourier domain particularly useful? • It tells us the effect of linear convolutions. 77

  22. Fourier transform of convolution Consider a (circular) convolution of g and h f � g � h 78

  23. Fourier transform of convolution f � g � h Take DFT of both sides � � F m n DFT g h [ , ] � � 79

  24. Fourier transform of convolution f � g � h � � F [ m , n ] � DFT g � h Write the DFT and convolution explicitly � � um vn � � M 1 N 1 � à � � i � � M N � � ��� � F m , n g [ u k , v l ] h [ k , l ] e � � � � � u 0 v 0 k , l 80

  25. Fourier transform of convolution f � g � h � � F [ m , n ] � DFT g � h � � um vn � � M 1 N 1 � à i � � � � M N � � ��� � F m , n g [ u k , v l ] h [ k , l ] e � � � � � u 0 v 0 k , l Move the exponent in � � um vn � � M 1 N 1 � à � � i � � M N � g [ u k , v l ] e h [ k , l ] ��� � � � � � u 0 v 0 k , l 81

  26. Fourier transform of convolution f � g � h � � F [ m , n ] � DFT g � h � � um vn � � M 1 N 1 � à i � � � � M N � � ��� � F m , n g [ u k , v l ] h [ k , l ] e � � � � � u 0 v 0 k , l � � um vn � � M 1 N 1 � à i � � � M N � � g [ u k , v l ] e h [ k , l ] ��� � � � � � u 0 v 0 k , l Change variables in the sum � à � � à � � � k m l n � � � � � � M k 1 N l 1 � à i � � � � M N � g [ , ] e h [ k , l ] � � � � � � � � � � k l k , l � � 82

  27. Fourier transform of convolution f � g � h � � F [ m , n ] � DFT g � h � � um vn � � M 1 N 1 � à i � � � � M N � � ��� � F m , n g [ u k , v l ] h [ k , l ] e � � � � � u 0 v 0 k , l � � um vn � � M 1 N 1 � à i � � � M N � � g [ u k , v l ] e h [ k , l ] ��� � � � � � u 0 v 0 k , l � à � � à � � � k m l n � � � � � � M k 1 N l 1 � à i � � � � M N � g e h k l � � � [ , ] [ , ] � � � � � � � k l k , l � � Perform the DFT (circular boundary conditions) � � km ln � à � � i � � M N � � � G m , n e h [ k , l ] � � k , l 83

  28. Fourier transform of convolution f � g � h � � F [ m , n ] � DFT g � h � � um vn � � M 1 N 1 � à i � � � � M N � � ��� � F m , n g [ u k , v l ] h [ k , l ] e � � � � � u 0 v 0 k , l � � um vn � � M 1 N 1 � à i � � � M N � � g [ u k , v l ] e h [ k , l ] ��� � � � � � u 0 v 0 k , l � à � � à � � � k m l n � � � � � � M k 1 N l 1 � à i � � � � M N � g e h k l � � � [ , ] [ , ] � � � � � � � k l k , l � � � km ln � � à i � � � � M N � � � � G m , n e h [ k , l ] � k , l Perform the other DFT (circular boundary conditions) � � � � G m n H m n � , , 84

  29. Analysis of our simple filters 85

  30. Analysis of our simple filters coefficient 1.0 0 Pixel offset original Filtered (no change) � � km ln � � M 1 N 1 � à i � � � � M N � � �� F [ m , n ] f [ k , l ] e � � k 0 l 0 1.0 constant 1 � 0 86

  31. Analysis of our simple filters coefficient 1.0 0 Pixel offset original shifted � � km ln � � M 1 N 1 � à � i � � � M N � � �� F [ m , n ] f [ k � , l ] e � Constant � � k 0 l 0 magnitude, � m 1.0 � � i linearly shifted M e � phase 0 87

  32. Analysis of our simple filters coefficient 0.3 0 Pixel offset original blurred � km ln � � � M 1 N 1 � à i � � � � M N � � �� F m n f k l e [ , ] [ , ] � � k 0 l 0 Low-pass filter � � � � 1 m � 1.0 � � à � � � 1 2 cos � � M 3 � � � � 0 88

  33. Analysis of our simple filters 2.0 0.33 0 0 sharpened original � km ln � � � M 1 N 1 � à i � � � � M N � � �� F m n f k l e [ , ] [ , ] high-pass filter � � k 0 l 0 2.3 � � � � 1 m � � � � à � � � 2 1 2 cos � � 1.0 M 3 � � � � 0 89

  34. Sampling and aliasing 90

  35. Sampling in 1D takes a continuous function and replaces it with a vector of values, consisting of the function’s values at a set of sample points. We’ll assume that these sample points are on a regular grid, and can place one at each integer for convenience. 91

  36. Sampling in 2D does the same thing, only in 2D. We’ll assume that these sample points are on a regular grid, and can place one at each integer point for convenience. 92

  37. A continuous model for a sampled function • We want to be able to approximate integrals sensibly • Leads to – the delta function – model on right � � � � � � � Sample 2D f ( x , y ) f ( x , y ) � ( x � i , y � j ) i ��� i ��� � � � f ( x , y ) � � � ( x � i , y � j ) i ��� i ��� 93

  38. The Fourier transform of a sampled signal � � �� �� � � F f ( x , y ) � ( x � i , y � j ) � F Sample 2D f ( x , y ) � � � � �� �� �� �� i ��� i ��� � � �� �� � F f ( x , y ) � ( x � i , y � j ) � � ** F �� � � �� �� �� i ��� i ��� � � � F u � i , v � j � � � � i ��� j ��� 94

  39. 95

  40. 96

  41. Aliasing • Can’t shrink an image by taking every second pixel • If we do, characteristic errors appear – In the next few slides – Typically, small phenomena look bigger; fast phenomena can look slower – Common phenomenon • Wagon wheels rolling the wrong way in movies • Checkerboards misrepresented in ray tracing • Striped shirts look funny on colour television 97

  42. Resample the checkerboard by taking one sample at each circle. In the case of the top left board, new representation is reasonable. Top right also yields a reasonable representation. Bottom left is all black (dubious) and bottom right has checks that are too big. 98

  43. Constructing a pyramid by taking every second pixel leads to layers that badly misrepresent the top layer 99

  44. Smoothing as low-pass filtering • The message of the FT is • A filter whose FT is a that high frequencies lead box is bad, because the to trouble with sampling. filter kernel has • Solution: suppress high infinite support frequencies before • Common solution: use sampling a Gaussian – multiply the FT of the signal with something – multiplying FT by that suppresses high Gaussian is equivalent frequencies to convolving image with Gaussian. – or convolve with a low-pass filter 100

  45. Sampling without smoothing. Top row shows the images, sampled at every second pixel to get the next; bottom row shows the magnitude spectrum of these images. 101

Recommend


More recommend