EE 663 Image Processing Edge Detection 4 Dr

  • Slides: 28
Download presentation
EE 663 Image Processing Edge Detection 4 Dr. Samir H. Abdul-Jauwad Electrical Engineering Department

EE 663 Image Processing Edge Detection 4 Dr. Samir H. Abdul-Jauwad Electrical Engineering Department King Fahd University of Petroleum & Minerals

Edge Detection • Non-maxima suppression − To find the edge points, we need to

Edge Detection • Non-maxima suppression − To find the edge points, we need to find the local maxima of the gradient magnitude. − Broad ridges must be thinned so that only the magnitudes at the points of greatest local change remain. − All values along the direction of the gradient that are not peak values of a ridge are suppressed. 2

Edge Detection • Non-maxima suppression – cont. 3

Edge Detection • Non-maxima suppression – cont. 3

Edge Detection • Non-maxima suppression – cont. − What are the neighbors? − Look

Edge Detection • Non-maxima suppression – cont. − What are the neighbors? − Look along gradient normal − Quantization of normal directions: 3 2 1 0 4

Edge Detection • Canny – Non-maxima suppression: gradient magnitude thinned 5

Edge Detection • Canny – Non-maxima suppression: gradient magnitude thinned 5

Edge Detection • Hysteresis thresholding / Edge linking − The output of non-maxima suppression

Edge Detection • Hysteresis thresholding / Edge linking − The output of non-maxima suppression still contains the local maxima created by noise. − Can we get rid of them just by using a single threshold? − if we set a low threshold, some noisy maxima will be accepted too. − if we set a high threshold, true maxima might be missed (the value of true maxima will fluctuate above and below the threshold, fragmenting the edge). − A more effective scheme is to use two thresholds: − a low threshold tl − a high threshold th − usually, th ≈ 2 tl 6

Edge Detection • Hysteresis thresholding / Edge linking – cont. − The algorithm performs

Edge Detection • Hysteresis thresholding / Edge linking – cont. − The algorithm performs edge linking as a by-product of doublethresholding !! 7

Edge Detection • Canny – Hysteresis thresholding / Edge linking thinned 8

Edge Detection • Canny – Hysteresis thresholding / Edge linking thinned 8

Edge Detection 9

Edge Detection 9

Edge Detection 10

Edge Detection 10

Edge Detection Using the 2 nd Derivative • Edge points can be detected by

Edge Detection Using the 2 nd Derivative • Edge points can be detected by finding the zero-crossings of the second derivative. • There are two operators in 2 D that correspond to the second derivative: − Laplacian − Second directional derivative 11

Edge Detection Using the 2 nd Derivative • The Laplacian: 12

Edge Detection Using the 2 nd Derivative • The Laplacian: 12

Edge Detection Using the 2 nd Derivative • Example: • The Laplacian can be

Edge Detection Using the 2 nd Derivative • Example: • The Laplacian can be implemented using the mask: • Example: 13

Edge Detection Using the 2 nd Derivative • Properties of the Laplacian − −

Edge Detection Using the 2 nd Derivative • Properties of the Laplacian − − It is an isotropic operator. It is cheaper to implement (one mask only). It does not provide information about edge direction. It is more sensitive to noise (differentiates twice). • Find zero crossings − Scan along each row, record an edge point at the location of zerocrossing. − Repeat above step along each column 14

Edge Detection Using the 2 nd Derivative • How do we estimate the edge

Edge Detection Using the 2 nd Derivative • How do we estimate the edge strength? • Four cases of zero-crossings : − − {+, -} {+, 0, -} {-, +} {-, 0, +} • Slope of zero-crossing {a, -b} is |a+b|. • To mark an edge: − compute slope of zero-crossing − apply a threshold to slope 15

Edge Detection Using the 2 nd Derivative • The Marr-Hildreth edge detector − Uses

Edge Detection Using the 2 nd Derivative • The Marr-Hildreth edge detector − Uses the Laplacian-of-Gaussian (LOG) − To reduce the noise effect, the image is first smoothed with a lowpass filter. − In the case of the LOG, the low-pass filter is chosen to be a Gaussian. (σ determines the degree of smoothing, mask size increases with σ) 16

Edge Detection Using the 2 nd Derivative • The Laplacian-of-Gaussian (LOG) – cont. −

Edge Detection Using the 2 nd Derivative • The Laplacian-of-Gaussian (LOG) – cont. − It can be shown that: 17

Edge Detection Using the 2 nd Derivative • The Laplacian-of-Gaussian (LOG) – cont. 18

Edge Detection Using the 2 nd Derivative • The Laplacian-of-Gaussian (LOG) – cont. 18

Edge Detection Using the 2 nd Derivative • The Laplacian-of-Gaussian (LOG) – cont. 19

Edge Detection Using the 2 nd Derivative • The Laplacian-of-Gaussian (LOG) – cont. 19

Edge Detection Using the 2 nd Derivative • The Laplacian-of-Gaussian (LOG) – cont. 20

Edge Detection Using the 2 nd Derivative • The Laplacian-of-Gaussian (LOG) – cont. 20

Edge Detection Using the 2 nd Derivative • Gradient vs. LOG – a comparison

Edge Detection Using the 2 nd Derivative • Gradient vs. LOG – a comparison − Gradient works well when the image contains sharp intensity transitions and low noise − Zero-crossings of LOG offer better localization, especially when the edges are not very sharp 21

Edge Detection Using the 2 nd Derivative • Separability − Gaussian: − A 2

Edge Detection Using the 2 nd Derivative • Separability − Gaussian: − A 2 -D Gaussian can be separated into two 1 -D Gaussians − Perform 2 convolutions with 1 -D Gaussians n 2 multiplications per pixel 2 n multiplications per pixel 22

Edge Detection Using the 2 nd Derivative • Separability − Laplacian-of-Gaussian: Requires n 2

Edge Detection Using the 2 nd Derivative • Separability − Laplacian-of-Gaussian: Requires n 2 multiplications per pixel Requires 4 n multiplications per pixel 23

Edge Detection Using the 2 nd Derivative • Separability Gaussian Filtering Image g(x) g(y)

Edge Detection Using the 2 nd Derivative • Separability Gaussian Filtering Image g(x) g(y) + Laplacian-of-Gaussian Filtering gxx(x) g(x) Image + gyy(y) g(y) 24

Edge Detection Using the 2 nd Derivative • Marr-Hildteth (LOG) Algorithm: − Compute Lo.

Edge Detection Using the 2 nd Derivative • Marr-Hildteth (LOG) Algorithm: − Compute Lo. G − Use one 2 D filter: − Use four 1 D filters: − Find zero-crossings from each row and column − Find slope of zero-crossings − Apply threshold to slope and mark edges 25

Edge Detection Using the 2 nd Derivative • Disadvantage of LOG edge detection: −

Edge Detection Using the 2 nd Derivative • Disadvantage of LOG edge detection: − Does not handle corners well 26

Edge Detection Using the 2 nd Derivative • Disadvantage of LOG edge detection: −

Edge Detection Using the 2 nd Derivative • Disadvantage of LOG edge detection: − Does not handle corners well − Why? The derivative of the Gaussian: The Laplacian of the Gaussian: (unoriented) 27

Edge Detection Using the 2 nd Derivative • The second directional derivative − This

Edge Detection Using the 2 nd Derivative • The second directional derivative − This is the second derivative computed in the direction of the gradient. 28