Top Banner
Edges Edges = jumps in brightness/color Brightness jumps marked in white
157

Edges

Feb 23, 2016

Download

Documents

Zach

Edges. Edges = jumps in brightness/color. Brightness jumps marked in white. Edges. Edges = jumps in brightness/color Important! Give object outlines and shapes. Brightness jumps marked in white. Edges. Edges = jumps in brightness/color Important! Give object outlines and shapes - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Edges

Edges• Edges = jumps in brightness/color

Brightness jumps marked in white

Page 2: Edges

Edges• Edges = jumps in brightness/color

• Important!– Give object outlines and shapes

Brightness jumps marked in white

Page 3: Edges

Edges• Edges = jumps in brightness/color

• Important!– Give object outlines and shapes– Relatively robust not so affected by changes in lighting, camera, viewpoint…

Brightness jumps marked in white

Page 4: Edges

Edges not so affected by lighting

Page 5: Edges

Edges not so affected by lighting

Face outline persists, despite very different lighting

Page 6: Edges

What do “edges” look like?B

right

ness

Row number

Brig

htne

ss

Column number

“Jumps” can be gradual or jagged

Page 7: Edges

50 100 150 200 250 300

20

40

60

80

100

120

140

160

180

200

Brightness jumps are not always

obvious when you look at the brightness

profile

Page 8: Edges

Detecting edges

• Want to detect jumps

brightness profiles at a jump (ideally)

Page 9: Edges

Detecting edges

• Want to detect jumps

brightness profiles at a jump (ideally)

Of course should detect jumps inany orientation!

Page 10: Edges

Detecting edges

• Want to detect jumps

brightness profiles at a jump (ideally)

Off course should detect jumps inany orientation!

100 200 300 400 500 600 700 800

50

100

150

200

250

300

350

400

450

500

550

Page 11: Edges

Detecting edges

• Want to detect jumps

• Filters detect themselves

brightness profiles at a jump (ideally)

Eye detection:Convolve with eye filter

Page 12: Edges

Detecting edges

• Want to detect jumps

• Filters detect themselves

To detect jumps, convolve image with jumps

brightness profiles at a jump (ideally)

Eye detection:Convolve with eye filter

Page 13: Edges

• To detect jumps, convolve with jumps

Detecting edges

Page 14: Edges

• To detect jumps, convolve with jumps

• If image has no jump, convolving should give zero (convolving a constant image should give 0)

Filter weights should sum to 0

In equations:

Detecting edges

,,

0 i j consti j

w I ,,

0 i ji j

w

Page 15: Edges

• To detect jumps, convolve with jumps

• Mask weights should sum to 0

• To detect all jumps (dark-to-bright and bright-to-dark)…

Detecting edges

Page 16: Edges

• To detect jumps, convolve with jumps

• Mask weights should sum to 0

• To detect all jumps (dark-to-bright and bright-to-dark)…

Use magnitude (absolute value) of convolution result

Detecting edges

Page 17: Edges

Edge detection• To detect jumps along x

Convolve with [1, -1]• To detect jumps along y

Convolve with 11

Vertical jumpsHorizontal jumpsAfter taking absolute value of convolution result, only jumps stand out as bright spots.

Smooth image regions, where the brightness changes slowly, are dark.

, with [1, 1] *x xI I I 1

, with *1y yI I I

Page 18: Edges

Edge Detection• To “detect edges”, decide how big a jump

must be to qualify– Choose threshold T– If magnitude of convolution is >T at some

pixel, mark it as edge pixel (“edgel”)

Marked (white) pixels have T is about 15% of

xI THorizontal edges

max xI

Page 19: Edges

Edge detection

• How to detect edges in any orientation?

• Answer: compute

remember:

2 2 ,x y x yI I I I

1*

1yI I

[1, 1] *xI I

Page 20: Edges

xI yI

2 2x yI I

Page 21: Edges

2 2x yI I

Edgels: T = 12% of 2 2max x yI I Edgels: T = 25% of 2 2max x yI I

Edgels: T = 6% of 2 2max x yI I

Page 22: Edges

2 2x yI I

Edgels: T = 12% of 2 2max x yI I Edgels: T = 25% of 2 2max x yI I

Edgels: T = 6% of 2 2max x yI I

Higher threshold: cleaner but more fragmented

Page 23: Edges

Edge detection

• Many questions– We’re convolving with [-1 1]

Page 24: Edges

Edge detection

• Many questions– We’re convolving with [-1 1]

(Overall sign isn’t important…)

Page 25: Edges

Edge detection

• Many questions– We’re convolving with [-1 1] = [... 0 0 0 -1 1 0 0 …]

Page 26: Edges

Edge detection

• Many questions– We’re convolving with [-1 1]…

Should we use [-1 -1 -1 -1 1 1 1 1 ] instead?

(This would detect jumps between large bright areas next to large dark areas)

Page 27: Edges

Edge detection

• Many questions– We’re convolving with [-1 1]…

Should we use [-1 -1 -1 -1 1 1 1 1 ] instead?

(This would detect jumps between large bright areas next to large dark areas)

But not so good for

Page 28: Edges

Edge detection

• Many questions– We’re convolving with [-1 1]

– Should we look for smoother, more gradual change?

[-0.02 -0.08 -0.06 0.06 0.08 0.02]

Page 29: Edges

Edge detection

• Many questions– We’re convolving with [-1 1]

– Should we look for smoother, more gradual change?

[-0.02 -0.08 -0.06 0.06 0.08 0.02]Recall smooth brightness profile

for car image edge

Page 30: Edges

Edge detection

• Many questions– We’re convolving with [-1 1]

– To detect long boundary, should we average along it?

Page 31: Edges

Edge detection

• Many questions– We’re convolving with [-1 1]

– To detect long boundary, should we average along it?

0

0 -1 11-101-1

000

13

Detects jumps along x directionaverages over y direction

Page 32: Edges

Edge detection

• Many questions– We’re convolving with [-1 1]

– To detect long boundary, should we average along it?

0

0 -1 11-101-1

000

13

Detects jumps along x directionaverages over y direction

Good for long low contrast boundaries,accurate orientation measurement

Page 33: Edges

Note: edge detection and derivative

Original image:Blurry brightness transition

First derivativederivative has maximumat point of steepest rise

Page 34: Edges

Note: edge detection and derivative

Original image:Blurry brightness transition

First derivativederivative has maximumat point of steepest rise

• To detect fast change in image, compute derivative.

Page 35: Edges

Note: edge detection and derivative

Original image:Blurry brightness transition

First derivativederivative has maximumat point of steepest rise

• To detect fast change, compute derivative. same as convolving with [1 -1] !

Page 36: Edges

Note: edge detection and derivative

Original image:Blurry brightness transition

First derivativederivative has maximumat point of steepest rise

• To detect fast change, compute derivative. same as convolving with [1 -1] !

1[1, 1] * j jjI I I

1 1 2... ...j j j jI I I I

1 1

Page 37: Edges

Note: edge detection and derivative

Original image:Blurry brightness transition

First derivativederivative has maximumat point of steepest rise

• To detect fast change, compute derivative. same as convolving with [1 -1] !

1[1, 1] * j jjI I I

1 1 2... ...j j j jI I I I

1 1 1" "

" " 1j jI IdI

dj j j

Page 38: Edges

Note: edge detection and derivative

Original image:Blurry brightness transition

First derivativederivative has maximumat point of steepest rise

• To detect fast change, compute derivative. same as convolving with [1 -1] !

1[1, 1] * j jjI I I

1 1 2... ...j j j jI I I I

1 1 1" "

" " 1j jI IdI

dj j j

Remember the flip in convolution

Page 39: Edges

Convolution and Derivatives

• Convolving I with [1, -1] gives

• Convolving I with gives

xI

11

yI

Approximatederivativesin x and y

Page 40: Edges

Convolution and Derivatives

• Convolving I with [1, -1] gives

• Convolving I with gives

• Define gradient of I

xI

11

yI

Approximatederivativesin x and y

Page 41: Edges

Convolution and Derivatives

• Convolving I with [1, -1] gives

• Convolving I with gives

• Define gradient of I– From calculus:

xI

11

yI

Approximatederivativesin x and y

, , ,x x yf ff x y f f

y

Page 42: Edges

Convolution and Derivatives

• Convolving I with [1, -1] gives

• Convolving I with gives

• Define gradient of I– From calculus:

– Approximate image gradient

xI

11

yI

Approximatederivativesin x and y

, , ,x x yf ff x y f f

y

, ,x yI i j I I

Page 43: Edges

What is the gradient?

, ( ,0)I I kx y

Change

Page 44: Edges

What is the gradient?

, (0, )I I kx y

Change

Page 45: Edges

What is the gradient?

, ( 1, 2)I I k kx y

More Change

Less Change

Page 46: Edges

What is the gradient?

, ( 1, 2)I I k kx y

More Change

Less Change

Gradient direction is perpendicular to edge

Page 47: Edges

What is the gradient?

, ( 1, 2)I I k kx y

More Change

Less Change

Gradient direction is perpendicular to edge

Gradient Magnitude gives size of brightness jump

Page 48: Edges

Gradient• Brightness change in direction

ˆ t = cos ,sin

x

yt

I I dx I dxt x dt y dt

=Chain rule:

Page 49: Edges

Gradient• Brightness change in direction

ˆ t = cos ,sin

x

yt

I I dx I dxt x dt y dt

=Chain rule: cos sinI I

x y

=

Page 50: Edges

Gradient• Brightness change in direction

ˆ t = cos ,sin

x

yt

I I dx I dxt x dt y dt

=Chain rule: cos sinI I

x y

=

ˆ,I Ix y

= t ˆ = I t

Page 51: Edges

Gradient• Brightness change in direction

ˆ t = cos ,sin

x

yt

I I dx I dxt x dt y dt

=Chain rule: cos sinI I

x y

=

ˆ,I Ix y

= t ˆ = I t

Can compute derivative in any direction from !

Page 52: Edges

Gradient• Brightness change in direction

ˆ t = cos ,sin

x

yt

It

Chain rule:

• Dot product largest for parallel vectors…

ˆ = I t

Page 53: Edges

Gradient• Brightness change in direction

ˆ t = cos ,sin

x

yt

It

Chain rule:

• Dot product largest for parallel vectors, so largest change

ˆ = I t

(largest ) for movement along directionIt

ˆ / t I I

Page 54: Edges

Gradient• Brightness change in direction

ˆ t = cos ,sin

x

yt

It

Chain rule:

• Dot product largest for parallel vectors, so largest change

ˆ = I t

(largest ) for movement along directionIt

ˆ / t I I

I I/ I ISize of this largest change:

Page 55: Edges

Edge detection and gradient

Conclusions

• Detect edges (big brightness jumps) by computing and thresholding

• Image lines perpendicular to

I

I I

Page 56: Edges

But image data is messy!• Brightness profile

• Can we detect jump?

Page 57: Edges

But image data is messy!• Brightness profile

• Can we detect jump?

• Derivative (convolution with [1 -1] )

• Where’s the jump???

Page 58: Edges

• Problem: Brightness fluctuates a lot– Fluctuations are fast (moderate jumps from one pixel to next)

– Often transition at edge is smooth So on edge only moderate brightness jumps between pixels

Edge doesn’t stand out

• Derivative (convolution with [1 -1] )• Brightness profile

Page 59: Edges

• Problem– Fluctuations are fast– Transition at edge is smooth

• Solution– First smooth image to reduce fast fluctuations– Then take derivative

• Brightness profile

Smoothed image

• Derivative (convolution with [1 -1] )

Page 60: Edges

• Brightness profile

Derivative of smoothed image

Edge now stands out.

• Derivative (convolution with [1 -1] )

Page 61: Edges

Smoothed edge detection

• Recommended strategy– Smooth first– Then convolve with “derivative” filters

' * *I D G I

Smoothing filter (e.g., Gaussian)

“derivative” filter (e.g., [1 -1])

image

Page 62: Edges

Smoothed edge detection

• To make more efficient , use associativity of convolution

' * *I D G I

* *D G I“Derivative” of gaussian

D and G are small, convolving them is fast. Also, can just compute once, then apply to many images.

Page 63: Edges

Smoothing and Differentiation• D * G

Derivative of Gaussian filters

Horizontal smoothed derivative Vertical smoothed derivative1

*1G

1, 1 *G

Page 64: Edges

Smoothing and Differentiation• D * G

Derivative of Gaussian filters

Horizontal smoothed derivative Vertical smoothed derivative1

*1G

1, 1 *G Gx

“ ” Gy

“ ”

Page 65: Edges

Other Smoothed Derivative Kernels

– Sobel kernels (more old fashioned)

(These already incorporate smoothing)

– Discrete directional derivatives

-1 0 1

-2 0 2-1 0 1

1 2 1

0 0 0-1 -2 -1

y

x

1 00 1

0 11 0

0 1 2-1 0 1 -2 -1 0

Page 66: Edges

Smoothed gradient

As before, “smoothed gradient” gives “smoothed derivative" in any direction

' ' ' '* , *G GI Ix y

Page 67: Edges

Conclusions

• First smooth, then take derivative

• To get gradient, do this in x & y directions

• To detect edges, threshold magnitude of smoothed gradient

Page 68: Edges

Conclusions

• First smooth, then take derivative

• To get gradient, do this in x & y directions

• To detect edges, threshold magnitude of smoothed gradient

But how much smoothing should you do??Depends, no single answer…

Page 69: Edges

• Amount of smoothing affects semantics of edges

• More smoothing gives: more significant edges, smoother curves, less noise, better detection… but less detail, worse edge localization

1 pixel 3 pixels 7 pixelsDerivatives after smoothing at three different scales

Page 70: Edges
Page 71: Edges

Smoothing + localization

• More smoothing makes it harder to tell exactly where edges are located.

Page 72: Edges

But median filter?

Page 73: Edges
Page 74: Edges

Threshold

• What should the threshold be?

Page 75: Edges

Threshold

• What should the threshold be?– No single answer– Also depends on the amount of smoothing

Page 76: Edges

Threshold

• What should the threshold be?– No single answer– Also depends on the amount of smoothing

• Smoothing reduces amount of change

Original image (1D)

Smoothed image

Page 77: Edges

Threshold

• What should the threshold be?– No single answer– Also depends on the amount of smoothing

• Smoothing reduces amount of change

Original image (1D)

Smoothed image

Note: transition blurs,Slope decreases

Page 78: Edges

Threshold

• More smoothing smaller derivative sizes Gradient magnitude shrinks

Original image I (1D)0 10 20 30 40 50 60

0.006

0.007

0.008

0.009

0.01

0.011

0.012

0.013

0.014

Amount of smoothing(standard deviation of Gaussian)

max *xG Ix

Page 79: Edges

Threshold

• More smoothing smaller derivative sizes Gradient magnitude shrinks

Original image I (1D)0 10 20 30 40 50 60

0.006

0.007

0.008

0.009

0.01

0.011

0.012

0.013

0.014

Amount of smoothing(standard deviation of Gaussian)

max *xG Ix

Gradient size measured on the edge

Page 80: Edges

Threshold

• Conclusion– For more smoothing, use lower threshold

Page 81: Edges
Page 82: Edges

fine scalehigh threshold

Page 83: Edges

coarse scale,high threshold

Using same threshold as before causes loss of detail

Page 84: Edges

coarsescalelowthreshold

Page 85: Edges

Origin of Edges

• Edges are caused by a variety of factors

depth discontinuity

surface color discontinuity

illumination discontinuity

surface normal discontinuity

Page 86: Edges

Surface Boundaries

Page 87: Edges

Sharp surface angles(normal discontinuity)

Page 88: Edges

Change in material properties

Page 89: Edges

Boundaries of lighting

shadow

Page 90: Edges

Edge Detection Issues:

1) What smoothing scale (ie, width of Gaussian) + threshold on ?

2) Identify true edge points? Usually > threshold along fat sausage containing true edge line

3) We are really interested in finding curves (that could outline an object) How to link detected edge pixels into curves?

| I|

| I | at two different scales

| I |

Page 91: Edges

Edge detection so far

1. Filter out noise Smooth with 2D Gaussian

2. Take derivative

change.fastest ofdirection theis

changes imagefast how tells

Gradient theis ,),(

22

JJ

JJJ

yJ

xJJJJ

yx

yx

IGJ

Page 92: Edges

Edge detection so far

3. Find edges by thresholding J

Page 93: Edges

Finding the Peak above threshold on fat “sausage,” not a line

Want to thin “sausage” of edge pixels to single curve

Technique used is called Non Maximum Suppression

I

Page 94: Edges

We wish to mark a curve within the sausage where the magnitude is biggest. We can do this by looking for a maximum along a slice normal to the curve (non-maximum suppression). These points should form a curve.

Page 95: Edges

Non-maximumsuppression

At q, we have a maximum if the value is larger than those at both p and at r. Interpolate to get these values.

Page 96: Edges

Edge Following

3) Link edge points into curves?

Page 97: Edges

Hysteresis

• Drop-outs? – High threshold to start curves– Low threshold to continue.

Page 98: Edges
Page 99: Edges
Page 100: Edges

longer edge curves!

Page 101: Edges

Canny in MATLAB

E = edge(Image,’canny’); or

E = edge(Image,’canny’,Threshold, );

We still have to choose the smoothing scale and the threshold. By default, MATLAB takes .If you don’t provide the threshold, it tries to estimate a reasonable one.

1

Page 102: Edges

Effect of (for Gaussian smoothing)

Canny with Canny with original

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

Page 103: Edges
Page 104: Edges

The Canny edge detector

• original image (Lena)

Page 105: Edges

The Canny edge detector

• norm of the gradient

Page 106: Edges

The Canny edge detector

• thresholding

Page 107: Edges

The Canny edge detector

• thinning• (non-maximum suppression)

Page 108: Edges

Derivative filters: technicalities

• We use “derivative filters” to detect edges

• But images are really continuous functions

• Derivative filter should give good approximation to continuous derivative of original continuous image

Page 109: Edges

Discrete Derivatives (1D)• Let = pixel size.

• Convolving I with gives

• Relate to continuous derivative by Taylor expansion

I x I x 1,1

2 2

2 ...2

dI d II x I xdx dx

I x I x dI Odx

Page 110: Edges

Discrete Derivatives (1D)• Better to use odd size kernel!

• For size 3, need

Solve for derivative by subtracting…

, ,I x I x I x

2

...2x xxI x I x I I

2

...2x xxI x I x I I

xI

2

2 x

I x I xI O

Page 111: Edges

Discrete Derivatives (1D)• Better to use odd size kernel!

• For size 3, need

Solve for derivative by subtracting…

, ,I x I x I x

2

...2x xxI x I x I I

2

...2x xxI x I x I I

xI

2

2 x

I x I xI O

Derivative filter [-1/2 0 1/2]

Page 112: Edges

Discrete Derivatives (1D)• Better to use odd size kernel!

• For size 3, need

Solve for derivative by subtracting…

, ,I x I x I x

2

...2x xxI x I x I I

2

...2x xxI x I x I I

xI

2

2 x

I x I xI O

Derivative filter [-1/2 0 1/2]

Now no O( ).Better approximationto derivative

These even terms cancelled in the expression for xI

xI

Page 113: Edges

Message

• Use odd size filters (length 3, 5, …)

Page 114: Edges

Second Derivative (1D) (size 3, need )

2

...2x xxI x I x I I

2

...2x xxI x I x I I

, ,I x I x I x

Page 115: Edges

Second Derivative (1D) (size 3, need )

2

2

...2x xxI x I x I I

22

2xx

I x I x I xI O

, ,I x I x I x

Add, divide through by

2

...2x xxI x I x I I

Page 116: Edges

Second Derivative (1D) (size 3, need )

2nd derivative filter [1 -2 1]

No O( )since sumcancels odd powers of

2

...2x xxI x I x I I

2

...2x xxI x I x I I

22xx

I x I x I xI O

, ,I x I x I x

Page 117: Edges

Discrete Derivative (1D)

Convolution filters (remember: flipped from correlation)

• First derivative: [1/2 0 -1/2]• Second derivative: [1 -2 1]

Note: [1 -2 1] = [1 -1] * [1 -1]

first derivative filter

Page 118: Edges

Discrete Derivative (1D)

Convolution filters (remember: flipped from correlation)

• First derivative: [1/2 0 -1/2]• Second derivative: [1 -2 1]

Note: [1 -2 1] = [1 -1] * [1 -1]

As usual, can compute “second derivative” of an image by taking two first “derivatives”…

Page 119: Edges

Discrete Derivative (1D)

Convolution filters (remember: flipped from correlation)

• First derivative: [1/2 0 -1/2]• Second derivative: [1 -2 1]

Note: [1 -2 1] = [1 -1] * [1 -1] First “derivative” filters, eg [-1 1]

As usual, can compute “second derivative” of an image by taking two first “derivatives”…

Second “derivative” filter

2

2

` ' ` '* *d I d d Idx dx dx

` ' ` '* *d d Idx dx

Page 120: Edges

Discrete Derivative (1D)(size 5)

• For bigger filters, taylor expand to higher order

First derivative filter (size 5): 1 2 2 1012 3 3 12

Page 121: Edges

Second derivative filters

Page 122: Edges

Second derivative filters

• is the Laplacian

Gaussian Derivative of Gaussian

Example of 2nd derivative filter:

Laplacian of Gaussian

2 2

2 2

1, exp2 2

x yG x y

Gx

2G

Page 123: Edges

Second derivative filters

• is the Laplacian12 *

1f

1 2 1 * f

Gaussian Derivative of Gaussian

Example of 2nd derivative filter:

Laplacian of Gaussian

2 2

2 2

1, exp2 2

x yG x y

Gx

2G

Approximate 2nd derivs

Page 124: Edges

Second derivative filters

• is the Laplacian12 *

1f

1 2 1 * f 0 1 01 4 1 *0 1 0

f

Gaussian Derivative of Gaussian

Example of 2nd derivative filter:

Laplacian of Gaussian

2 2

2 2

1, exp2 2

x yG x y

Gx

2G

Page 125: Edges

Second derivative filters

• is the Laplacian12 *

1f

1 2 1 * f 0 1 01 4 1 *0 1 0

f

Gaussian Derivative of Gaussian

Example of 2nd derivative filter:

Laplacian of Gaussian

Can approximate Laplacian of an image(or a Gaussian) by convolving with this filter

2 2

2 2

1, exp2 2

x yG x y

Gx

2G

Page 126: Edges

2nd Derivative Filters

• Note: can also use these to detect edges

Image

First derivative

2nd derivative

Page 127: Edges

2nd Derivative Filters

• Note: can also use these to detect edges

Image

First derivative

2nd derivative

Edge is inflection point:2nd derivative = 0

Page 128: Edges

2nd Derivative Filters

• Note: can also use these to detect edges

• Can detect edges from zeros of 2nd derivative

Image

First derivative

2nd derivative

Edge is inflection point:2nd derivative = 0

Page 129: Edges

Using 2nd Derivative Filters

• For 2D images, can use Laplacian-of-Gaussian to detect edges

Laplacian of Gaussian

2G

Page 130: Edges

Laplacian

• at a pixel pixel darker than average of its neighbors

0 1 01 4 1 *0 1 0

I

2I2 0I

Page 131: Edges

Laplacian

• at a pixel pixel darker than average of its neighbors

0 1 01 4 1 *0 1 0

I

2I2 0I

Image I

Page 132: Edges

Laplacian

• at a pixel pixel darker than average of its neighbors

0 1 01 4 1 *0 1 0

I

2I2 0I

I

y

xEdge boundary between bright anddark regions

Bright region

Dark region

surface plot of IImage I

Page 133: Edges

Laplacian

• at a pixel pixel darker than average of its neighbors

0 1 01 4 1 *0 1 0

I

2I

I

y

xEdge boundary between bright anddark regions

Bright region

Dark region

surface plot of IImage I

Pixels brighterthan neighbors

2 0I

2 0I

Page 134: Edges

Laplacian

• at a pixel pixel darker than average of its neighbors

0 1 01 4 1 *0 1 0

I

2I

I

y

xEdge boundary between bright anddark regions

Bright region

Dark region

surface plot of IImage I

Pixels darkerthan neighbors

2 0I

2 0I

Page 135: Edges

Laplacian

• at a pixel pixel darker than average of its neighbors

0 1 01 4 1 *0 1 0

I

2I

I

y

xEdge boundary between bright anddark regions

Bright region

Dark region

surface plot of IImage I

On edge

2 0I

2 0I

Page 136: Edges

Using 2nd Derivative Filters

• For 2D images, can find edges by:

– Convolve image with a Laplacian-of-Gaussian (ie, compute Laplacian of smoothed image)

– Mark zero pixels (in practice, mark pixels on boundary between ‘+’ and ‘–’ regions)

• Since region boundaries are continuous curves, this always marks continuous curves!

Page 137: Edges

Using 2nd Derivative Filters

• For 2D images, can find edges by:

– Convolve image with a Laplacian-of-Gaussian (ie, compute Laplacian of smoothed image)

– Mark zero pixels (in practice, mark pixels on boundary between ‘+’ and ‘–’ regions)

• Since region boundaries are continuous curves, this always marks continuous curves!Not so

good in practice

Page 138: Edges

Laplacian

• at a pixel pixel darker than average of its neighbors

• Edge detection: strategy 2

0 1 01 4 1 *0 1 0

I

2I2 0I

Page 139: Edges

Laplacian

• at a pixel pixel darker than average of its neighbors

• Edge detection: strategy 2– When image is smooth, pixels have brightness similar to their

neighbors and is small.

– Near edges, I changes rapidly and can be big.

0 1 01 4 1 *0 1 0

I

2I2 0I

2I

2I

Page 140: Edges

Laplacian

• at a pixel pixel darker than average of its neighbors

• Edge detection: strategy 2– When image is smooth, pixels have brightness similar to their

neighbors and is small.

– Near edges, I changes rapidly and can be big.

So look for pixels where is large.

0 1 01 4 1 *0 1 0

I

2I2 0I

2I

2I

2I

Page 141: Edges

Laplacian

• at a pixel pixel darker than average of its neighbors

• Edge detection: strategy 2– When image is smooth, pixels have brightness similar to their

neighbors and is small.

– Near edges, I changes rapidly and can be big.

So look for pixels where is large.

(But this doesn’t get the position of the edge right…)

0 1 01 4 1 *0 1 0

I

2I2 0I

2I

2I

2I

Page 142: Edges

2I

Laplacian

• at a pixel pixel darker than average of its neighbors

0 1 01 4 1 *0 1 0

I

2I2 0I

I

y

xEdge boundary between bright anddark regions

Bright region

Dark region

surface plot of IImage I

Largest values forwhere surface most curved

Page 143: Edges

Laplacian of Gaussian

Laplacian of Gaussian

Gaussian Smaller Gaussian

Page 144: Edges

Laplacian of Gaussian

• Why?

Page 145: Edges

Laplacian of Gaussian

• Why?

2

0 1 01 4 1 *0 1 0

G G

Page 146: Edges

Laplacian of Gaussian

• Why?

2

0 1 0 0 1/ 4 01 4 1 * 4 1/ 4 0 1/ 4 *0 1 0 0 1/ 4 0

G G G G

Page 147: Edges

Laplacian of Gaussian

• Why?

2

0 1 0 0 1/ 4 01 4 1 * 4 1/ 4 0 1/ 4 *0 1 0 0 1/ 4 0

G G G G

Convolution of an averaging filter with a Gaussian(which is another averaging filter)

Page 148: Edges

Laplacian of Gaussian

• Why?

2

0 1 0 0 1/ 4 01 4 1 * 4 1/ 4 0 1/ 4 *0 1 0 0 1/ 4 0

G G G G

Convolution of an averaging filter with a Gaussian(which is another averaging filter)

Averaging twice is still averaging….So roughly the same as convolving with a single, bigger Gaussian

Page 149: Edges

Caution:Derivatives are noisy

Higher derivatives are noisier

First derivative: black2nd derivative: red

Page 150: Edges

Caution:Derivatives are noisy

Higher derivatives are noisier

Why?

Page 151: Edges

Caution:Derivatives are noisy

Higher derivatives are noisier

Why?

Original signalI

fluctuations

Page 152: Edges

Caution:Derivatives are noisy

Higher derivatives are noisier

Why?

Original signal

Correlate with [-1 1]

I

I’

fluctuations

Fluctuationsdouble in size

Page 153: Edges

Caution:Derivatives are noisy

Higher derivatives are noisier

Why?

Original signal

Correlate with [-1 1]

Correlate again with [-1 1](2nd derivative)

I

I’

fluctuations

Fluctuationsdouble in size

I’’ Fluctuationsquadruple

Page 154: Edges

Oriented Gaussian smoothing

Page 155: Edges
Page 156: Edges
Page 157: Edges