1 / 68

Introduction to Computer Vision

Introduction to Computer Vision. Lecture 8 Dr. Roger S. Gaborski. Updates. Project Page Image Resizing by Image Carving http://www.youtube.com/watch?v=6NcIJXTlugc. GOAL: Locate the Fern. RECALL: MATLAB’s Edge Function. EDGE Find edges in intensity image.

Download Presentation

Introduction to Computer Vision

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to Computer Vision Lecture 8 Dr. Roger S. Gaborski Roger S. Gaborski

  2. Updates • Project Page • Image Resizing by Image Carving http://www.youtube.com/watch?v=6NcIJXTlugc Roger S. Gaborski

  3. GOAL: Locate the Fern Roger S. Gaborski

  4. RECALL: MATLAB’s Edge Function EDGE Find edges in intensity image. EDGE takes an intensity or a binary image I as its input, and returns a binary image BW of the same size as I, with 1's where the function finds edges in I and 0's elsewhere. Sobel Prewitt Roberts Laplacian of Gaussian (LoG) Zero Crossing Canny Roger S. Gaborski

  5. edge • edge function • [g,t] = edge( image, ‘prewitt’, T, dir ); Roger S. Gaborski

  6. Prewitt [g,t] = edge( image, ‘prewitt’ ); Automatic threshold = .1088, both horizontal and vertical edges Roger S. Gaborski

  7. Prewitt – Threshold = .05 Threshold = .05 Roger S. Gaborski

  8. Prewitt – Threshold =.15 Threshold = .15 Roger S. Gaborski

  9. Smoothing • Remove noise • Remove small details • Smoothing Kernel: a= 1/9 a a a a a a a a a • Increase center value to put more weight on the • center pixel Roger S. Gaborski

  10. Consider a 2 D Gaussian for Smoothing Roger S. Gaborski

  11. 2D Gaussian Distribution • The two-dimensional Gaussian distribution is defined by: • From this distribution, can generate smoothing masks whose width depends upon the standard deviation, s: Roger S. Gaborski

  12. i2 + j2 i2 + j2 W(i,j) = exp (- ) W(i,j) = k * exp (- ) 2 s2 2 s2 k Creating Gaussian Kernels • The mask weights are evaluated from the Gaussian distribution: • This can be rewritten as: Roger S. Gaborski

  13. i2 + j2 W(i,j) = exp (- ) 2 s2 k Creating Gaussian Kernels • This can now be evaluated over a window of size nxn to obtain a kernel in which the (0,0) value is 1. • k is a scaling constant Roger S. Gaborski

  14. j -3 -2 -1 0 1 2 3 -3 -2 -1 i 0 1 2 3 Example 2 • Choose s = 2. and n = 7, then: Roger S. Gaborski

  15. 7x7 Gaussian Filter Roger S. Gaborski

  16. Key Point – if you were using a Gaussian function for smoothing (noise reduction) the value of will sigma determine how many points will be used in the smoothing operation Roger S. Gaborski

  17. Sigma Determines Spread of Filter Variance, s2 = .25 Variance, s2 = 4.0 Roger S. Gaborski

  18. imGray im = imread('IMGP1579.JPG'); imGray = rgb2gray(im); imGray = mat2gray(imGray, [0 255]); Roger S. Gaborski

  19. 31x31 Gaussian, Sigma = 4 Roger S. Gaborski

  20. 31x31 Gaussian, Sigma = 4Profile Roger S. Gaborski

  21. Fern 31x31 Gaussian, Sigma=4 Roger S. Gaborski

  22. 63x63 Gaussian, Sigma =10 Roger S. Gaborski

  23. 63x63 Gaussian, Sigma = 10Profile Roger S. Gaborski

  24. Fern 63x63 Gaussian, Sigma=10 Roger S. Gaborski

  25. RECALL: Laplacian • Independent of edge orientation (finds edges in all orientations) • Combine 2 f(x,y)/ x2 and 2 f(x,y)/ y2 =4 f(x,y) - f(x-1,y) – f(x+1,y) – f(x,y-1) – f(x,y+1) • Second derivatives are sensitive to noise Roger S. Gaborski

  26. Filter image with Gaussian to reduce noise Laplacian of the Gaussian Ñ2G is a circularly symmetric operator. LoG Roger S. Gaborski

  27. LoG Also called the Mexican hat operator. Roger S. Gaborski

  28. s2 Controls of the Size of the Filter s2 = 0.5 s2 = 2.0 Roger S. Gaborski

  29. Human Visual System Receptive Field Approximation 17 x 17 5x5 Roger S. Gaborski

  30. >> %H = FSPECIAL('log',HSIZE,SIGMA) >> LoG31=fspecial('log',31,4); >> imLoG31=conv2(imGray,LoG31); >> figure, imshow(imLoG31,[ ]),title('imLog31') Roger S. Gaborski

  31. LoG (15x15, Sigma=1) Roger S. Gaborski

  32. LoG (7x7, Sigma=1) Roger S. Gaborski

  33. LoG (31x31, Sigma=4) Roger S. Gaborski

  34. LoG (63x63, Sigma=10) Roger S. Gaborski

  35. Edge Detection: abs(imLog7)>.1 Roger S. Gaborski

  36. Building1 gray level image Roger S. Gaborski

  37. LoG (7x7, sigma = 2) Roger S. Gaborski

  38. LoG (15x15, sigma = 4) Roger S. Gaborski

  39. Summarizing: Laplacian of Gaussian (LoG) • Gaussian function: h(r) = -exp(-r2/22) • Applying the Gaussian has a smoothing or blurring effect • Blurring depends on sigma • THEN Laplacian of Gaussian (Second Derivative) Roger S. Gaborski

  40. Laplacian of Gaussian (LoG) • 2 h(r) = -[(r2 - 2)/ 4] exp-(r2/2 2) • Second derivative is linear operation Therefore: convolving an image with 2 h(r) is the same as first convolving first with smoothing filter (Gaussian) then computing Laplacian of result. • Edge are location of zero crossings Roger S. Gaborski

  41. Implementation: Laplacian of Gaussian (LoG) • Syntax: [g] = edge(f, ‘log’, T, sigma); Ignores edges that are not stronger than T If T not provided, MATLAB automatically chooses T Roger S. Gaborski

  42. Building What’s important?? Roger S. Gaborski

  43. [g,t]=edge(im,'log',[ ],1); Roger S. Gaborski

  44. [g,t]=edge(im,'log',[ ],2); Roger S. Gaborski

  45. [g,t]=edge(im,'log',[ ],3) Roger S. Gaborski

  46. Exploring the LoG Parameter Space [g, t] = edge(f, 'log',[],2); Default threshold, t= .918, sigma = 2 WHAT IF WE CHANGE SIGMA?? Roger S. Gaborski

  47. t= .918 Sigma = 1 Sigma = 3 (more smoothing) Roger S. Gaborski

  48. t = .500 Sigma = 1 Sigma = 3 Roger S. Gaborski

  49. t = 1.500 Sigma = 1.0 Sigma = 3.0 Roger S. Gaborski

  50. DoG • NOTE: Difference of Gaussians is an approximation to Laplacian of Gaussian Roger S. Gaborski

More Related