edge detection 1. edge template gradient generation edge gradients are computed in two orthogonal...

42
EDGE DETECTION 1

Upload: curtis-norman

Post on 17-Dec-2015

217 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: EDGE DETECTION 1. Edge Template Gradient Generation Edge gradients are computed in two orthogonal directions, –usually along rows and columns, –the edge

EDGE DETECTION

1

Page 2: EDGE DETECTION 1. Edge Template Gradient Generation Edge gradients are computed in two orthogonal directions, –usually along rows and columns, –the edge

Edge Template Gradient Generation

• Edge gradients are computed in two orthogonal directions, – usually along rows and columns,– the edge direction is inferred by computing the

vector sum of the gradients.

• Another approach is to compute gradients in a large number of directions by convolution of an image with a set of template gradient impulse response arrays. 2

Page 3: EDGE DETECTION 1. Edge Template Gradient Generation Edge gradients are computed in two orthogonal directions, –usually along rows and columns, –the edge

Edge Template Gradient Generation

• The edge template gradient is defined as:

3

Page 4: EDGE DETECTION 1. Edge Template Gradient Generation Edge gradients are computed in two orthogonal directions, –usually along rows and columns, –the edge

4

Page 5: EDGE DETECTION 1. Edge Template Gradient Generation Edge gradients are computed in two orthogonal directions, –usually along rows and columns, –the edge

Kirsch

5

Page 6: EDGE DETECTION 1. Edge Template Gradient Generation Edge gradients are computed in two orthogonal directions, –usually along rows and columns, –the edge

Robinson

6

Page 7: EDGE DETECTION 1. Edge Template Gradient Generation Edge gradients are computed in two orthogonal directions, –usually along rows and columns, –the edge

Robinson

7

Page 8: EDGE DETECTION 1. Edge Template Gradient Generation Edge gradients are computed in two orthogonal directions, –usually along rows and columns, –the edge

8

Page 9: EDGE DETECTION 1. Edge Template Gradient Generation Edge gradients are computed in two orthogonal directions, –usually along rows and columns, –the edge

Nevatia and Babu edge detection technique

9

Page 10: EDGE DETECTION 1. Edge Template Gradient Generation Edge gradients are computed in two orthogonal directions, –usually along rows and columns, –the edge

Nevatia and Babu edge detection technique

10

Page 11: EDGE DETECTION 1. Edge Template Gradient Generation Edge gradients are computed in two orthogonal directions, –usually along rows and columns, –the edge

Nevatia and Babu edge detection technique

11

Page 12: EDGE DETECTION 1. Edge Template Gradient Generation Edge gradients are computed in two orthogonal directions, –usually along rows and columns, –the edge

12

Page 13: EDGE DETECTION 1. Edge Template Gradient Generation Edge gradients are computed in two orthogonal directions, –usually along rows and columns, –the edge

Truncated Pyramid Operator

• Gives a linearly decreasing weighting to pixels away from the center of an edge.

• The row gradient impulse response array for a 7x7 truncated pyramid operator is given by:

13

Page 14: EDGE DETECTION 1. Edge Template Gradient Generation Edge gradients are computed in two orthogonal directions, –usually along rows and columns, –the edge

Canny Edge Detector

• (1) The image is smoothed by Gaussian convolution. • (2) A simple 2-D first derivative operator (Roberts Cross) is

applied to highlight regions of the image with high first spatial derivatives.

(Edges give rise to ridges in the gradient magnitude image.)

• (3) Tracks along the top of these ridges and sets to zero all

pixels that are not actually on the ridge top so as to give a thin line in the output, a process known as non-maximal suppression. 14

Page 15: EDGE DETECTION 1. Edge Template Gradient Generation Edge gradients are computed in two orthogonal directions, –usually along rows and columns, –the edge

15

Page 16: EDGE DETECTION 1. Edge Template Gradient Generation Edge gradients are computed in two orthogonal directions, –usually along rows and columns, –the edge

Canny Edge Detector

• Tracking process exhibits hysteresis controlled by two thresholds: T1 and T2, with T1 > T2.

• Tracking can only begin at a point on a ridge higher than T1.

• Tracking then continues in both directions out from that point

until the height of the ridge falls below T2.

• This hysteresis helps to ensure that noisy edges are not broken

up into multiple edge fragments.

16

Page 17: EDGE DETECTION 1. Edge Template Gradient Generation Edge gradients are computed in two orthogonal directions, –usually along rows and columns, –the edge

The Effect of the Canny Operator

• Determined by following parameters:– the width of the Gaussian kernel used in the smoothing

phase, and – the upper and lower thresholds used by the tracker.

• Increasing the width reduces the detector's sensitivity to noise, at the expense of losing some of the finer detail in the image.

• The localization error in the detected edges also

increases slightly as the Gaussian width is increased. 17

Page 18: EDGE DETECTION 1. Edge Template Gradient Generation Edge gradients are computed in two orthogonal directions, –usually along rows and columns, –the edge

Tracking Threshold

• For good results, the tracking threshold can be set: – The upper quite high – The lower quite low

• Too high lower threshold will cause noisy edges to break up. (Why?)

• Too low upper threshold increases the number of

spurious and undesirable edge fragments appearing in the output. (Why?)

18

Page 19: EDGE DETECTION 1. Edge Template Gradient Generation Edge gradients are computed in two orthogonal directions, –usually along rows and columns, –the edge

Using a Gaussian kernel with standard deviation 1.0 and upper and lower thresholds of 255 and 1

Most of the major edges are detected and lots of details have been picked out well

19

Page 20: EDGE DETECTION 1. Edge Template Gradient Generation Edge gradients are computed in two orthogonal directions, –usually along rows and columns, –the edge

The same kernel size and upper threshold, but with the lower threshold increased to 220

The edges have become more broken up than in the previous image, which is likely to be bad for subsequent processing. Also, the vertical

edges on the wall have not been detected, along their full length.

255 and 1 255 and 220 20

Page 21: EDGE DETECTION 1. Edge Template Gradient Generation Edge gradients are computed in two orthogonal directions, –usually along rows and columns, –the edge

Obtained by lowering the upper threshold to 128. The lower threshold is kept at 1 and the Gaussian standard

deviation remains at 1.0.

Many more faint edges are detected along with some short `noisy' fragments. Notice that the detail in the clown's hair is now picked out.

21

Page 22: EDGE DETECTION 1. Edge Template Gradient Generation Edge gradients are computed in two orthogonal directions, –usually along rows and columns, –the edge

upper threshold to 128 255 and 1 255 and 220

22

Page 23: EDGE DETECTION 1. Edge Template Gradient Generation Edge gradients are computed in two orthogonal directions, –usually along rows and columns, –the edge

Obtained with the same thresholds as the previous image, but the Gaussian used has a standard deviation of 2.0.

Much of the detail on the wall is no longer detected, but most of the strong edges remain.

The edges also tend to be smoother and less noisy

23

Page 24: EDGE DETECTION 1. Edge Template Gradient Generation Edge gradients are computed in two orthogonal directions, –usually along rows and columns, –the edge

• Often sharper and less complex than those in natural scenes.

• This generally improves the performance of any edge detector.

Edges in Artificial Scenes

24

Page 25: EDGE DETECTION 1. Edge Template Gradient Generation Edge gradients are computed in two orthogonal directions, –usually along rows and columns, –the edge

How to control the details contained in the resulting

edge image

The result of applying the Canny edge detector using a standard deviation of 1.0 and an upper and lower threshold of 255 and 1

This image contains many details. 25

Page 26: EDGE DETECTION 1. Edge Template Gradient Generation Edge gradients are computed in two orthogonal directions, –usually along rows and columns, –the edge

We might be interested to obtain only lines that correspond to the boundaries of the objects

Increasing the standard deviation for the Gaussian smoothing to 1.8

Some edges corresponding to changes in the surface orientation remain. 26

Page 27: EDGE DETECTION 1. Edge Template Gradient Generation Edge gradients are computed in two orthogonal directions, –usually along rows and columns, –the edge

Scaling down the image before the edge detection, we can use the upper threshold of the edge tracker to remove the weaker edges.

The result of:1. scaling the image with 0.25 2. applying the Canny operator (a standard deviation of 1.8) (upper threshold of 200) (lower threshold of 1 )

27

Page 28: EDGE DETECTION 1. Edge Template Gradient Generation Edge gradients are computed in two orthogonal directions, –usually along rows and columns, –the edge

What effect does increasing the Gaussian kernel size have on the magnitudes of the gradient maxima at edges? What change does this imply has to be made to the tracker thresholds when the kernel size is increased? It is sometimes easier to evaluate edge detector performance after thresholding the edge detector output at some low gray scale value (e.g. 1) so that all detected edges are marked by bright white pixels. Try this out on the third and fourth example images of the clown. Comment on the differences between the two images. How does the Canny operator compare with the Roberts Cross and Sobel edge detectors in terms of speed? What do you think is the slowest stage of the process?

How does the Canny operator compare in terms of noise rejection and edge detection with other operators such as the Roberts Cross and Sobel operators?

How does the Canny operator compare with other edge detectors on simple artificial 2-D scenes? And on more complicated natural scenes?

Under what situations might you choose to use the Canny operator rather than the Roberts Cross or Sobel operators? In what situations would you definitely not choose it?

28

Page 29: EDGE DETECTION 1. Edge Template Gradient Generation Edge gradients are computed in two orthogonal directions, –usually along rows and columns, –the edge

Laplacian/Laplacian of Gaussian

• The Laplacian is a 2-D isotropic measure of the 2nd spatial derivative of an image.

• The Laplacian of an image highlights regions of rapid intensity change and is therefore often used for edge detection.

• The Laplacian is often applied to an image that has first been smoothed with something approximating a Gaussian smoothing filter in order to reduce its sensitivity to noise.

29

Page 30: EDGE DETECTION 1. Edge Template Gradient Generation Edge gradients are computed in two orthogonal directions, –usually along rows and columns, –the edge

How Laplacian/Laplacian of Gaussian Works

The Laplacian L(x,y) of an image with pixel intensity values I(x,y) is given by:

Image is represented as a set of discrete pixels, we have to find a discrete convolution kernel that can approximate the second derivatives in the definition of the Laplacian.

Three commonly used small kernels are shown below:

30

Page 31: EDGE DETECTION 1. Edge Template Gradient Generation Edge gradients are computed in two orthogonal directions, –usually along rows and columns, –the edge

Noise and Laplacian

• Because kernels are approximating a second derivative measurement on the image, they are very sensitive to noise.

• To counter this, the image is often Gaussian smoothed before applying the Laplacian filter.

• This pre-processing step reduces the high frequency noise components prior to the differentiation step.

• The convolution operation is associative, we can convolve the Gaussian smoothing filter with the Laplacian filter, and then convolve this hybrid filter

LoG (`Laplacian of Gaussian') 31

Page 32: EDGE DETECTION 1. Edge Template Gradient Generation Edge gradients are computed in two orthogonal directions, –usually along rows and columns, –the edge

2-D LoG FunctionThe 2-D LoG function centered on zero and with Gaussian standard deviation   has the form:

32

Page 33: EDGE DETECTION 1. Edge Template Gradient Generation Edge gradients are computed in two orthogonal directions, –usually along rows and columns, –the edge

Discrete 2-D LoG Function A discrete kernel that approximates this function (for a Gaussian = 1.4) is

shown below.

A discrete domain version of the LOG operator can be obtained by sampling thecontinuous domain impulse response function of Eq. over a window. To avoid deleterious truncation effects, the size of the array should be set such thatW = 3c, or greater, where is the width of the positive center lobe of theLOG function 33

Page 34: EDGE DETECTION 1. Edge Template Gradient Generation Edge gradients are computed in two orthogonal directions, –usually along rows and columns, –the edge

The response of the LoG to a step edge

34

Page 35: EDGE DETECTION 1. Edge Template Gradient Generation Edge gradients are computed in two orthogonal directions, –usually along rows and columns, –the edge

The result of applying a LoG filter with Gaussian   = 1.0. A 7×7 kernel

for display purposes the image has been normalized to the range 0 - 255 35

Page 36: EDGE DETECTION 1. Edge Template Gradient Generation Edge gradients are computed in two orthogonal directions, –usually along rows and columns, –the edge

If a portion of the filtered, or gradient, image is added to the original image, then the result will be to make any edges in the original image much sharper and give them more contrast.

This is commonly used as an enhancement technique in remote sensing applications.

36

Page 37: EDGE DETECTION 1. Edge Template Gradient Generation Edge gradients are computed in two orthogonal directions, –usually along rows and columns, –the edge

Zero Crossing Detector

• Looks for places in the Laplacian of an image where the value of the Laplacian passes through zero.

(i.e. points where the Laplacian changes sign)

• Such points often occur at `edges' in images.

• They also occur at places that are not as easy to associate with edges.

• Zero crossing detector as some sort of – feature detector rather than – as a specific edge detector.

37

Page 38: EDGE DETECTION 1. Edge Template Gradient Generation Edge gradients are computed in two orthogonal directions, –usually along rows and columns, –the edge

Zero Crossing Detector

• The starting point is – an image filtered (Laplacian of Gaussian).

• The results are strongly influenced by the size of the Gaussian

• Increasing the smoothing• fewer and fewer zero crossing contours,

38

Page 39: EDGE DETECTION 1. Edge Template Gradient Generation Edge gradients are computed in two orthogonal directions, –usually along rows and columns, –the edge

LoG filter with Gaussian standard deviation 1.0 The zero crossings

39

Page 40: EDGE DETECTION 1. Edge Template Gradient Generation Edge gradients are computed in two orthogonal directions, –usually along rows and columns, –the edge

LoG filter with Gaussian standard deviation 2.0 The zero crossings

There are far fewer detected crossings, and that those that remain are largely due to recognizable edges in the image

40

Page 41: EDGE DETECTION 1. Edge Template Gradient Generation Edge gradients are computed in two orthogonal directions, –usually along rows and columns, –the edge

LoG filter with Gaussian standard deviation 3.0

Only the strongest contours remain, due to the heavy smoothing

The zero crossings

All edges detected are in the form of closed curves in the same way that contour lines on a map are always closed.

The only exception is where the curve goes off the edge 41

Page 42: EDGE DETECTION 1. Edge Template Gradient Generation Edge gradients are computed in two orthogonal directions, –usually along rows and columns, –the edge

Laplacian zero-crossing patterns.

42