126
ME5286 – Lecture 7 Lecture 7: Most Common Edge Detectors Saad Bedros [email protected] #1

Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

  • Upload
    others

  • View
    12

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Lecture 7: Most Common Edge Detectors

Saad [email protected]

#1

Page 2: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Edge Detection• Goal: Identify sudden

changes (discontinuities) in an image– Intuitively, most semantic and

shape information from the image can be encoded in the edges

– More compact than pixels

• Ideal: artist’s line drawing (but artist is also using object-level knowledge)

Source: D. Lowe

Page 3: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Gradient Visualization#3

Page 4: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Designing an edge detector• Criteria for a good edge detector:

– Good detection: the optimal detector should find all real edges, ignoring noise or other artifacts

– Good localization• the edges detected must be as close as possible to the

true edges• the detector must return one point only for each true

edge point• Cues of edge detection

– Differences in color, intensity, or texture across the boundary

– Continuity and closure– High-level knowledge

Source: L. Fei-Fei

Page 5: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Edge Detection Using Derivative• Image first and second derivatives are a good

first level Edge Detectors: Convolution …

Image I[ ]11* −= II x

#5

Page 6: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Edge Detection Using Derivative• Image derivatives:

[ ]11* −= II x

−=

11

*II y

Image I

#6

Page 7: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Derivatives and Noise• Derivatives are strongly affected by noise

– obvious reason: image noise results in pixels that look very different from their neighbors

– The larger the noise - the stronger the response• What is to be done?

– Neighboring pixels look alike– Pixel along an edge look alike– Image smoothing should help – Force pixels different to their neighbors (possibly noise) to

look like neighbors

#7

Page 8: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Derivatives and Noise

Increasing noise

– Need to perform image smoothing as a preliminary step– Generally – use Gaussian smoothing

#8

Page 9: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Edge Detection & Image Noisei.i.d ),0(~)( )()(ˆ)( σNxNxNxIxI +=

)()('ˆ

))1( - )1(())1(ˆ)1(ˆ(

))1()1(ˆ( - )1()1(ˆ)('

xNxI d

xNxNxIxI

xNxIxNxIxI

−++−−+=

=−+−+++≅

=))(( xNE d 0

Taking differences:

Output noise:

=))(( 2 xNE d =−++−++ ))1()1(2)1()1(( 22 xNxNxNxNE222 20 σσσ =++=

Increases noise !!

#9

Page 10: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Effects of noise• Consider a single row or column of the image

– Plotting intensity as a function of position gives a signal

• Where is the edge?

#10

Page 11: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

• Where is the edge?

Solution: smooth first#11

Page 12: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Derivative theorem of convolution

• This saves us one operation:

#12

Page 13: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Edge Detection Methods

• Gradient operators– Roberts– Prewitt– Sobel

• Gradient of Gaussian (Canny)• Laplacian of Gaussian (Marr-Hildreth)• Facet Model Based Edge Detector (Haralick)

Most Common Edge Detectors: #13

Page 14: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Edge Detection Using the Gradient• Definition of the gradient:

• To save computations, the magnitude of gradient is usually approximated by:

#14

Page 15: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Edge Detection Using the Gradient• 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

• Main idea:– Compute derivatives in x and y directions– Find gradient magnitude– Threshold gradient magnitude

#15

Page 16: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Edge Detection Using the Gradient• Estimating the gradient with finite differences

– Approximation by finite differences:

#16

Page 17: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Edge Detection Using the Gradient• Example:

– Suppose we want to approximate the gradient magnitude at z5

• We can implement ∂I/∂x and ∂I/∂y using the following masks:

Note: Mx is the approximation at (i, j + 1/2) and My is the approximation at (i + 1/2, j)

#17

Page 18: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Edge Detection Steps Using Gradient

(i.e., sqrt is costly!)

Page 19: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Edge Detection Using the Gradient• Example:

Idxd

Idyd

#19

Page 20: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Edge Detection Using the Gradient• Example – cont.:

22

+

=∆ I

dydI

dxd

#20

Page 21: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Edge Detection Using the Gradient• Example – cont.:

100=≥∆ Threshold

#21

Page 22: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Roberts Edge Detector There are two forms of the Roberts Edge

Detector:

1. The

2. The

The second form of the equation is often used in practice due to its computational efficiency

#22

Page 23: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Robert Edge Detection• The Roberts edge detector

• This approximation can be implemented by the following masks:

Note: Mx and My are approximations at (i + 1/2, j + 1/2)

#23

Page 24: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Roberts Edge Detector• A simple approximation to the first

derivative • Marks edge points only; it does not return

any information about the edge orientation

• Simplest of the edge detection operators and will work best with binary images

#24

Page 25: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Approximation of First Derivative

• Consider the arrangement of pixels about the pixel (i, j):

• The partial derivatives can be computed by:

• The constant c implies the emphasis given to pixels closer to the center of the mask.

3 x 3 neighborhood:

Page 26: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Prewitt Operator

• Setting c = 1, we get the Prewitt operator:

Page 27: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Sobel Operator

• Setting c = 2, we get the Sobel operator:

Page 28: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Sobel and Prewitt Detectors

Approximates the gradient by using a row and a column mask, which approximates the first derivative in each direction

The Prewitt and Sobel edge detection masks find edges in both the horizontal and vertical directions, and then combine this information into a single metric

#28

Page 29: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Sobel vs Prewitt

• The Prewitt is simpler to calculate than the Sobel, since the only coefficients are 1’s, which makes it easier to implement in hardware

• However, the Sobel is defined to place emphasis on the pixels closer to the mask center, which may be desirable for some applications

#29

Page 30: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Edge Detection Using the Gradient#30

Page 31: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Edge Detection Using the Gradient#31

Page 32: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Isotropy#32

Page 33: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Edge Detection with Gradient Filters#33

Page 34: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Edge Detection Using the Gradient• Isotropic property of gradient magnitude:

– The magnitude of gradient is an isotropic operator (it detects edges in any direction !!)

#34

Page 35: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Other Steps in Edge Detection• Practical issues:– Differential masks act as high-pass filters – tend to amplify noise.– Reduce the effects of noise - first smooth with a low-pass filter.

1) The noise suppression-localization tradeoff– a larger filter reduces noise, but worsens localization (i.e., it

adds uncertainty to the location of the edge) and vice-versa.

#35

Page 36: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Noise Suppression vs Localization

• Noise suppression-localization tradeoff.– Smoothing depends on mask size (e.g., depends

on σ for Gaussian filters).– Larger mask sizes reduce noise, but worsen

localization (i.e., add uncertainty to the location of the edge) and vice versa.

larger masksmaller mask

Page 37: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Other Steps in Edge Detection2) How should we choose the threshold? #37

Page 38: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Other Steps in Edge Detection3) Edge thinning and linking

– required to obtain good contours

#38

Page 39: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Factors in Edge Detection• Examples:

True edge

Poor robustness to noise

Poorlocalization

Too manyresponses

#39

Page 40: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Criteria for Optimal Edge Detection

• (1) Good detection– Minimize the probability of false positives (i.e., spurious edges).– Minimize the probability of false negatives (i.e., missing real

edges).

• (2) Good localization– Detected edges must be as close as possible to the true edges.

• (3) Single response– Minimize the number of local maxima around the true edge.

( one point for the true edge )

Page 41: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Choice of Threshold• Trade off of threshold value.

gradient magnitude

low threshold high threshold

Page 42: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Standard thresholding• Standard thresholding:

- Can only select “strong” edges.- Does not guarantee “continuity”.

gradient magnitude low threshold high threshold

Page 43: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Hysteresis thresholding

• Hysteresis thresholding uses two thresholds:

• For “maybe” edges, decide on the edge if neighboringpixel is a strong edge.

- low threshold tl- high threshold th (usually, th = 2tl)

tltl

th

th

Page 44: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Hysteresis Thresholding Example#44

Page 45: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Edge Localization#45

Page 46: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Single Response #46

Page 47: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Canny edge detector• This is probably the most widely used edge

detector in computer vision• Theoretical model: step-edges corrupted by

additive Gaussian noise• Canny has shown that the first derivative of

the Gaussian closely approximates the operator that optimizes the product of signal-to-noise ratio and localization

J. Canny, A Computational Approach To Edge Detection, IEEE Trans. Pattern Analysis and Machine Intelligence, 8:679-714, 1986.

Source: L. Fei-Fei

http://dasl.mem.drexel.edu/alumni/bGreen/www.pages.drexel.edu/_weg22/can_tut.html

Page 48: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Canny edge detector1. Filter image with x, y derivatives of Gaussian 2. Find magnitude and orientation of gradient3. Non-maximum suppression:

– Thin multi-pixel wide “ridges” down to single pixel width

4. Thresholding and linking (hysteresis):– Define two thresholds: low and high– Use the high threshold to start edge curves and the low

threshold to continue them

Source: D. Lowe, L. Fei-Fei

Page 49: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

The Canny Edge Detector#49

Page 50: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

The Canny Edge Detector• The derivative of the Gaussian:

),( yxg

),( yxgx

),( yxg y

#50

Page 51: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

The Canny Edge Detector• Canny – smoothing and derivatives:

xf

yf

f

#51

Page 52: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

The Canny Edge Detector• Canny – gradient magnitude:

image gradient magnitude

#52

Page 53: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Edge Detection• Canny – Non-maxima suppression:

gradient magnitude thinned

#53

Page 54: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Edge Detection• Canny – Hysteresis thresholding / Edge linking

25regular=t

15 35

Hysteresis

==

LowHigh

thinned

#54

Page 55: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Edge Detection#55

Page 56: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Edge Detection• Hysteresis thresholding / Edge linking – cont.

– The algorithm performs edge linking as a by-product of double-thresholding !!

#56

Page 57: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Edge Detection#57

Page 58: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Properties of Canny Edge Detection#58

Page 59: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

The Canny edge detector

• original image (Lena)

Page 60: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Compute Gradients

X-Derivative of Gaussian Y-Derivative of Gaussian Gradient Magnitude

Page 61: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

The Canny edge detector

thresholding

Page 62: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Get Orientation at Each Pixel

theta = atan2(-gy, gx)

Page 63: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

The Canny edge detector

Page 64: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Canny Edges

Page 65: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Effect of σ (Gaussian kernel spread/size)

Canny with Canny with original

The choice of depends on desired behavior• large detects large scale edges• small detects fine features

Page 66: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

An edge is not a line...

How can we detect lines ? Next Lectures

Page 67: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Canny Edge Detection: Approximation#67

Page 68: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Fast Approximation of Canny Edge#68

Page 69: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

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.

• Non-maxima suppression #69

Page 70: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

No-maxima Suppression : Example#70

Page 71: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

No-Maxima Suppression Explanation#71

Page 72: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Edge Detection• Non-maxima suppression – cont. #72

Page 73: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Edge Detection• Non-maxima suppression – cont.

– What are the neighbors?• Look along gradient normal

– Quantization of normal directions:

0

12

3

41420tan41422-:3

41422|tan|:2

41422tan41420:1

41420tan41420:0:onQuantizati

.θ.

.θ.

.θ.-

−≤<

<<

≤<

directiongradientθ =tan

#73

Page 74: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Non-maximum suppression

• Check if pixel is local maximum along gradient direction

Page 75: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

No-Maxima Suppression#75

Page 76: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Before Non-max Suppression

Page 77: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

After non-max suppression

Page 78: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Hysteresis Thresholding#80

Page 79: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Edge Detection

– 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).

• Hysteresis thresholding / Edge linking

– A more effective scheme is to use two thresholds:• a low threshold tl

• a high threshold th

• usually, th ≈ 2tl

#81

Page 80: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Hysteresis Thresholding: Algorithm#82

Page 81: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Principle of Hysteresis Thresholding#83

Page 82: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Hysteresis thresholding

• Threshold at low/high levels to get weak/strong edge pixels

• Do connected components, starting from strong edge pixels

Page 83: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Final Canny Edges

Page 84: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

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

crossings of the second derivative.

• There are two operators in 2D that correspond to the second derivative:– Laplacian– Second directional derivative

#87

Page 85: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Edge Detection Using the 2nd Derivative

Page 86: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Edge Detection Using the 2nd Derivative• The Laplacian: #89

Page 87: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Edge Detection Using the 2nd Derivative• Example:

• The Laplacian can be implemented using the mask:

• Example:

#90

Page 88: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Variations of Laplacian

Page 89: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Edge Detection Using the 2nd 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

zero-crossing.– Repeat above step along each column

#92

Page 90: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Edge Detection Using the 2nd 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

#93

Page 91: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Laplacian of Gaussian (LoG)• Look for zero-crossings of:

Laplacian of Gaussianoperator

#94

Page 92: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Laplacian of Gaussian (LoG)(Marr-Hildreth operator)

• To reduce the noise effect, the image is first smoothed. • When the filter chosen is a Gaussian, we call it the LoG

edge detector.

• It can be shown that:

σ controls smoothing

2σ2

(inverted LoG)

Page 93: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

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

– It can be shown that:

2

22

24

2222 2),( σ

σσ yx

eyxyxG+

−+=∇

),(),()],(),([ 22 yxfyxGyxGyxf ∗∇=∗∇

#96

Page 94: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

LoG#97

Page 95: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Laplacian of Gaussian (LoG) -Example

filtering zero-crossings

(inverted LoG)(inverted LoG)

Page 96: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

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

( )GI 2* ∆I

)(*I of crossings Zero 2G∆

#99

Page 97: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

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

1=σ

6=σ

3=σ

#100

Page 98: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Gradient vs LoG• 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.step edge

ramp edge

Page 99: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

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

– Does not handle corners well#102

Page 100: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Difference of Gaussians (DoG)• The Laplacian of Gaussian can be approximated by the

difference between two Gaussian functions:

approximationactual LoG

Page 101: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Difference of Gaussians (DoG) (cont’d)

(a) (b) (b)-(a)

Page 102: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Edge Detection Using the 2nd Derivative• Separability

Image

gxx(x) g(x)

gyy(y) g(y)

+ gI 2*∆

Image g(x) g(y) + gI ∗

Gaussian Filtering

Laplacian-of-Gaussian Filtering

#105

Page 103: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Edge Detection Using the 2nd Derivative• Separability

– Gaussian:• A 2-D Gaussian can be separated into two 1-D Gaussians• Perform 2 convolutions with 1-D Gaussians

),(*),(),( yxgyxIyxh =

( ) )(*)(*),(),( 21 ygxgyxIyxh =

n2 multiplications per pixel

2n multiplications per pixel

[ ]011.13.6.16.13.011.1 =g

=

011.13.6.16.13.011.

2g

#106

Page 104: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Edge Detection Using the 2nd Derivative• Separability

– Laplacian-of-Gaussian:

Requires n2 multiplications per pixel

( ) ( ) ( )gIIgIgS 2222 *** ∆=∆=∆=∆

( ) ( ) )()()()(2 ygygIxgxgIS yyxx ∗∗+∗∗=∆

Requires 4n multiplications per pixel

#107

Page 105: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

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

– Compute LoG• Use one 2D filter:• Use four 1D filters:

– Find zero-crossings from each row and column– Find slope of zero-crossings– Apply threshold to slope and mark edges

),(2 yxg∆)(),(),(),( ygygxgxg yyxx

#108

Page 106: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

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

– Does not handle corners well– Why?

The derivative of the Gaussian: The Laplacian of the Gaussian:(unoriented)

#109

Page 107: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

OTHER EDGE DETECTORS#110

Page 108: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Directional Derivative

• The partial derivatives of f(x,y) will give the slope ∂f/∂x in the positive x direction and the slope ∂f /∂y in the positive y direction.

• We can generalize the partial derivatives to calculate the slope in any direction (i.e., directional derivative).

f∇

Page 109: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Directional Derivative (cont’d)

• Directional derivative computes intensity changes in a specified direction.

Compute derivative in direction u

Page 110: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Directional Derivative (cont’d)

+ =

Directional derivative is a

linear combination of

partial derivatives.

(From vector calculus)

Page 111: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Directional Derivative (cont’d)

+ =cosθ sinθ

cos , sin yx uuu u

θ θ= = cos , sinx yu uθ θ= =||u||=1

Page 112: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

• Compass Masks:

The Kirsch and Robinson edge detection masks are called compass masks since they are defined by taking a single mask and rotating it to the eight major compass orientations: North, Northwest, West, Southwest, South, Southeast, East, and Northeast

#115

Page 113: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

The edge magnitude is defined as the maximum value found by the convolution of each of the masks with the image

The edge direction is defined by the mask that produces the maximum magnitude

Any of the edge detection masks can be extended by rotating them in a manner like the compass masks, which allows us to extract explicit information about edges in any direction

#116

Page 114: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

The Kirsch-Robinson masks are as follows: #117

Page 115: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Facet Model Based Edge Detector (Haralick)• Assumes that an image is an array of samples of

a continuous function f(x,y).• Reconstructs f(x,y) from sampled pixel values.• Uses directional derivatives which are

computed analytically (i.e., without using discrete approximations).

z=f(x,y)

Page 116: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Facet Model

• For complex images, f(x,y) could contain extremely high powers of x and y.

• Idea: model f(x,y) as a piece-wise function.

• Approximate each pixel value by fitting a bi-cubic polynomial in a small neighborhood around the pixel (facet).

Page 117: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Facet ModelSteps

(1) Fit a bi-cubic polynomial to a small neighborhood of each pixel (this step provides smoothing too).

(2) Compute (analytically) the second and third directional derivatives in the direction of gradient.

(3) Find points where (i) the second derivative is equal to zero and (ii) the third derivative is negative.

Page 118: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Fitting bi-cubic polynomial

• If a 5 x 5 neighborhood is used, the masks below can be used to compute the coefficients.– Equivalent to least-squares (e.g., SVD)

Page 119: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Analytic computations of second and third directional derivatives

• Using polar coordinates

Page 120: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Compute analytically second and third directional derivatives

• Gradient angle θ (with positive y-axis at (0,0)):

Locally approximate surface by a plane and use the normalto the plane to approximatethe gradient.

Page 121: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Computing directional derivatives (cont’d)

• The derivatives can be computed as follows:

Second derivative equalto zero implies:

Third derivativenegative implies:

Page 122: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Edge Detection Using Facet Model (cont’d)

Steps

Page 123: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Edge Detection Review

• Edge detection operators are based on the idea that edge information in an image is found by looking at the relationship a pixel has with its neighbors

• If a pixel's gray level value is similar to those around it, there is probably not an edge at that point

#126

Page 124: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Edge Detection Review

• Edge detection operators are often implemented with convolution masks and most are based on discrete approximations to differential operators

• Differential operations measure the rate of change in a function, in this case, the image brightness function

#127

Page 125: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Edge Detection Review• Preprocessing of image is required to eliminate or

at least minimize noise effects• There is tradeoff between sensitivity and accuracy

in edge detection • The parameters that we can set so that edge

detector is sensitive include the size of the edge detection mask and the value of the gray level threshold

• A larger mask or a higher gray level threshold will tend to reduce noise effects, but may result in a loss of valid edge points

#128

Page 126: Lecture 7: Most Common Edge Detectorsdept.me.umn.edu/.../Notes/2015/ME5286-Lecture7.pdf · ME5286 – Lecture 7 Designing an edge detector • Criteria for a good edge detector: –

ME5286 – Lecture 7

Summary of Edge Detectors#129