1 / 48

Computer Vision

Lecture 10 Roger S. Gaborski. Computer Vision. Algorithm Development: Edges. We would like to develop algorithms that detect important edges in images The ‘quality’ of edges will depend on the image characteristics Noise can result in false edges. Profiles of an Ideal Edge.

Télécharger la présentation

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. Lecture 10 Roger S. Gaborski Computer Vision Roger S. Gaborski

  2. Algorithm Development: Edges • We would like to develop algorithms that detect important edges in images • The ‘quality’ of edges will depend on the image characteristics • Noise can result in false edges Roger S. Gaborski

  3. Profiles of an Ideal Edge Roger S. Gaborski

  4. Profile of Edge - Analysis • Same gray level input range [0,1] • Edge is located at ‘peak’ of first derivative • Cannot choose only one threshold value because range of first derivative depends on slope of gray level values • The edge is located where the second derivative goes through zero-independent of slope of gray level signal Roger S. Gaborski

  5. Edge Detection is Not Simple Roger S. Gaborski

  6. The derivative operation can be used to detect edgesHow can the derivative operator be approximated in a digital image?? Roger S. Gaborski

  7. MATLAB Examples • Approximation to derivative – difference of adjacent data values • data = [ .10 .14 .13 .12 .11 .10 .11 .34 .33 .32 .35 .10 .11 .12 .12 .12]; • diff operator: second- first data value (.14-.10) • diff(data) = 0.04 -0.01 -0.01 -0.01 -0.01 0.01 0.23 -0.01 -0.01 0.03 -0.25 0.01 0.01 0 0 diff operator is approximation to first derivative Roger S. Gaborski

  8. Estimate of Second Derivative • diff(diff( data)) • -0.05 0 0.0 0 0.02 0.22 -0.24 0 0.04 -0.28 0.26 0 -0.0100 0 Roger S. Gaborski

  9. Simulated Data data diff(data) diff(diff(data)) Roger S. Gaborski

  10. How would you implement in a filter? • diff: second value – first value [ -1 +1 ] (could also use [+1 -1]) • Could also represent as: [-1 0 +1] • Use in correlation filter – same results Roger S. Gaborski

  11. Actual Image Data Roger S. Gaborski

  12. Row 80 Roger S. Gaborski

  13. Roger S. Gaborski

  14. diff Operator Roger S. Gaborski

  15. Smooth Image First Roger S. Gaborski

  16. Roger S. Gaborski

  17. Gradient of a 2D Function Gradient is defined by a vector (see pg 366): Δ f = gx = f / x gy f / y The magnitude of the vector: mag( f) =[ gx2 + gy2 ]1/2 Δ Roger S. Gaborski

  18. Direction of Gradient • The gradient points in the direction of maximum change of intensity α(x,y) = tan-1 (gy / gx) Roger S. Gaborski

  19. Partial Derivatives in Vertical and Horizontal Directions • Vertical (y direction) • Horizontal (x direction) Roger S. Gaborski

  20. Partial Derivatives in Vertical and Horizontal Directions 5 5 5 5 5 5 5 5 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 .* = 6 VERTICAL GRADIENT Roger S. Gaborski

  21. First Derivative Approximation y+1 y y-1 eq1 eq2 x-1 x x+1 Roger S. Gaborski

  22. First Derivative Approximation • First Derivative in x direction: fx (x,y) = f(x,y) – f(x-1,y) Eq 1 = f(x+1,y) – f(x,y) Eq 2 • First Derivative in y direction: fy(x,y) = f(x,y) – f(x, y-1) Eq3 = f(x, y+1) - f(x,y) Eq4 Roger S. Gaborski

  23. First Derivative Approximation y+1 y y-1 eq1 eq2 x-1 x x+1 Roger S. Gaborski

  24. Edge Detection • An Edge is defined as a discontinuity within a local set of pixels. x-1 x x+1 y+1 y y-1 Roger S. Gaborski

  25. fy = (28-15)/2+(27-17)/2+(26-16)/2= fy = -6.5- 5.0 - 5.0 = 16.5 fx = (26-28)/2+(31-30)/2+(16-15)/2= fx = -1 + .5 + .5 = 0 Divide by 2 because 2 pixels apart. • = tan-1 (fy/fx) = tan-1 (16.5/0) = 90 degrees mag(f ) = [ fy2 + fx2 ]1/2 = 16.5 x-1 x x+1 y+1 y y-1 Roger S. Gaborski Y –direction X -direction

  26. fy = (38-12)/2+(66-15)/2+(65-42)/2= fy = 13.00 + 25.5+ 11.5 = 50 fx = (65-38)/2+(64-14)/2+(42-12)/2= fx = 13.5 0+ 25.00 + 15.00 = 53.5 Divide by 2 because 2 pixels apart. Ignore dividing by two simply introduces a scaling error, but results in faster calculation • = tan-1 (fy/fx) = tan-1 (50/53.5)= 43 degrees mag(f ) = [ fy2 + fx2 ]1/2 = 73  Roger S. Gaborski Y –direction X -direction

  27. Second Derivative Approximation • Discrete version of 2nd Partial Derivation of f(x,y) in x direction is found by taking the difference of Eq1 and Eq2: • 2 f(x,y) /  x2 = Eq1-Eq2 = 2f(x,y)-f(x-1,y)-f(x+1,y) In y direction: • 2 f(x,y) /  y2 = Eq3-Eq4 = 2f(x,y)-f(x,y-1)-f(x,y+1) Roger S. Gaborski

  28. Derivative Approximation for Laplacian y+1 y y-1 x-1 x x+1 Roger S. Gaborski

  29. Laplacian • Independent of edge orientation • 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) Roger S. Gaborski

  30. EXAMPLE: Using Sobel Edge Filter Roger S. Gaborski

  31. Simple First Derivative Approximation Difference x = Smoothing Roger S. Gaborski

  32. Rotate Filter Sensitive to edges at different orientations Roger S. Gaborski

  33. Sobel Filter • Consider unequal weights for smoothing operation = Sy x = Roger S. Gaborski

  34. Sobel Filter • Consider unequal weights for smoothing operation = Sx x = Roger S. Gaborski

  35. Sobel Edge Filter >> fh=fspecial('sobel') fh = 1 2 1 0 0 0 -1 -2 -1 >> Ifh=imfilter(Ig,fh); >> fv=f' fv = 1 0 -1 2 0 -2 1 0 -1 >> Ifv=imfilter(Ig,fv); Ifh is an image containing the Horizontal edges Ifv is an image containing the Vertical edges Can we use the command: figure, imshow(Ifh) to display the horizontal edges?? Roger S. Gaborski

  36. >> max(Ifh(:)) ans = 2.8849 >> min(Ifh(:)) ans = -2.9685 Roger S. Gaborski

  37. Horizontal Edges Vertical Edges Roger S. Gaborski

  38. Sum of Horizontal and Vertical Edges Roger S. Gaborski

  39. Absolute Value of Sum of Horizontal and Vertical Edges Roger S. Gaborski

  40. Threshold of Absolute Value of Sum of Horizontal and Vertical Edges T=1 T=.5 Roger S. Gaborski

  41. Threshold of Absolute Value of Sum of Horizontal and Vertical Edges T=.25 T=.1 Roger S. Gaborski

  42. build1.jpg Roger S. Gaborski

  43. Edge image Roger S. Gaborski

  44. ~ Operator Roger S. Gaborski

  45. Box Image Roger S. Gaborski

  46. Note missing Horizontal Edges Roger S. Gaborski

  47. What are Edgels Edgels are defined as a rapid change in the image function over a small area Roger S. Gaborski

  48. Edgels • Edgels have three properties: • Direction • Magnitude • Location • Edgels are not complete edges • They provide evidence for higher level structures, such as, boundary lines, contours Roger S. Gaborski

More Related