Edge Detection (Trucco, Chapt 4 and Jain Et Al., Chapt 5)

Edge Detection (Trucco, Chapt 4 and Jain Et Al., Chapt 5)

Edge detection (Trucco, Chapt 4 AND Jain et al., Chapt 5) • Definition of edges -Edges are significant local changes of intensity in an image. -Edges typically occur on the boundary between twodifferent regions in an image. • Goal of edge detection -Produce a line drawing of a scene from an image of that scene. -Important features can be extracted from the edges of an image (e.g., corners, lines, curves). -These features are used by higher-levelcomputer vision algorithms (e.g., recogni- tion). -2- • What causes intensity changes? -Various physical events cause intensity changes. -Geometric events *object boundary (discontinuity in depth and/or surface color and texture) *surface boundary (discontinuity in surface orientation and/or surface color and texture) -Non-geometric events *specularity (direct reflection of light, such as a mirror) *shadows (from other objects or from the same object) *inter-reflections • Edge descriptors Edge normal: unit vector in the direction of maximum intensity change. Edge direction: unit vector to perpendicular to the edge normal. Edge position or center: the image position at which the edge is located. Edge strength: related to the local image contrast along the normal. -3- • Modeling intensity changes -Edges can be modeled according to their intensity profiles. Step edge: the image intensity abruptly changes from one value to one side of the discontinuity to a different value on the opposite side. Ramp edge: astep edge where the intensity change is not instantaneous but occur overafinite distance. Ridge edge: the image intensity abruptly changes value but then returns to the starting value within some short distance (generated usually by lines). -4- Roof edge: aridge edge where the intensity change is not instantaneous but occur overafinite distance (generated usually by the intersection of surfaces). • The four steps of edge detection (1) Smoothing: suppress as much noise as possible, without destroying the true edges. (2) Enhancement: apply a filter to enhance the quality of the edges in the image (sharpening). (3) Detection: determine which edge pixels should be discarded as noise and which should be retained (usually,thresholding provides the criterion used for detection). (4) Localization: determine the exact location of an edge (sub-pixel resolution might be required for some applications, that is, estimate the location of an edge to better than the spacing between pixels). Edge thinning and linking are usually required in this step. -5- • Edge detection using derivatives -Calculus describes changes of continuous functions using derivatives. -Animage is a 2D function, so operators describing edges are expressed using partial derivatives. -Points which lie on an edge can be detected by: (1) detecting local maxima or minima of the first derivative (2) detecting the zero-crossing of the second derivative -6- • Differencing 1D signals (see also Trucco, Appendix A.2) -Tocompute the derivative ofasignal, we approximate the derivative byfinite dif- ferences: Computing the 1st derivative: f (x + h) − f (x) f ′(x) = lim ≈ f (x + 1) − f (x)(h=1) h−>0 h mask: [ −11] -Examples using the edge models and the mask [ −101] (centered about x): -7- Computing the 2nd derivative: f ′(x + h) − f ′(x) f ′′(x) = lim ≈ f ′(x + 1) − f ′(x) = h−>0 h f (x + 2) − 2 f (x + 1) + f (x)(h=1) -This approximation is centered about x + 1; by replacing x + 1by x we obtain: f ′′(x) ≈ f (x + 1) − 2 f (x) + f (x − 1) mask: [ 1 −21] 20 20 20 20 f(x) 10 10 10 10 10 0 0 0 0 10 0 0 0 f'(x) = f(x+1) - f(x) (approximates f’() at x+1/2) 0 0 0 10 -10 0 0 f''(x) = f(x-1)-2f(x)+f(x+1) (approximates f’’() at x) zero-crossing -Examples using the edge models: -8- Edge detection using the gradient • Definition of the gradient -The gradient is a vector which has certain magnitude and direction: ∂ f ∇ = ∂x f ∂ f ∂y ∂ f ∂ f magn(∇ f ) = ( )2 + ( )2 = √ M 2 + M 2 √ √ ∂x ∂y x y −1 dir(∇ f ) = tan (M y/M x) -Tosav e computations, the magnitude of gradient is usually approxi- mated by: magn(∇ f ) ≈ |M x| + |M y| • Properties of the gradient -The magnitude of gradient provides information about the strength of the edge. -The direction of gradient is always perpendicular to the direction of the edge (the edge direction is rotated with respect to the gradient direction by -90 degrees). -9- • Estimating the gradient with finite differences ∂ f f (x + h, y) − f (x, y) = lim ∂x h−>0 h ∂ f f (x, y + h) − f (x, y) = lim ∂y h−>0 h -The gradient can be approximated by finite differences: ∂ f f (x + hx, y) − f (x, y) = = f (x + 1, y) − f (x, y), (hx=1) ∂x hy ∂ f f (x, y + hy) − f (x, y) = = f (x, y + 1) − f (x, y), (hy=1) ∂y hy -Using pixel-coordinate notation (remember: j corresponds to the x direction and i to the negative y direction): x-h x x+h y+h y y-h ∂ f = f (i, j + 1) − f (i, j) ∂x ∂ f ∂ f = f (i − 1, j) − f (i, j)or = f (i, j) − f (i + 1, j) ∂y ∂y -10- Example Suppose we want to approximate the gradient magnitude at z5 Z1 Z2 Z3 Z4 Z5 Z6 Z7 Z8 Z9 ∂I ∂I = z − z , = z − z ∂x 6 5 ∂y 5 8 2 2 magn(∇I) = √ (z6 − z5) + (z5 − z8) ∂I ∂I -Wecan implement and using the following masks: ∂x ∂y 1 -1 1 -1 (note: M x is the approximation at (i, j + 1/2) and M y is the approximation at (i + 1/2, j)) -11- • The Roberts edge detector ∂ f = f (i, j) − f (i + 1, j + 1) ∂x ∂ f = f (i + 1, j) − f (i, j + 1) ∂y -This approximation can be implemented by the following masks: 1 0 0 −1 M x = M y = 0 −1 1 0 (note: M x and M y are is approximations at (i + 1/2, j + 1/2)) • The Prewitt edge detector -Consider the arrangement of pixels about the pixel (i, j): a0 a1 a2 a7 [i, j] a3 a6 a5 a4 -The partial derivativescan be computed by: M x = (a2 + ca3 + a4) − (a0 + ca7 + a6) M y = (a6 + ca5 + a4) − (a0 + ca1 + a2) -The constant c implies the emphasis giventopixels closer to the center of the mask. -Setting c = 1, we get the Prewitt operator: −1 0 1 −1 −1 −1 = − = M x 1 0 1 M y 0 0 0 −1 0 1 1 1 1 (note: M x and M y are approximations at (i, j)) -12- • The Sobel edge detector -Setting c = 2, we get the Sobel operator: −1 0 1 −1 −2 −1 = − = M x 2 0 2 M y 0 0 0 −1 0 1 1 2 1 (note: M x and M y are approximations at (i, j)) • Main steps in edge detection using masks (1) Smooth the input image ( fˆ(x, y) = f (x, y)*G(x, y)) ˆ = ˆ (2) f x f (x, y)*M x(x, y) ˆ = ˆ (3) f y f (x, y)*M y(x, y) = ˆ + ˆ (4) magn(x, y) | f x| | f y| = −1 ˆ ˆ (5) dir(x, y) tan ( f y/ f x) (6) If magn(x, y)>T,then possible edge point (an example using the Prewitt edge detector - don’tdivide by 2) -13- (with noise filtering) -14- (without noise filtering) -15- • Isotropic property of gradient magnitude -The magnitude of gradient is an isotropical operator (it detects edges in any direction !!) -16- • Some practical issues -The differential masks act as high-pass filters which tend to amplify noise. -Toreduce the effects of noise, the image needs to be smoothed first with a low- pass filter. (1) The noise suppression-localization tradeoff: a lar ger filter reduces noise, but worsens localization (i.e., it adds uncertainty to the location of the edge) and vice versa. -(2) Howshould we choose the threshold? -17- -(3) Edge thinning and linking are required to obtain good contours. • Criteria for optimal edge detection (1) Good detection: the optimal detector must minimize the probability of false positives(detecting spurious edges caused by noise), as well as that of false neg- atives(missing real edges). (2) Good localization: the edges detected must be as close as possible to the true edges. Single response constraint: the detector must return one point only for each true edge point; that is, minimize the number of local maxima around the true edge (created by noise). -18- The Canny edge detector -This is probably the most widely used edge detector in computer vision. -Cannyhas shown that the first derivative ofthe Gaussian closely approximates the operator that optimizes the product of signal-to-noise ratio and localization. -His analysis is based on "step-edges" corrupted by "additive Gaussian noise". Algorithm 1. Compute f x and f y ∂ ∂ f = ( f * G) = f * G = f * G x ∂x ∂x x ∂ ∂ f = ( f * G) = f * G = f * G y ∂y ∂y y G(x, y)isthe Gaussian function −x G (x, y)isthe derivate of G(x, y)with respect to x: G (x, y) = G(x, y) x x 2 −y G (x, y)isthe derivate of G(x, y)with respect to y: G (x, y) = G(x, y) y y 2 2. Compute the gradient magnitude 2 2 magn(i, j) = √ fx + f y 3. Apply non-maxima suppression. 4. Apply hysteresis thresholding/edge linking. -19- • Non-maxima suppression -Tofind the edge points, we need to find the local maxima of the gradient magni- tude.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    29 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us