Docsity

Robust Line Fitting: RANSAC, Least Squares, and Probabilistic - Prof. Shishir Shah, Study notes of Computer Science

Partial preview of the text

Download Robust Line Fitting: RANSAC, Least Squares, and Probabilistic - Prof. Shishir Shah and more Study notes Computer Science in PDF only on Docsity!

Fitting: Data to Model

Acknowledgement: Notes by Profs. R. Szeliski, S. Seitz, S. Lazebnik, and S. Shah

COSC 6373

Computer Vision

Fitting: Concepts and recipes

Least squares line fitting

Data: ( x 1 , y 1 ), …, ( xn , yn ) Line equation: yi = m xi + b Find ( m , b ) to minimize ( x i , y i

y=mx+b

Least squares line fitting

Data: ( x 1 , y 1 ), …, ( xn , yn ) Line equation: yi = m xi + b Find ( m , b ) to minimize Normal equations: least squares solution to XB=Y ( x i , y i

y=mx+b

Total least squares

Distance between point ( xn , yn ) and line ax+by=d ( a 2 +b 2 = 1): | ax + by – d | Find ( a , b , d ) to minimize the sum of squared perpendicular distances (^) ( x i , y i

ax+by=d Unit normal: N= ( a, b )

Total least squares

Distance between point ( xn , yn ) and line ax+by=d ( a 2 +b 2 = 1): | ax + by – d | Find ( a , b , d ) to minimize the sum of squared perpendicular distances (^) ( x i , y i

ax+by=d Unit normal: N= ( a, b ) d = a n xi + b n i = 1 n ∑ (^) i = 1 yi n ∑ =^ ax^ +^ by Solution to ( U T U ) N = 0, subject to || N || 2 = 1: eigenvector of U T U associated with the smallest eigenvalue (least squares solution to homogeneous linear system UN = 0 )

Total least squares

N = ( a , b ) second moment matrix

Least squares as likelihood maximization

  • Generative model : line points are corrupted by Gaussian noise in the direction perpendicular to the line (^) ( x , y ) ax+by=d ( u , v ) ε point on the line noise: zero-mean Gaussian with std. dev. σ normal direction

Probabilistic fitting: General concepts

  • Likelihood:

Probabilistic fitting: General concepts

  • Likelihood:
  • Log-likelihood:

Probabilistic fitting: General concepts

  • Likelihood:
  • Log-likelihood:
  • Maximum likelihood estimation:
  • Maximum a posteriori (MAP) estimation: prior

Least squares for general curves

  • We would like to minimize the sum of squared geometric distances between the data points

and the curve

( x i , y i

d(( x i , y i

), C )

curve C

Least squares for conics

  • Equation of a general conic:

C( a , x ) = a · x = ax

2

+ bxy + cy

2

+ dx + ey + f = 0,

a = [ a, b, c, d, e, f],

x = [ x

2

, xy, y

2

, x, y, 1]

  • Minimizing the geometric distance is non-linear even for a conic
  • Algebraic distance: C( a , x )
  • Algebraic distance minimization by linear least squares:

Least squares for conics

  • Least squares system: D a = 0
  • Need constraint on a to prevent trivial solution
  • Discriminant: b 2 - 4 ac  Negative: ellipse  Zero: parabola  Positive: hyperbola
  • Minimizing squared algebraic distance subject to constraints leads to a generalized eigenvalue problem  Many variations possible
  • For more information:  A. Fitzgibbon, M. Pilu, and R. Fisher, Direct least-squares fitting of ellipses, EEE Transactions on Pattern Analysis and Machine Intelligence, 21(5), 476--480, May 1999