Lecture-7-h - Lecture-7 Edge Detection: LG, Canny Edge...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Lecture-7 Edge Detection: LG, Canny Edge Detection 1 Edge Detectors • • • • Gradient operators: Sobel, Prewit, Robert Laplacian of Gaussian (Marr-Hildreth) Gradient of Gaussian (Canny) Facet Model Based Edge Detector (Haralick) Laplacian of Gaussian Edge Detector • Generate a mask for LG for a given s • Apply mask to the image • Detect zerocrossings – Scan along each row, record an edge point at the location of zerocrossing. – Repeat above step along each column 2 Laplacian of Gaussian -( x2 + y 2 ) g ( x, y ) = e 2o 2 ∂ x g ( x, y ) = ( - 2 )e ∂x o -( x2 + y 2 ) 2o 2 ∂2 x x g ( x, y ) = (- 2 )(- 2 )e ∂x 2 o o -( x2 + y 2 ) 2o 2 ∂2 1 x2 g ( x, y ) = - 2 (1 - 2 ) ∂x 2 o o -( x2 + y 2 ) 2o 2 1 + ( - 2 )e o -( x2 + y 2 ) 2o 2 Laplacian of Gaussian -( x2 + y 2 ) ∂2 1 x2 2 g xx = 2 g ( x, y ) = - 2 (1 - 2 )e 2o ∂x o o -( x2 + y 2 ) 2 ∂ 1 y2 2 g yy = 2 g ( x, y ) = - 2 (1 - 2 )e 2o ∂y 2 o o 2 D2 g ( x, y ) = ∂ ∂ g ( x, y ) + 2 g ( x, y ) 2 ∂x ∂y 1 x2 = - 2 (1 - 2 )e o o -( x 2 + y 2 ) 2o 2 1 x2 + y2 D g ( x, y ) = - 2 ( 2 )e o o2 2 1 y2 - 2 (1 - 2 )e o o -( x 2 + y 2 ) 2o 2 -( x2 + y 2 ) 2o 2 3 Zerocrossings • Four cases of zerocrossings :{+,-}, {+,0,-}, {-,+}, {-,0,+} • Slope of zerocrossing {a, -b} is |a+b|. • To detect zerocrossing apply threshold to the slope. If the slope is above some threshold, then that point is an edge point. Gaussian - x2 g ( x) = e x -3 -2 .011 .13 2o 2 -1 0 1 2 3 .6 1 .6 .13 Standard deviation .011 g(x) 4 2-D Gaussian g ( x, y ) = e -( x2 + y 2 ) 2o 2 s =2 5 Convolution Convolution (contd) 1 1 h( x, y ) = Â Â f ( x + i, y + j ) g (i, j ) i = -1 j = -1 h ( x, y ) = f ( x, y ) * g ( x, y ) 6 Separability of Gaussian h ( x, y ) = f ( x, y ) * g ( x, y ) Requires n2 multiplications for a n by n mask, for each pixel. h( x, y ) = ( f ( x, y ) * g ( x)) * g ( y ) This requires 2n multiplications for a n by n mask, for each pixel. Separability of Laplacian of Gaussian h( x, y ) = f ( x, y ) * D2 g ( x, y ) Requires n2 multiplications for a n by n mask, for each pixel. h( x, y ) = ( f ( x, y ) * g xx ( x)) * g ( y ) + ( f ( x, y ) * g yy ( y )) * g ( x) This requires 4n multiplications for a n by n mask, for each pixel. 7 Separability Decomposition of LG into four 1D convolutions • Convolve the image with a second derivative of Gaussian mask g ( y) along each column yy • Convolve the resultant image from step (1) by a Gaussian mask g(x) along each row. Call the resultant image Ix. • Convolve the original image with a Gaussian mask, g(y) along each column •Convolve the resultant image from step (3) by a second derivative of Gaussian mask g ( x) along each row. xx Call the resultant image Iy . •Add Ix and Iy. 8 Canny Edge Detector • Compute the gradient of image f(x,y) by convolving it with the first derivative of Gaussian masks in x and y directions. • Perform non-maxima suppression on the gradient magnitude. • Apply hysteresis thresholding to the nonmaxima suppressed magnitude. Canny Edge Detector f x ( x, y ) = f ( x, y ) * g x ( x, y ) = ( f ( x, y ) * g x ( x)) * g ( y ) f y ( x, y ) = f ( x, y ) * g y ( x, y ) = ( f ( x, y ) * g y ( y )) * g ( x) ( f x , f y ) Gradient Vector magnitude = ( f x2 + f y2 ) direction = q = tan -1 fy fx 9 Non-maxima Suppression • Suppress the pixels which are not local maxima. ÏM ( x, y ) if M ( x, y ) > M ( x¢, y¢) & Ô M ( x, y ) = Ì Ô Ó 0 if M ( x, y ) > M ( x¢¢, y¢¢) otherwise Quantization in Eight Possible Directions ( f x , f y ) Gradient Vector magnitude = ( f x2 + f y2 ) direction = q = tan -1 fy fx 10 Hysteresis Thresholding Gradient magnitude High low Hysteresis Thresholding • Scan the image from left to right, topbottom. If – The gradient magnitude at a pixel is above a high threshold declare that as an edge point – Then recursively consider the neighbors of this pixel. • If the gradient magnitude is above the low threshold declare that as an edge pixel. 11 Connectedness Connected Component È0 Í1 Í Í0 Í Í0 Í0 Î 0 1 0 0 1 0 0 0 1 0 1 1 0 1 1 0˘ 1˙ ˙ 0˙ ˙ 0˙ 0˙ ˚ È0 Íb Í Í0 Í Í0 Í0 Î 0 b 0 0 d 0 0 0 c 0 a a 0 c c 0˘ a˙ ˙ 0˙ ˙ 0˙ 0˙ ˚ 4 12 Connected Component È0 Í1 Í Í0 Í Í0 Í0 Î 0 0 1 0˘ 1 0 1 1˙ ˙ 0 0 0 0˙ ˙ 0 1 1 0˙ 1 0 1 0˙ ˚ È0 Íb Í Í0 Í Í0 Í0 Î 0 0 a 0˘ b 0 a a˙ ˙ 0 0 0 0˙ ˙ 0 c c 0˙ c 0 c 0˙ ˚ 8 13 Sequential È0 Í1 Í Í0 Í Í0 Í0 Î 0 0 1 0˘ 1 0 1 1˙ ˙ 0 0 0 0˙ ˙ 0 1 1 0˙ 1 1 1 0˙ ˚ È0 Íb Í Í0 Í Í0 Í0 Î 0 0 a 0˘ b 0 a a˙ ˙ 0 0 0 0˙ ˙ 0 c c 0˙ d c c 0˙ ˚ d=c 14 Recursive È0 Í1 Í Í0 Í Í0 Í0 Î 0 0 1 0˘ 1 0 1 1˙ ˙ 0 0 0 0˙ ˙ 0 1 1 0˙ 1 1 1 0˙ ˚ È0 Íb Í Í0 Í Í0 Í0 Î 0 0 a 0˘ b 0 a a˙ ˙ 0 0 0 0˙ ˙ 0 c c 0˙ c c c 0˙ ˚ 15 ...
View Full Document

Ask a homework question - tutors are online