39
Copyright © 2012 Elsevier Inc. All rights reserved. . Chapter 5 Chapter 5 Edge Detection

Copyright © 2012 Elsevier Inc. All rights reserved.. Chapter 5 Edge Detection

Embed Size (px)

Citation preview

Page 1: Copyright © 2012 Elsevier Inc. All rights reserved.. Chapter 5 Edge Detection

Copyright © 2012 Elsevier Inc. All rights reserved..

Chapter 5Chapter 5

Edge Detection

Page 2: Copyright © 2012 Elsevier Inc. All rights reserved.. Chapter 5 Edge Detection

Copyright © 2012 Elsevier Inc. All rights reserved..

FIGURE 5.1

FIGURE 5.1

Edge models: (a) sudden step edge; (b) slanted step edge; (c) smooth step edge; (d) planar edge; (e) roof edge; and (f) line edge. The effective profiles of edge models are nonzero only within the stated neighborhood. The slanted step and the smooth step are approximations to realistic edge profiles: the sudden step and the planar edge are extreme forms that are useful for comparisons (see text).

Page 3: Copyright © 2012 Elsevier Inc. All rights reserved.. Chapter 5 Edge Detection

5.2 Basic Theory of Edge Detection

Both differential gradient (DG) and template matching (TM) operators estimate local intensity gradients with the aid of suitable convolution masks.

DG operators require two such masks for the x and y directions.

TM operators usually employ up to 12 convolution masks capable of estimating local components of gradient in different directions.

Copyright © 2012 Elsevier Inc. All rights reserved.. 3

Page 4: Copyright © 2012 Elsevier Inc. All rights reserved.. Chapter 5 Edge Detection

In the TM approach, the local edge gradient magnitude is approximated by taking the maximum of the responses for the component masks:

where n is usually 8 or 12.

Copyright © 2012 Elsevier Inc. All rights reserved.. 4

Page 5: Copyright © 2012 Elsevier Inc. All rights reserved.. Chapter 5 Edge Detection

In the DG approach, the local edge magnitude may be computed using the nonlinear transformation:

To save computational effort, it is common practice to approximate the above formula by one of the simple forms:

Copyright © 2012 Elsevier Inc. All rights reserved.. 5

Page 6: Copyright © 2012 Elsevier Inc. All rights reserved.. Chapter 5 Edge Detection

In the TM approach, edge orientation is estimated simply as that of the mask giving rise to the largest of gradient in Eq. (5.1).

In the DG approach, it is estimated by:

Copyright © 2012 Elsevier Inc. All rights reserved.. 6

Page 7: Copyright © 2012 Elsevier Inc. All rights reserved.. Chapter 5 Edge Detection

Copyright © 2012 Elsevier Inc. All rights reserved..

Table 5.1

Page 8: Copyright © 2012 Elsevier Inc. All rights reserved.. Chapter 5 Edge Detection

Copyright © 2012 Elsevier Inc. All rights reserved..

Table 5.2

Page 9: Copyright © 2012 Elsevier Inc. All rights reserved.. Chapter 5 Edge Detection

5.4 Theory of 3x3 Template Operators

Symmetry requirements lead to the following masks for and :

If the pixel intensity values within a 3x3 neighborhood are:

Copyright © 2012 Elsevier Inc. All rights reserved.. 9

0 45

0C-D-

C0C-

DC0

0

0

0

AA

BB

AA

ihg

fed

cba

Page 10: Copyright © 2012 Elsevier Inc. All rights reserved.. Chapter 5 Edge Detection

The above masks will give the following estimates of gradient in the , , and directions:

If vector addition is to be valid, then:

Copyright © 2012 Elsevier Inc. All rights reserved.. 10

0 90 45

Page 11: Copyright © 2012 Elsevier Inc. All rights reserved.. Chapter 5 Edge Detection

Equating coefficients of a, b, …, I leads to the self-consistent pair of conditions:

A further requirement is for the and masks to give equal responses at , and lead to

Where t=tan , so that

Copyright © 2012 Elsevier Inc. All rights reserved.. 11

0 45 5.22

5.22

Page 12: Copyright © 2012 Elsevier Inc. All rights reserved.. Chapter 5 Edge Detection

Copyright © 2012 Elsevier Inc. All rights reserved..

5.5 The Design of Differential Gradient Operators

Page 13: Copyright © 2012 Elsevier Inc. All rights reserved.. Chapter 5 Edge Detection

5.10 Hysteresis Thresholdoing

The concept of hysteresis thresholding is a general one and can be applied in a range of applications, including both image and signal processing.

The basic rule is to threshold the edge at a high level, and then to allow extension of the edge down to a lower level threshold,but only adjacent to points that have already been assigned edge status.Isolated edge points within the object boundaries are ignored by hysteresis thresholding.

Copyright © 2012 Elsevier Inc. All rights reserved.. 13

Page 14: Copyright © 2012 Elsevier Inc. All rights reserved.. Chapter 5 Edge Detection

Copyright © 2012 Elsevier Inc. All rights reserved.. 14

Page 15: Copyright © 2012 Elsevier Inc. All rights reserved.. Chapter 5 Edge Detection

Copyright © 2012 Elsevier Inc. All rights reserved..

FIGURE 5.4

FIGURE 5.4

Effectiveness of hysteresis thresholding. This figure shows tests made on the edge gradient image of Fig. 7.4(b). (a) Effect of thresholding at the upper hysteresis level. (b) Effect of thresholding at the lower hysteresis level. (c) Effect of hysteresis thresholding. (d) Effect of thresholding at an intermediate level.

Page 16: Copyright © 2012 Elsevier Inc. All rights reserved.. Chapter 5 Edge Detection

5.11 The Canny Operator

Canny operator (Canny, 1986) has become one of the most widely used edge detection operators, as it seeks to get away from the traditional mask-based operators.

It permits thin line structures to emerge and ensures that they are connected together as far as possible and are meaningful at the particular scale and bandwidth.

Copyright © 2012 Elsevier Inc. All rights reserved.. 16

Page 17: Copyright © 2012 Elsevier Inc. All rights reserved.. Chapter 5 Edge Detection

The method involves a number of stages of processing:

1.Low-pass spatial frequency filtering (Gaussian)

2.Application of first-order differential masks (Sobel)

3.Nonmaximum suppression involving subpixel interpolation of pixel intensities

4.Hysteresis thresholding

Copyright © 2012 Elsevier Inc. All rights reserved.. 17

Page 18: Copyright © 2012 Elsevier Inc. All rights reserved.. Chapter 5 Edge Detection

Copyright © 2012 Elsevier Inc. All rights reserved..

FIGURE 5.5

FIGURE 5.5Exactness of the well-known 3X3 smoothing kernel. This figure shows

the Gaussian-based smoothing kernel (a) that is closest to the well-known 3X3 smoothing kernel (b) over the central (3X3) region. For clarity, neither is normalized by the factor 1/16. The larger Gaussian envelope drops to 0.000 outside the region shown and integrates to 18.128 rather than 16. Hence, the kernel in (b) can be said to approximate a Gaussian within B13%. Its actual standard deviation is 0.707 compared with 0.849 for the Gaussian.

Page 19: Copyright © 2012 Elsevier Inc. All rights reserved.. Chapter 5 Edge Detection

Stage 3 – Non-maximum suppression

Goal: Thin the grayscale edges to unit width, since only one point along the edge normal direction should be a local maximum.

Method: Determine the local edge normal direction using Eq. (5.5), and move either way along the normal to determine whether the current location is or is local a local maximum. If it is not, we suppress the edge point and remain the maximum one.

When the normal direction does not pass through the centers of the adjacent pixels, linear interpolation is applied.

Copyright © 2012 Elsevier Inc. All rights reserved.. 19

Page 20: Copyright © 2012 Elsevier Inc. All rights reserved.. Chapter 5 Edge Detection

FORMULA

Copyright © 2012 Elsevier Inc. All rights reserved.. 20

Page 21: Copyright © 2012 Elsevier Inc. All rights reserved.. Chapter 5 Edge Detection

Copyright © 2012 Elsevier Inc. All rights reserved..

FIGURE 5.6

Page 22: Copyright © 2012 Elsevier Inc. All rights reserved.. Chapter 5 Edge Detection

Stage 4: Hysteresis Thresholding

By selecting the upper thresholds, it is intended to ensure capturing edges that are reliable and then select other points that have high likelihood (lower threshold) of being viable edge points because they are adjacent to edge points of known reliable.

A simple rule for choice of the lower threshold is that it should be half the upper threshold.

Copyright © 2012 Elsevier Inc. All rights reserved.. 22

Page 23: Copyright © 2012 Elsevier Inc. All rights reserved.. Chapter 5 Edge Detection

Copyright © 2012 Elsevier Inc. All rights reserved..

FIGURE 5.7 (1/4)

FIGURE 5.7Application of the Canny edge detector. (a) Original image. (b) Smoothed

image. (c) Result of applying Sobel operator. (d) Result of nonmaximum suppression. (e) Result of hysteresis thresholding. (f) Result of thresholding only at the lower threshold level. (g) Result of thresholding at the upper threshold level. Note that there are fewer false or misleading outputs in (e) than would result from using a single threshold.

Page 24: Copyright © 2012 Elsevier Inc. All rights reserved.. Chapter 5 Edge Detection

Copyright © 2012 Elsevier Inc. All rights reserved..

FIGURE 5.7 (2/4)

FIGURE 5.7Application of the Canny edge detector. (a) Original image. (b) Smoothed

image. (c) Result of applying Sobel operator. (d) Result of nonmaximum suppression. (e) Result of hysteresis thresholding. (f) Result of thresholding only at the lower threshold level. (g) Result of thresholding at the upper threshold level. Note that there are fewer false or misleading outputs in (e) than would result from using a single threshold.

Page 25: Copyright © 2012 Elsevier Inc. All rights reserved.. Chapter 5 Edge Detection

Copyright © 2012 Elsevier Inc. All rights reserved..

FIGURE 5.7 (3/4)

FIGURE 5.7Application of the Canny edge detector. (a) Original image. (b) Smoothed

image. (c) Result of applying Sobel operator. (d) Result of nonmaximum suppression. (e) Result of hysteresis thresholding. (f) Result of thresholding only at the lower threshold level. (g) Result of thresholding at the upper threshold level. Note that there are fewer false or misleading outputs in (e) than would result from using a single threshold.

Page 26: Copyright © 2012 Elsevier Inc. All rights reserved.. Chapter 5 Edge Detection

Copyright © 2012 Elsevier Inc. All rights reserved..

FIGURE 5.7 (4/4)

FIGURE 5.7Application of the Canny edge detector. (a) Original image. (b) Smoothed

image. (c) Result of applying Sobel operator. (d) Result of nonmaximum suppression. (e) Result of hysteresis thresholding. (f) Result of thresholding only at the lower threshold level. (g) Result of thresholding at the upper threshold level. Note that there are fewer false or misleading outputs in (e) than would result from using a single threshold.

Page 27: Copyright © 2012 Elsevier Inc. All rights reserved.. Chapter 5 Edge Detection

Copyright © 2012 Elsevier Inc. All rights reserved..

FIGURE 5.8 (1/4)

FIGURE 5.8

Another application of the Canny edge detector. (a) Original image. (b) Smoothed image. (c) Result of applying Sobel operator. (d) Result of nonmaximum suppression. (e) Result of hysteresis thresholding. (f) Result of thresholding only at the lower threshold level. (g) Result of thresholding at the upper threshold level. Again there are fewer false or misleading outputs in (e) than would result from using a single threshold.

Page 28: Copyright © 2012 Elsevier Inc. All rights reserved.. Chapter 5 Edge Detection

Copyright © 2012 Elsevier Inc. All rights reserved..

FIGURE 5.8 (2/4)

FIGURE 5.8

Another application of the Canny edge detector. (a) Original image. (b) Smoothed image. (c) Result of applying Sobel operator. (d) Result of nonmaximum suppression. (e) Result of hysteresis thresholding. (f) Result of thresholding only at the lower threshold level. (g) Result of thresholding at the upper threshold level. Again there are fewer false or misleading outputs in (e) than would result from using a single threshold.

Page 29: Copyright © 2012 Elsevier Inc. All rights reserved.. Chapter 5 Edge Detection

Copyright © 2012 Elsevier Inc. All rights reserved..

FIGURE 5.8 (3/4)

FIGURE 5.8

Another application of the Canny edge detector. (a) Original image. (b) Smoothed image. (c) Result of applying Sobel operator. (d) Result of nonmaximum suppression. (e) Result of hysteresis thresholding. (f) Result of thresholding only at the lower threshold level. (g) Result of thresholding at the upper threshold level. Again there are fewer false or misleading outputs in (e) than would result from using a single threshold.

Page 30: Copyright © 2012 Elsevier Inc. All rights reserved.. Chapter 5 Edge Detection

Copyright © 2012 Elsevier Inc. All rights reserved..

FIGURE 5.8 (4/4)

FIGURE 5.8

Another application of the Canny edge detector. (a) Original image. (b) Smoothed image. (c) Result of applying Sobel operator. (d) Result of nonmaximum suppression. (e) Result of hysteresis thresholding. (f) Result of thresholding only at the lower threshold level. (g) Result of thresholding at the upper threshold level. Again there are fewer false or misleading outputs in (e) than would result from using a single threshold.

Page 31: Copyright © 2012 Elsevier Inc. All rights reserved.. Chapter 5 Edge Detection

5.12 The Laplacian Operator

Sobel: first derivative operator

Laplacian: second derivative operator and is sensitive only to changes in intensity gradient.

Copyright © 2012 Elsevier Inc. All rights reserved.. 31

Page 32: Copyright © 2012 Elsevier Inc. All rights reserved.. Chapter 5 Edge Detection

Copyright © 2012 Elsevier Inc. All rights reserved..

FIGURE 5.9 (1/2)

FIGURE 5.9Comparison of Sobel and Laplacian outputs. (a) Pre-smoothed version of original image. (b)

Result of applying Sobel operator. (c) Result of applying Laplacian operator. Because the Laplacian output can be positive or negative, the output in (c) is displayed relative to a medium (128)-gray-level background. (d) Absolute magnitude Laplacian output. For clarity, (c) and (d) have been presented at increased contrast.

Note that the Laplacian output in (d) gives double edges only just inside and one just outside the edge position indicated by a Sobel or Canny operator. (To find edges using a Laplacian, zero crossings have to be located.) Both the Sobel and the Laplacian used here operate within a 3X3 window.

Page 33: Copyright © 2012 Elsevier Inc. All rights reserved.. Chapter 5 Edge Detection

5.13 Active Contours

The basic concept of Active Contour models (also known as “deformable contours” or “snakes”) is to obtain a complete and accurate outline of an object that may be ill-defined in places, whether through lack of contrast, or noise or fuzzy edges.

A starting approximation is made, either by instituting a large contour that may be shrunk to size, or a small contour that may be expanded suitably, until its shape matches that of the object.

Copyright © 2012 Elsevier Inc. All rights reserved.. 33

Page 34: Copyright © 2012 Elsevier Inc. All rights reserved.. Chapter 5 Edge Detection

Then its shape is made to evolve subject to an energy minimization process: minimizing the external energy corresponding to imperfections in the degree of fit, and minimizing the internal energy, so that the shape of the snake does not become unnecessarily intricate.

Copyright © 2012 Elsevier Inc. All rights reserved.. 34

Page 35: Copyright © 2012 Elsevier Inc. All rights reserved.. Chapter 5 Edge Detection

The energies are written in terms of small changes in position x(s)=(x(s),y(s)) of each point on the snake, where s is the arc length distance along the snake boundary:

Copyright © 2012 Elsevier Inc. All rights reserved.. 35

Page 36: Copyright © 2012 Elsevier Inc. All rights reserved.. Chapter 5 Edge Detection

Eqs. (27), (28), and (29) can be rewritten as:

Copyright © 2012 Elsevier Inc. All rights reserved.. 36

Page 37: Copyright © 2012 Elsevier Inc. All rights reserved.. Chapter 5 Edge Detection

Copyright © 2012 Elsevier Inc. All rights reserved..

FIGURE 5.10 (1/2)

FIGURE 5.10Generation of active contour models (snakes). (a) Original picture with snake initialization

points near the image boundary; the final snake locations hug the outside of the object but hardly penetrate the large concavity at the bottom: they actually lie approximately along a weak shadow edge. (b) Result of smoothing and application of Sobel operator to (a); the snake algorithm used this image as its input. The snake output is superimposed in black on (b), so that the high degree of co-location with the edge maxima can readily be seen. (c) Intermediate result, after half (30) the total number of iterations (60): this illustrates that after one edge point has been captured, it becomes much easier for other such points to be captured. (d) Result of using an increased number of initialization points and joining the final locations to give a connected boundary: some remanent deficiencies are evident.

Page 38: Copyright © 2012 Elsevier Inc. All rights reserved.. Chapter 5 Edge Detection

Copyright © 2012 Elsevier Inc. All rights reserved..

FIGURE 5.10 (2/2)

FIGURE 5.10Generation of active contour models (snakes). (a) Original picture with snake initialization

points near the image boundary; the final snake locations hug the outside of the object but hardly penetrate the large concavity at the bottom: they actually lie approximately along a weak shadow edge. (b) Result of smoothing and application of Sobel operator to (a); the snake algorithm used this image as its input. The snake output is superimposed in black on (b), so that the high degree of co-location with the edge maxima can readily be seen. (c) Intermediate result, after half (30) the total number of iterations (60): this illustrates that after one edge point has been captured, it becomes much easier for other such points to be captured. (d) Result of using an increased number of initialization points and joining the final locations to give a connected boundary: some remanent deficiencies are evident.

Page 39: Copyright © 2012 Elsevier Inc. All rights reserved.. Chapter 5 Edge Detection

5.18 More Recent Developments

Shima et al., 2010

Ren et al., 2010

Cosio et al., 2010

Mishra et al., 2011

Papadakis and Bugeau, 2011

Copyright © 2012 Elsevier Inc. All rights reserved.. 39