edge detection - haifacs.haifa.ac.il/~dkeren/ip/lecture9.pdf · edge linking hough transform edge...

Post on 17-Apr-2018

223 Views

Category:

Documents

4 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Image Processing - Lesson 9

Edge detection masks

Gradient Detectors

Compass Detectors

Second Derivative - Laplace detectors

Edge Linking

Hough Transform

Edge Detection

Image Processing

Computer Vision

Low Level

High Level

Image Processing - Computer Vision

representation,compression,transmission

image enhancement

edge/feature finding

image "understanding"

UFO - Unidentified Flying Object

Point Detection

Convolution with:-1 -1 -1 -1 8 -1 -1 -1 -1

Large Positive values = light point on dark surroundLarge Negative values = dark point on light surround

Example:

-1 -1 -1 -1 8 -1 -1 -1 -1

5 5 5 5 5 5 5 5 100 55 5 5 5 5

0 0 -95 -95 -95 0 0 -95 760 -950 0 -95 -95 -95

*

=

Edge Definition

Line Edgegr

ay v

alue

x

edge edge

gray

val

ue

x

edge edge

Step Edge

Edge Detection

Line Edge Detectors

Step Edge Detectors

-1 -1 -1 2 2 2 -1 -1 -1

-1 2 -1 -1 2 -1 -1 2 -1

2 -1 -1 -1 2 -1-1 -1 2

-1 -1 2 -1 2 -1 2 -1 -1

-1 1-1 1-1 1

-1 -1 1 1 -1 -1 1 1-1 -1 1 1-1 -1 1 1

-1 -1 -1 -1-1 -1 -1 -11 1 1 11 -1 1 1

-1 -1 -1 -11 1 1 1

Edge Detection by Differentiation

Step Edge detection by differentiation:

gray

val

ue

x

1D image f(x)

1st derivative f'(x)

threshold|f'(x)| - threshold

Pixels that passed the threshold are

Edge Pixels

Gradient Edge Detection

∇ f((x,y) =

∂f∂x∂f∂y

Gradient

Gradient Magnitude

Gradient Direction

∂f∂x

∂f∂y√( )2 + ( )2

∂f∂y

∂f∂xtg-1 ( / )

Differentiation in Digital Images

∂f(x,y)∂x = f(x,y) - f(x-1,y)

= f(x,y) - f(x,y-1)∂f(x,y)

∂y

horizontal - differentiation approximation:

vertical - differentiation approximation:

convolution with [ 1 -1 ]

convolution with 1-1

FA =

FB =

Gradient (FA , FB)

((FA )2 + (FB)2 )1/2Magnitude

|FA | + |FB|Approx. Magnitude

FA = f(x,y) - f(x-1,y-1)

FB = f(x-1,y) - f(x,y-1)

1 00 -1A = 0 1

-1 0B =

Roberts and other 2x2 operators are sensitive to noise.

Roberts Edge Detector

Smoothed operators

Prewitt Edge Detector

-1 -1 -10 0 01 1 1

B =-1 0 1-1 0 1-1 0 1

A =

Sobel Edge Detector

-1 -2 -10 0 01 2 1

B =-1 0 1-2 0 2-1 0 1

A =

Isotropic Edge Detector

-1 -√2 -10 0 01 √2 1

B =-1 0 1-√2 0 √2-1 0 1

A =

Example Edge

Original

Gradient-X Gradient-Y

Gradient-Magnitude Gradient-Direction

Compass Operators

1 1 1 0 0 0 -1 -1 -1

-1 -1 -1 0 0 0 1 1 1

1 1 0 1 0 -10 -1 -1

-1 -1 0 -1 0 10 1 1

1 0 -1 1 0 -11 0 -1

-1 0 1 -1 0 1-1 0 1

0 -1 -1 1 0 -11 1 0

0 1 1 -1 0 1-1 -1 0

N

S

NW

SE

W SW

E NE

Given k operators, gk(x,y) is the image obtained byconvolving f(x,y) with the kth operator.

The gradient is defined as:

g(x,y) = max gk(x,y)k

k defines the edge direction

Various Compass Operators:

1 1 1 1 -2 1 -1 -1 -1

Kirsch Edge Detector

1 1 1 0 0 0-1 -1 -1

5 5 5 -3 0 -3-3 -3 -3

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

f(x)

f (x)

f (x)

Derivatives

zero crossing

Laplacian Operators

Approximation of second derivative (horizontal):

= f''(x,y) = f'(x+1,y) - f'(x,y) =

= [f(x+1,y) - f(x,y)] - [f(x,y) - f(x-1,y)] = f(x+1,y) - 2 f(x,y) + f(x-1,y)

∂f2(x,y)∂2x

convolution with: [ 1 -2 1]

Approximation of second derivative (vertical):

convolution with: 1-21

Laplacian Operator ( + )∇2 = ∂2

∂x2∂2

∂y2

convolution with:0 -1 0-1 4 -10 -1 0

Variations on Laplace Operators:

0 -1 0-1 4 -10 -1 0

1 -2 1-2 4 -21 -2 1

-1 -1 -1-1 8 -1-1 -1 -1

All are approximations of:

Example of Laplacian Edge Detection

- =

Laplacian ~ Difference of Gaussians

DOG = Difference of Gaussians

FFT

- =

FFT

- =

Laplacian Operator(Image Domain)

Laplacian Filter(Frequency Domain)

Enhancement Using the Laplacian Operator

Edge Image f(x)

∂f∂x1st derivative

∂2f∂x2

2nd derivative(Laplacian)

∂2f∂x2-

∂2f∂x2f(x) -

Mach Bands

Edge Linking

(x,y) is an edge pixel.Search for neighboring edge pixels that are "similar".

Similarity:

Similarity in Edge OrientationSimilarity in Edge strength (Gradient Amplitude)

Perform Edge Following along similar edge pixels.(as in Contour Following in binary images).

θ

Hough Transform

x

ys (θ, s)

straight line Hough Transform

x

y

single point = many possible lines

θ

s

Image Domain Hough Domain

x

y

many points on a line = many lines in the Hough transform space which intersect at 1 point.

s

Hough transform Method for finding line segments

θ

Hough Transform Example

Hough Transform (s,θ) space

Original square image

s

θ

Reconstructed line segments

Hough Transform Example

Original Edges

Hough Transform

Results1 Results2 Results3

Hough Transform Example

Original

Edges

Result

top related