Computer Vision

43
Computer Vision Spring 2012 15-385,-685 Instructor: S. Narasimhan Wean Hall 5409 T-R 10:30am – 11:50am

description

Computer Vision. Spring 2012 15-385,-685 Instructor: S. Narasimhan Wean Hall 5409 T-R 10:30am – 11:50am. Boundary Detection: Hough Transform Lecture #7 Reading: Computer Vision (Ballard and Brown): Chapter 4 - PowerPoint PPT Presentation

Transcript of Computer Vision

Page 1: Computer Vision

Computer Vision

Spring 2012 15-385,-685

Instructor: S. Narasimhan

Wean Hall 5409

T-R 10:30am – 11:50am

Page 2: Computer Vision

Boundary Detection:

Hough Transform

Lecture #7

Reading: Computer Vision (Ballard and Brown): Chapter 4

“Use of the Hough Transform to detect lines and curves in pictures”, Comm. ACM 15, 1, January 1972 (pgs 112-115)

Page 3: Computer Vision

Boundaries of Objects

Marked by many users

http://www.eecs.berkeley.edu/Research/Projects/CS/vision/grouping/segbench/bench/html/images.html

Page 4: Computer Vision

Boundaries of Objects from Edges

Brightness Gradient (Edge detection)

• Missing edge continuity, many spurious edges

Page 5: Computer Vision

Boundaries of Objects from Edges

Multi-scale Brightness Gradient

• But, low strength edges may be very important

Page 6: Computer Vision

Boundaries of Objects from Edges

Image

Machine Edge Detection

Human Boundary Marking

Page 7: Computer Vision

Boundaries in Medical Imaging

Detection of cancerous regions.

[Foran, Comaniciu, Meer, Goodell, 00]

Page 8: Computer Vision

Boundaries in Ultrasound Images

Hard to detect in the presence of large amount of speckle noise

Page 9: Computer Vision

Boundaries of Objects

Sometimes hard even for humans!

Page 10: Computer Vision

Topics

• Preprocessing Edge Images

• Edge Tracking Methods

• Fitting Lines and Curves to Edges

• The Hough Transform

Page 11: Computer Vision

Preprocessing Edge Images

Image

Edge detectionand Thresholding

Noisy edge imageIncomplete boundaries

Shrink and Expand

Thinning

Page 12: Computer Vision

Edge Tracking Methods

Adjusting a priori Boundaries:

Given: Approximate Location of Boundary

Task: Find Accurate Location of Boundary

• Search for STRONG EDGES along normals to approximate boundary.

• Fit curve (eg., polynomials) to strong edges.

Page 13: Computer Vision

Edge Tracking Methods

Divide and Conquer:

Given: Boundary lies between points A and B

Task: Find Boundary

• Connect A and B with Line

• Find strongest edge along line bisector

• Use edge point as break point

• Repeat

Page 14: Computer Vision

Fitting Lines to Edges (Least Squares)

cmxy

cmxy ii

),( ii yx

y

x

Given: Many pairs

Find: Parameters

Minimize: Average square distance:

Using:

Note:

),( ii yx

),( cm

i

ii

N

cmxyE

2)(

0&0

c

E

m

E xmyc

ii

iii

xx

yyxxm

2)(

))((

N

yy i

i

N

xx i

i

Page 15: Computer Vision

Problem with Parameterization

y

x

Line that minimizes E!!

Solution: Use a different parameterization

Note: Error E must be formulated carefully!

i

ii yxN

E 2)sincos(1

Page 16: Computer Vision

Computer Vision - A Modern ApproachSet: Fitting

Slides by D.A. Forsyth

Line fitting can be max.likelihood - but choice ofmodel is important

Page 17: Computer Vision

Curve Fitting

y

x

Find Polynomial:

that best fits the given points

Minimize:

Using:

Note: is LINEAR in the parameters (a, b, c, d)

),( ii yx

dcxbxaxxfy 23)(

i

iiii dcxbxaxyN

223 )]([1

0,0,0,0

d

E

c

E

b

E

a

E

)(xf

Page 18: Computer Vision

Line Grouping Problem

Slide credit: David Jacobs

Page 19: Computer Vision

This is difficult because of:

• Extraneous data: clutter or multiple models

– We do not know what is part of the model?

– Can we pull out models with a few parts from much larger amounts of background clutter?

• Missing data: only some parts of model are present

• Noise

• Cost:

– It is not feasible to check all combinations of features by fitting a model to each possible subset

Page 20: Computer Vision

Hough Transform

• Elegant method for direct object recognition

• Edges need not be connected

• Complete object need not be visible

• Key Idea: Edges VOTE for the possible model

Page 21: Computer Vision

Image and Parameter Spaces

cmxy

),( ii yx

y

x

Equation of Line:

Find:

Consider point:

cmxy

),( cm

),( ii yx

iiii ymxcorcmxy m

c

),( cm

Image Space

Parameter Space

Parameter space also called Hough Space

Page 22: Computer Vision

Line Detection by Hough Transformy

x

),( cm

Parameter Space

1 1

1 1

1 1

2

1 1

1 1

1 1

),( cmA

Algorithm:

• Quantize Parameter Space

• Create Accumulator Array

• Set

• For each image edge increment:

• If lies on the line:

• Find local maxima in

),( cm

),( cmA

cmcmA ,0),(

),( ii yx

1),(),( cmAcmA

),( cm

),( cmAii ymxc

Page 23: Computer Vision

Better Parameterization

NOTE:

Large Accumulator

More memory and computations

Improvement:

Line equation:

Here

Given points find

m

sincos yx

max0

20

(Finite Accumulator Array Size)

),( ii yx ),(

),( ii yx

y

xImage Space

Hough Space

?

Hough Space Sinusoid

Page 24: Computer Vision

Image space Votes

Horizontal axis is θ, vertical is rho.

Page 25: Computer Vision

Image space

votes

Page 26: Computer Vision
Page 27: Computer Vision

Mechanics of the Hough transform

• Difficulties– how big should the cells

be? (too big, and we merge quite different lines; too small, and noise causes lines to be missed)

• How many lines?– Count the peaks in the

Hough array– Treat adjacent peaks as

a single peak

• Which points belong to each line?– Search for points close to

the line– Solve again for line and

iterate

Page 28: Computer Vision

Fewer votes land in a single bin when noise increases.

Page 29: Computer Vision

Adding more clutter increases number of bins with false peaks.

Page 30: Computer Vision

Real World Example

Original Edge Detection

Found Lines

Parameter Space

Page 31: Computer Vision

Finding Circles by Hough Transform

Equation of Circle:

222 )()( rbyax ii

If radius is known:

),( baAAccumulator Array

(2D Hough Space)

Page 32: Computer Vision

Finding Circles by Hough Transform

Equation of Circle:

222 )()( rbyax ii

If radius is not known: 3D Hough Space!

Use Accumulator array ),,( rbaA

What is the surface in the hough space?

Page 33: Computer Vision

Using Gradient Information• Gradient information can save lot of computation:

Edge Location

Edge Direction

Need to increment only one point in Accumulator!!

i),( ii yx

Assume radius is known:

sin

cos

ryb

rxa

Page 34: Computer Vision

Real World Circle Examples

Crosshair indicates results of Hough transform,bounding box found via motion differencing.

Page 35: Computer Vision

Finding Coins

Original Edges (note noise)

Page 36: Computer Vision

Finding Coins (Continued)

Pennies Quarters

Page 37: Computer Vision

Finding Coins (Continued)

Coin finding sample images from: Vivek Kwatra

Note that because the quarters and penny are different sizes, a different Hough transform (with separate accumulators) was used for each circle size.

Page 38: Computer Vision

Generalized Hough Transform

• Model Shape NOT described by equation

Page 39: Computer Vision

Generalized Hough Transform

• Model Shape NOT described by equation

Page 40: Computer Vision

Generalized Hough Transform

Find Object Center given edges

Create Accumulator Array

Initialize:

For each edge point

For each entry in table, compute:

Increment Accumulator:

Find Local Maxima in

),( cc yxA

),(0),( cccc yxyxA

),,( iii yx

1),(),( cccc yxAyxA

),( cc yxA

ik

ikic

ik

ikic

ryy

rxx

sin

cos

ikr

),( cc yx ),,( iii yx

Page 41: Computer Vision
Page 42: Computer Vision

Hough Transform: Comments

• Works on Disconnected Edges

• Relatively insensitive to occlusion

• Effective for simple shapes (lines, circles, etc)

• Trade-off between work in Image Space and Parameter Space

• Handling inaccurate edge locations:

• Increment Patch in Accumulator rather than a single point

Page 43: Computer Vision

Next Class

• Physics based Vision