lecture9 fitting matching - silvio savarese · generalized hough transform d. ballard, generalizing...

70
Lecture 8 - Silvio Savarese 4-Feb-15 • Problem formulation • Least square methods • RANSAC • Hough transforms • Multimodel fitting • Fitting helps matching! Lecture 9 Fitting and Matching Reading: [HZ] Chapter: 4 “Estimation – 2D projective transformation” Chapter: 11 “Computation of the fundamental matrix F” [FP] Chapter:10 “Grouping and model fitting” Some slides of this lectures are courtesy of profs. S. Lazebnik & K. Grauman

Upload: others

Post on 24-May-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

Lecture 8 - Silvio Savarese 4-Feb-15

•  Problem  formulation  •  Least  square  methods  •  RANSAC  •  Hough  transforms    •  Multi-­‐model  fitting  •  Fitting  helps  matching!

Lecture  9Fitting  and  Matching

Reading:      [HZ] Chapter: 4 “Estimation – 2D projective transformation” Chapter: 11 “Computation of the fundamental matrix F”[FP] Chapter:10 “Grouping and model fitting”  

Some slides of this lectures are courtesy of profs. S. Lazebnik & K. Grauman

Page 2: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

FittingGoals:• Choose a parametric model to fit a certain

quantity from data• Estimate model parameters

- Lines - Curves- Homographic transformation- Fundamental matrix- Shape model

Page 3: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

Example: fitting lines(for computing vanishing points)

Page 4: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

H

Example: Estimating an homographic transformation

Page 5: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

Example: Estimating F

Page 6: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

AExample: fitting a 2D shape template

Page 7: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

Example: fitting a 3D object model

Page 8: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

Fitting,  matching  and  recognition  are  interconnected  problems

Page 9: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

Fitting

Critical issues:- noisy data- outliers- missing data

Page 10: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

Critical issues: noisy data

Page 11: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

Critical issues: noisy data (intra-class variability)

A

Page 12: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

H

Critical issues: outliers

Page 13: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

Critical issues: missing data (occlusions)

Page 14: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

FittingGoal: Choose a parametric model to

fit a certain quantity from data

Techniques: •Least square methods•RANSAC•Hough transform•EM (Expectation Maximization) [not covered]

Page 15: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

Least squares methods- fitting a line -

• Data: (x1, y1), …, (xn, yn)

• Line equation: yi – m xi – b = 0

• Find (m, b) to minimize

∑ =−−=

n

i ii bxmyE1

2)(

(xi, yi)

y=mx+b

[Eq. 2]

[Eq. 1]

Page 16: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

022 =+−= XBXYXdBdE TT

[ ] 2

2

n

1

n

1n

1i

2

ii XBYbm

1x

1x

y

y

bm

1xyE −="#

$%&

'

"""

#

$

%%%

&

'

"""

#

$

%%%

&

'

=(()

*++,

-"#

$%&

'−=∑ =

!!!

Normal equation

∑ =−−=

n

i ii bxmyE1

2)(

YXXBX TT =

Least squares methods- fitting a line -

( ) YXXXB T1T −=

)XB()XB(Y)XB(2YY)XBY()XBY( TTTT +−=−−=

Find B=[m, b]T that minimizes E

[Eq. 2]

[Eq. 6]

[Eq. 3]

[Eq. 4]

[Eq. 5]

[Eq. 7]

Page 17: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

Least squares methods- fitting a line -

∑ =−−=

n

1i2

ii )bxmy(E

(xi, yi)

y=mx+b

( ) YXXXB T1T −= !

"

#$%

&=bm

B

• Fails completely for vertical lines

Limitations

[Eq. 6]

Page 18: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

• Distance between point (xn, yn) and line ax+by=d

• Find (a, b, d) to minimize the sum of squared perpendicular distances

ax+by=d

∑ =−+=

n

i ii dybxaE1

2)((xi, yi)

Ah= 0data model parameters

Least squares methods- fitting a line -

[Eq. 8]

[Eq. 9]

Page 19: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

1||h||tosubject||hA||Minimize =

TUDVA =

V ofcolumn last h =

A h = 0

Least squares methods- fitting a line -

A is rank deficient

Page 20: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

H

Least squares methods- fitting an homography -

x

y

x’

y’

Ah= 0data model parameters

[Eq. 10]

Page 21: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

Least squares: Robustness to noise

Page 22: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

Least squares: Robustness to noise

outlier!

Page 23: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

H

Critical issues: outliers

CONCLUSION: Least square is not robust w.r.t. outliers

Page 24: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

Least squares: Robust estimators

• ui = error (residual) of ith point w.r.t. model parameters h = (a,b,d)( )σρ ;i

iuE ∑=

Robust function ρ:• When u is large, ρ saturates to 1• When u is small, ρ is a function of u2

∑ =−+=

n

i ii dybxaE1

2)(Instead of minimizing

dybxau iii −+=We minimize

• ρ = robust function of ui with scale parameter σ

u

ρ

[Eq. 11]

[Eq.

12]

In conclusion:• Favors a configuration with small residuals• Penalizes large residuals

(ρ=rho)

[Eq. 8]

Page 25: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

Least squares: Robust estimators

• ui = error (residual) of ith point w.r.t. model parameters h = (a,b,d)( )σρ ;i

iuE ∑=∑ =

−+=n

i ii dybxaE1

2)(Instead of minimizing

dybxau iii −+=We minimize

• ρ = robust function of ui with scale parameter σ

[Eq. 11]

[Eq.

12]

•Small sigma à highly penalize large residuals

•Large sigma à mildly penalize large residual (like LSQR)

u

ρ

[Eq. 8]

Page 26: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

The effect of the outlier is eliminated

Least squares: Robust estimators

Good scale parameter σ

Page 27: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

Least squares: Robust estimators

Bad scale parameter σ (too small!)Fits only locally

Page 28: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

Least squares: Robust estimators

Bad scale parameter σ (too large!)Same as standard LSQ

•Robust fitting is a nonlinear optimization problem (iterative solution)•Least squares solution provides good initial condition

•CONCLUSION: Robust estimator useful if prior info about the distribution of points is known

Page 29: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

FittingGoal: Choose a parametric model to

fit a certain quantity from data

Techniques: •Least square methods•RANSAC•Hough transform

Page 30: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

Basic philosophy(voting scheme)

• Data elements are used to vote for one (or multiple) models

• Robust to outliers and missing data

• Assumption 1: Noisy data points will not vote consistently for any single model (“few” outliers)

• Assumption 2: There are enough data points to agree on a good model (“few” missing data)

Page 31: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

r(P, h) < δ, ∀P∈ P

Oπmin{ }OPI ,: →π

such that:

r(P, h) = residual

δ

Model parameters

RANSAC

Fischler & Bolles in ‘81.

(RANdom SAmple Consensus) :

[Eq. 12]

Page 32: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

RANSAC

Algorithm:1. Select random sample of minimum required size to fit model 2. Compute a putative model from sample set3. Compute the set of inliers to this model from whole data setRepeat 1-3 until model with the most inliers over all samples is found

Sample set = set of points in 2D

Page 33: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

RANSAC

Algorithm:1. Select random sample of minimum required size to fit model [?]2. Compute a putative model from sample set3. Compute the set of inliers to this model from whole data setRepeat 1-3 until model with the most inliers over all samples is found

Sample set = set of points in 2D

Page 34: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

RANSAC

Algorithm:1. Select random sample of minimum required size to fit model [?]2. Compute a putative model from sample set3. Compute the set of inliers to this model from whole data setRepeat 1-3 until model with the most inliers over all samples is found

Sample set = set of points in 2D

Page 35: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

δ

RANSAC

Algorithm:1. Select random sample of minimum required size to fit model [?]2. Compute a putative model from sample set3. Compute the set of inliers to this model from whole data setRepeat 1-3 until model with the most inliers over all samples is found

O = ?Sample set = set of points in 2D

P = ?=14= 6

Page 36: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

δ

RANSAC

O = 6

Algorithm:1. Select random sample of minimum required size to fit model [?]2. Compute a putative model from sample set3. Compute the set of inliers to this model from whole data setRepeat 1-3 until model with the most inliers over all samples is found

P =14

Page 37: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

How many samples?• Number N of samples required to ensure, with a probability p, that at

least one random sample produces an inlier set that is free from “real” outliers.

• Usually, p=0.99

Page 38: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

δ

• Here a random sample is given by two green points• Estimated inlier set is given by the green+blue points• How many “real” outliers we have here?

Example

2

“real“ outlier ratio is 6/20 = 30%

Page 39: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

• Random sample is given by two green points• Estimated inlier set is given by the green+blue points• How many “real” outliers we have here?

Example

0

δ

“real“ outlier ratio is 6/20 = 30%

Page 40: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

How many samples?• Number N of samples required to ensure, with a probability p, that at

least one random sample produces an inlier set that is free from “real” outliers for a given s and e.

• E.g., p=0.99

proportion of outliers es 5% 10% 20% 25% 30% 40% 50%2 2 3 5 6 7 11 173 3 4 7 9 11 19 354 3 5 9 13 17 34 725 4 6 12 17 26 57 1466 4 7 16 24 37 97 2937 4 8 20 33 54 163 5888 5 9 26 44 78 272 1177

e = outlier ratios = minimum number needed to fit the model

( ) ( )( )se11log/p1logN −−−=

Note: this table assumes “negligible” measurement noise

[Eq. 13]

Page 41: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

Estimating H by RANSAC

Algorithm:1. Select a random sample of minimum required size [?]2. Compute a putative model from these3. Compute the set of inliers to this model from whole sample space Repeat 1-3 until model with the most inliers over all samples is found

Sample set = set of matches between 2 images

•H → 8 DOF•Need 4 correspondences

Outlier match

Page 42: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

Estimating F by RANSAC

Algorithm:1. Select a random sample of minimum required size [?]2. Compute a putative model from these3. Compute the set of inliers to this model from whole sample space Repeat 1-3 until model with the most inliers over all samples is found

Sample set = set of matches between 2 images

•F → 7 DOF•Need 7 (8) correspondences

Outlier matches

Page 43: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

• Simple and easily implementable• Successful in different contexts

RANSAC - conclusions

Good:

Bad:• Many parameters to tune• Trade-off accuracy-vs-time• Cannot be used if ratio inliers/outliers is too small

Page 44: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

FittingGoal: Choose a parametric model to

fit a certain quantity from data

Techniques: •Least square methods•RANSAC•Hough transform

Page 45: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

x

y

Hough transform

Given a set of points, find the curve or line that explains the data points best

P.V.C. Hough, Machine Analysis of Bubble Chamber Pictures, Proc. Int. Conf. High Energy Accelerators and Instrumentation, 1959

y = m’ x + n’

Page 46: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

x

y

n

m

y = m x + n

Hough transform

Given a set of points, find the curve or line that explains the data points best

P.V.C. Hough, Machine Analysis of Bubble Chamber Pictures, Proc. Int. Conf. High Energy Accelerators and Instrumentation, 1959

Hough space

y1 = m x1 + n

(x1, y1)

(x2, y2)

y2 = m x2 + ny = m’ x + n’

m’

n’

Page 47: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

Hough transform

Any Issue? The parameter space [m,n] is unbounded…

P.V.C. Hough, Machine Analysis of Bubble Chamber Pictures, Proc. Int. Conf. High Energy Accelerators and Instrumentation, 1959

Page 48: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

x

y

Hough transformP.V.C. Hough, Machine Analysis of Bubble Chamber Pictures, Proc. Int. Conf. High Energy Accelerators and Instrumentation, 1959

Hough space

ρθθ =+ siny cosx

θρ

•Use a polar representation for the parameter space

θ

ρ

[Eq. 13]

Any Issue? The parameter space [m,n] is unbounded…

Original space

Page 49: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

Hough transform - experiments

Hough spaceOriginal space θ

ρ

Page 50: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

How to compute the intersection point?IDEA: introduce a grid a count intersection points in each cellIssue: Grid size needs to be adjusted…

Hough transform - experiments

Noisy data

Hough spaceOriginal space θ

ρ

Page 51: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

Issue: spurious peaks due to uniform noise

Hough transform - experiments

Hough spaceOriginal space θ

ρ

Page 52: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

• All points are processed independently, so can cope with occlusion/outliers

• Some robustness to noise: noise points unlikely to contribute consistently to any single cell

Hough transform - conclusionsGood:

Bad:• Spurious peaks due to uniform noise• Trade-off noise-grid size (hard to find sweet point)

Page 53: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

Courtesy of Minchae Lee

Applications – lane detection

Page 54: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

Applications – computing vanishing points

Page 55: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

Generalized Hough transformD. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

• Parameterize a shape by measuring the location of its parts and shape centroid

• Given a set of measurements, cast a vote in the Hough (parameter) space

[more on forthcoming lectures]

B. Leibe, A. Leonardis, and B. Schiele, Combined Object Categorization and Segmentation with an Implicit Shape Model, ECCV Workshop on Statistical Learning in Computer Vision 2004

• Used in object recognition! (the implicit shape model)

Page 56: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

Lecture 8 - Silvio Savarese 4-Feb-15

•  Problem  formulation  •  Least  square  methods  •  RANSAC  •  Hough  transforms    •  Multi-­‐model  fitting  •  Fitting  helps  matching!

Lecture  9Fitting  and  Matching

Page 57: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

Fitting multiple models

• Incremental fitting

• E.M. (probabilistic fitting)

• Hough transform

Page 58: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

Incremental line fittingScan data point sequentially (using locality constraints)

Perform following loop:

1. Select N point and fit line to N points2. Compute residual RN

3. Add a new point, re-fit line and re-compute RN+1

4. Continue while line fitting residual is small enough,

➢ When residual exceeds a threshold, start fitting new model (line)

Page 59: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

Hough transformC

ourte

sy o

f unk

now

n

Same cons and pros as before…

Page 60: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

Lecture 8 - Silvio Savarese 4-Feb-15

•  Problem  formulation  •  Least  square  methods  •  RANSAC  •  Hough  transforms    •  Multi-­‐model  fitting  •  Fitting  helps  matching!

Lecture  9Fitting  and  Matching

Page 61: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

Features are matched (for instance, based on correlation)

Fitting helps matching!

windowwindow

Image 1 Image 2

Page 62: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

Idea: • Fitting an homography H (by RANSAC) mapping features from images 1 to 2 • Bad matches will be labeled as outliers (hence rejected)!

Matches based on appearance onlyGreen: good matchesRed: bad matches

Image 1 Image 2

Fitting helps matching!

Page 63: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

Fitting helps matching!

Page 64: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

M. Brown and D. G. Lowe. Recognising Panoramas. In Proceedings of the 9th International Conference on Computer Vision -- ICCV2003

Recognising Panoramas

Page 65: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

Next lecture:Feature detectors and descriptors

Page 66: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981
Page 67: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

bAx =

• More equations than unknowns

• Look for solution which minimizes ||Ax-b|| = (Ax-b)T(Ax-b) • Solve

• LS solution

0)()(=

−−∂

i

T

xbAxbAx

bAAAx TT 1)( −=

Least squares methods- fitting a line -

Page 68: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

t1t A)AA(A −+ =

UVA 11 −− ∑=

with equal to for all nonzero singular values and zero otherwise

1−∑

= pseudo-inverse of A

Solving bAAAx tt 1)( −=

Least squares methods- fitting a line -

tVUA ∑=

UVA ++ ∑=

= SVD decomposition of A

+∑

Page 69: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

Least squares methods- fitting an homography -

A h = 0

0

h

hh

3,3

2,1

1,1

=

!!!!

"

#

$$$$

%

&

!

From n>=4 corresponding points:

Page 70: lecture9 fitting matching - Silvio Savarese · Generalized Hough transform D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern Recognition 13(2), 1981

Issue: spurious peaks due to uniform noisefeatures votes

Hough transform - experiments