ee 4780 edge detection. bahadir k. gunturk2 detection of discontinuities matched filter example...

30
EE 4780 Edge Detection

Upload: robyn-freeman

Post on 14-Dec-2015

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: EE 4780 Edge Detection. Bahadir K. Gunturk2 Detection of Discontinuities Matched Filter Example >> a=[0 0 0 0 1 2 3 0 0 0 0 2 2 2 0 0 0 0 1 2 -2 -1 0

EE 4780

Edge Detection

Page 2: EE 4780 Edge Detection. Bahadir K. Gunturk2 Detection of Discontinuities Matched Filter Example >> a=[0 0 0 0 1 2 3 0 0 0 0 2 2 2 0 0 0 0 1 2 -2 -1 0

Bahadir K. Gunturk 2

Detection of Discontinuities

Matched Filter Example>> a=[0 0 0 0 1 2 3 0 0 0 0 2 2 2 0 0 0 0 1 2 -2 -1 0 0 0 0];

>> figure; plot(a);

>> h1 = [-1 -2 2 1]/10;

>> b1 = conv(a,h1); figure; plot(b1);

Page 3: EE 4780 Edge Detection. Bahadir K. Gunturk2 Detection of Discontinuities Matched Filter Example >> a=[0 0 0 0 1 2 3 0 0 0 0 2 2 2 0 0 0 0 1 2 -2 -1 0

Bahadir K. Gunturk 3

Detection of Discontinuities

Point Detection Example: Apply a high-pass filter. A point is detected if the response is larger than a positive

threshold.

The idea is that the gray level of an isolated point will be quite different from the gray level of its neighbors.

| |R T

Threshold

Page 4: EE 4780 Edge Detection. Bahadir K. Gunturk2 Detection of Discontinuities Matched Filter Example >> a=[0 0 0 0 1 2 3 0 0 0 0 2 2 2 0 0 0 0 1 2 -2 -1 0

Bahadir K. Gunturk 4

Detection of Discontinuities

Point Detection

Detected point

Page 5: EE 4780 Edge Detection. Bahadir K. Gunturk2 Detection of Discontinuities Matched Filter Example >> a=[0 0 0 0 1 2 3 0 0 0 0 2 2 2 0 0 0 0 1 2 -2 -1 0

Bahadir K. Gunturk 5

Detection of Discontinuities

Line Detection Example:

1R 2R 3R 4R

Page 6: EE 4780 Edge Detection. Bahadir K. Gunturk2 Detection of Discontinuities Matched Filter Example >> a=[0 0 0 0 1 2 3 0 0 0 0 2 2 2 0 0 0 0 1 2 -2 -1 0

Bahadir K. Gunturk 6

Detection of Discontinuities

Line Detection Example:

Page 7: EE 4780 Edge Detection. Bahadir K. Gunturk2 Detection of Discontinuities Matched Filter Example >> a=[0 0 0 0 1 2 3 0 0 0 0 2 2 2 0 0 0 0 1 2 -2 -1 0

Bahadir K. Gunturk 7

Detection of Discontinuities

Edge Detection: An edge is the boundary between two regions with relatively

distinct gray levels. Edge detection is by far the most common approach for

detecting meaningful discontinuities in gray level. The reason is that isolated points and thin lines are not frequent occurrences in most practical applications.

The idea underlying most edge detection techniques is the computation of a local derivative operator.

Page 8: EE 4780 Edge Detection. Bahadir K. Gunturk2 Detection of Discontinuities Matched Filter Example >> a=[0 0 0 0 1 2 3 0 0 0 0 2 2 2 0 0 0 0 1 2 -2 -1 0

Bahadir K. Gunturk 8

Origin of Edges

Edges are caused by a variety of factors

depth discontinuity

surface color discontinuity

illumination discontinuity

surface normal discontinuity

Page 9: EE 4780 Edge Detection. Bahadir K. Gunturk2 Detection of Discontinuities Matched Filter Example >> a=[0 0 0 0 1 2 3 0 0 0 0 2 2 2 0 0 0 0 1 2 -2 -1 0

Bahadir K. Gunturk 9

Profiles of image intensity edges

Page 10: EE 4780 Edge Detection. Bahadir K. Gunturk2 Detection of Discontinuities Matched Filter Example >> a=[0 0 0 0 1 2 3 0 0 0 0 2 2 2 0 0 0 0 1 2 -2 -1 0

Bahadir K. Gunturk 10

Image gradient The gradient of an image:

The gradient points in the direction of most rapid change in intensity

The gradient direction is given by:

The edge strength is given by the gradient magnitude

Page 11: EE 4780 Edge Detection. Bahadir K. Gunturk2 Detection of Discontinuities Matched Filter Example >> a=[0 0 0 0 1 2 3 0 0 0 0 2 2 2 0 0 0 0 1 2 -2 -1 0

Bahadir K. Gunturk 11

The discrete gradient How can we differentiate a digital image f[x,y]?

Option 1: reconstruct a continuous image, then take gradient Option 2: take discrete derivative (finite difference)

Page 12: EE 4780 Edge Detection. Bahadir K. Gunturk2 Detection of Discontinuities Matched Filter Example >> a=[0 0 0 0 1 2 3 0 0 0 0 2 2 2 0 0 0 0 1 2 -2 -1 0

Bahadir K. Gunturk 12

Effects of noise

Consider a single row or column of the image Plotting intensity as a function of position gives a signal

Page 13: EE 4780 Edge Detection. Bahadir K. Gunturk2 Detection of Discontinuities Matched Filter Example >> a=[0 0 0 0 1 2 3 0 0 0 0 2 2 2 0 0 0 0 1 2 -2 -1 0

Bahadir K. Gunturk 13

Solution: smooth first

Look for peaks in

Page 14: EE 4780 Edge Detection. Bahadir K. Gunturk2 Detection of Discontinuities Matched Filter Example >> a=[0 0 0 0 1 2 3 0 0 0 0 2 2 2 0 0 0 0 1 2 -2 -1 0

Bahadir K. Gunturk 14

Derivative theorem of convolution

This saves us one operation:

Page 15: EE 4780 Edge Detection. Bahadir K. Gunturk2 Detection of Discontinuities Matched Filter Example >> a=[0 0 0 0 1 2 3 0 0 0 0 2 2 2 0 0 0 0 1 2 -2 -1 0

Bahadir K. Gunturk 15

Laplacian of Gaussian Consider

Laplacian of Gaussianoperator

Zero-crossings of bottom graph

Page 16: EE 4780 Edge Detection. Bahadir K. Gunturk2 Detection of Discontinuities Matched Filter Example >> a=[0 0 0 0 1 2 3 0 0 0 0 2 2 2 0 0 0 0 1 2 -2 -1 0

Bahadir K. Gunturk 16

2D edge detection filters

is the Laplacian operator:

Laplacian of Gaussian

Gaussian derivative of Gaussian

Page 17: EE 4780 Edge Detection. Bahadir K. Gunturk2 Detection of Discontinuities Matched Filter Example >> a=[0 0 0 0 1 2 3 0 0 0 0 2 2 2 0 0 0 0 1 2 -2 -1 0

Bahadir K. Gunturk 17

Edge DetectionPossible filters to find gradients along vertical and horizontal directions:

This gives more importance to the center point.

Averaging provides noise suppression

Page 18: EE 4780 Edge Detection. Bahadir K. Gunturk2 Detection of Discontinuities Matched Filter Example >> a=[0 0 0 0 1 2 3 0 0 0 0 2 2 2 0 0 0 0 1 2 -2 -1 0

Bahadir K. Gunturk 18

Edge Detection

Page 19: EE 4780 Edge Detection. Bahadir K. Gunturk2 Detection of Discontinuities Matched Filter Example >> a=[0 0 0 0 1 2 3 0 0 0 0 2 2 2 0 0 0 0 1 2 -2 -1 0

Bahadir K. Gunturk 19

Edge Detection

Page 20: EE 4780 Edge Detection. Bahadir K. Gunturk2 Detection of Discontinuities Matched Filter Example >> a=[0 0 0 0 1 2 3 0 0 0 0 2 2 2 0 0 0 0 1 2 -2 -1 0

Bahadir K. Gunturk 20

Edge Detection

The Laplacian of an image f(x,y) is a second-order derivative defined as

2 22

2 2

f ff

x y

Digital approximations:

Page 21: EE 4780 Edge Detection. Bahadir K. Gunturk2 Detection of Discontinuities Matched Filter Example >> a=[0 0 0 0 1 2 3 0 0 0 0 2 2 2 0 0 0 0 1 2 -2 -1 0

Bahadir K. Gunturk 21

Edge Detection

One simple method to find zero-crossings is black/white thresholding:1. Set all positive values to white2. Set all negative values to black3. Determine the black/white transitions.

Compare (b) and (g):•Edges in the zero-crossings image is thinner than the gradient edges.•Edges determined by zero-crossings have formed many closed loops.

Page 22: EE 4780 Edge Detection. Bahadir K. Gunturk2 Detection of Discontinuities Matched Filter Example >> a=[0 0 0 0 1 2 3 0 0 0 0 2 2 2 0 0 0 0 1 2 -2 -1 0

Bahadir K. Gunturk 22

Edge Detection

The Laplacian of a Gaussian filter

A digital approximation:

0 0 1 0 0

0 1 2 1 0

1 2 -16 2 1

0 1 2 1 0

0 0 1 0 0

Page 23: EE 4780 Edge Detection. Bahadir K. Gunturk2 Detection of Discontinuities Matched Filter Example >> a=[0 0 0 0 1 2 3 0 0 0 0 2 2 2 0 0 0 0 1 2 -2 -1 0

Bahadir K. Gunturk 23

The Canny edge detector

original image (Lena)

Page 24: EE 4780 Edge Detection. Bahadir K. Gunturk2 Detection of Discontinuities Matched Filter Example >> a=[0 0 0 0 1 2 3 0 0 0 0 2 2 2 0 0 0 0 1 2 -2 -1 0

Bahadir K. Gunturk 24

The Canny edge detector

norm of the gradient

Page 25: EE 4780 Edge Detection. Bahadir K. Gunturk2 Detection of Discontinuities Matched Filter Example >> a=[0 0 0 0 1 2 3 0 0 0 0 2 2 2 0 0 0 0 1 2 -2 -1 0

Bahadir K. Gunturk 25

The Canny edge detector

thresholding

Page 26: EE 4780 Edge Detection. Bahadir K. Gunturk2 Detection of Discontinuities Matched Filter Example >> a=[0 0 0 0 1 2 3 0 0 0 0 2 2 2 0 0 0 0 1 2 -2 -1 0

Bahadir K. Gunturk 26

The Canny edge detector

thinning (non-maximum suppression)

Page 27: EE 4780 Edge Detection. Bahadir K. Gunturk2 Detection of Discontinuities Matched Filter Example >> a=[0 0 0 0 1 2 3 0 0 0 0 2 2 2 0 0 0 0 1 2 -2 -1 0

Bahadir K. Gunturk 27

Edge detection by subtraction

original

Page 28: EE 4780 Edge Detection. Bahadir K. Gunturk2 Detection of Discontinuities Matched Filter Example >> a=[0 0 0 0 1 2 3 0 0 0 0 2 2 2 0 0 0 0 1 2 -2 -1 0

Bahadir K. Gunturk 28

Edge detection by subtraction

smoothed (5x5 Gaussian)

Page 29: EE 4780 Edge Detection. Bahadir K. Gunturk2 Detection of Discontinuities Matched Filter Example >> a=[0 0 0 0 1 2 3 0 0 0 0 2 2 2 0 0 0 0 1 2 -2 -1 0

Bahadir K. Gunturk 29

Edge detection by subtraction

smoothed – original

Why doesthis work?

Page 30: EE 4780 Edge Detection. Bahadir K. Gunturk2 Detection of Discontinuities Matched Filter Example >> a=[0 0 0 0 1 2 3 0 0 0 0 2 2 2 0 0 0 0 1 2 -2 -1 0

Bahadir K. Gunturk 30

Gaussian - image filter

Laplacian of Gaussian

Gaussian delta function