Algorithm Search⌘K

Definitionadvanced

Sampson distance

Also called Sampson error, first-order geometric error.

A first-order approximation of the geometric distance of a point to a variety, the algebraic residual divided by the norm of its gradient.

The Sampson distance is a cheap estimate of the geometric distance of a measurement to the set of measurements that fit a model exactly. It linearizes the constraint at the measured point and returns the distance to the linearized set in closed form: for one scalar constraint, the algebraic residual divided by the norm of its gradient. For two-view matches it approximates the reprojection error of a match without solving for the 3D point or for the corrected points. The page algebraic and geometric error compares the two kinds of cost; this page defines the approximation that lies between them.

Definition

Let a model with parameters h\mathbf{h} define, for a measurement vector X∈RN\mathbf{X} \in \mathbb{R}^N, an algebraic residual ϵ=Ch(X)∈Rm\boldsymbol{\epsilon} = C_{\mathbf{h}}(\mathbf{X}) \in \mathbb{R}^m, with m≤Nm \le N. The measurements that fit the model exactly form the variety V={X:Ch(X)=0}\mathcal{V} = \{\mathbf{X} : C_{\mathbf{h}}(\mathbf{X}) = \mathbf{0}\}. The geometric distance of a measured X\mathbf{X} is the length of the shortest δ\boldsymbol{\delta} with X+δ∈V\mathbf{X} + \boldsymbol{\delta} \in \mathcal{V}.

Replace ChC_{\mathbf{h}} by its first-order Taylor expansion at X\mathbf{X}: Ch(X+δ)≈ϵ+JδC_{\mathbf{h}}(\mathbf{X} + \boldsymbol{\delta}) \approx \boldsymbol{\epsilon} + J\boldsymbol{\delta}, with JJ the m×Nm \times N Jacobian matrix of ChC_{\mathbf{h}} at X\mathbf{X}. If JJ has full rank mm, the shortest δ\boldsymbol{\delta} with Jδ=−ϵJ\boldsymbol{\delta} = -\boldsymbol{\epsilon} is

δS=−JT(JJT)−1ϵ,\boldsymbol{\delta}_S = -J^{\mathsf T}(J J^{\mathsf T})^{-1}\boldsymbol{\epsilon},

found with a Lagrange multiplier for the constraint. The Sampson error is its squared length, and the Sampson distance is its length:

∥δS∥2=ϵT(JJT)−1ϵ.\|\boldsymbol{\delta}_S\|^2 = \boldsymbol{\epsilon}^{\mathsf T}(J J^{\mathsf T})^{-1}\boldsymbol{\epsilon} .

For one scalar constraint (m=1m = 1) this is ϵ2/∥∇C∥2\epsilon^2 / \|\nabla C\|^2.

For the fundamental matrix. A match x=(x,y,1)T\mathbf{x} = (x, y, 1)^{\mathsf T}, x′=(x′,y′,1)T\mathbf{x}' = (x', y', 1)^{\mathsf T} is a measurement X=(x,y,x′,y′)∈R4\mathbf{X} = (x, y, x', y') \in \mathbb{R}^4, and the constraint is ϵ=x′TFx\epsilon = \mathbf{x}'^{\mathsf T}F\mathbf{x}. Its gradient with respect to (x,y,x′,y′)(x, y, x', y') is ((FTx′)1,(FTx′)2,(Fx)1,(Fx)2)((F^{\mathsf T}\mathbf{x}')_1, (F^{\mathsf T}\mathbf{x}')_2, (F\mathbf{x})_1, (F\mathbf{x})_2), so

dS2=(x′TFx)2(Fx)12+(Fx)22+(FTx′)12+(FTx′)22.d_S^2 = \frac{(\mathbf{x}'^{\mathsf T}F\mathbf{x})^2}{(F\mathbf{x})_1^2 + (F\mathbf{x})_2^2 + (F^{\mathsf T}\mathbf{x}')_1^2 + (F^{\mathsf T}\mathbf{x}')_2^2} .

The same formula holds for the essential matrix in normalized image coordinates.

For a homography. The two DLT equations of a pair give ϵ∈R2\boldsymbol{\epsilon} \in \mathbb{R}^2, and JJ is the 2×42 \times 4 matrix of their derivatives with respect to (x,y,x′,y′)(x, y, x', y'); the general formula applies with m=2m = 2 (HZ Section 4.2.6).

Properties.

  • It is 0 exactly when ϵ=0\boldsymbol{\epsilon} = \mathbf{0}, that is, when the measurement fits the model.
  • It is exact when ChC_{\mathbf{h}} is affine in X\mathbf{X}, because then the linearization is the constraint itself. An example is the distance of a point to a line.
  • Near the variety it differs from the geometric distance by a term of higher order in the distance.
  • It does not change when ChC_{\mathbf{h}} is multiplied by a nonzero constant, so the scale of FF or HH does not matter. Unlike the algebraic error, it does not depend on the choice of a Euclidean frame in the images.
  • It needs JJTJ J^{\mathsf T} to be invertible. For the fundamental matrix it fails at a match where Fx=0F\mathbf{x} = \mathbf{0} and FTx′=0F^{\mathsf T}\mathbf{x}' = \mathbf{0}, which means that both points are the epipoles.

Examples and non-examples

  • A circle. For C(x,y)=x2+y2−1C(x, y) = x^2 + y^2 - 1 and the point (1.1,0)(1.1, 0): ϵ=0.21\epsilon = 0.21, ∇C=(2.2,0)\nabla C = (2.2, 0), so the Sampson distance is 0.21/2.2≈0.09550.21 / 2.2 \approx 0.0955, against the true distance 0.10.1. For the far point (2,0)(2, 0) it is 3/4=0.753 / 4 = 0.75 against 11: the approximation is good only near the curve. This is the setting of Sampson's 1982 paper on conic fitting.
  • A line. For C(x,y)=3x+4y−5C(x, y) = 3x + 4y - 5 and the point (3,4)(3, 4): ϵ=20\epsilon = 20 and ∥∇C∥=5\|\nabla C\| = 5, so the Sampson distance is 44, which is the exact distance from the point to the line.
  • A rectified stereo pair. For a camera that moves along the xx axis, F=(00000−1010)F = \begin{pmatrix} 0 & 0 & 0 \\ 0 & 0 & -1 \\ 0 & 1 & 0 \end{pmatrix}, and x′TFx=y−y′\mathbf{x}'^{\mathsf T}F\mathbf{x} = y - y'. Then (Fx)1,2=(0,−1)(F\mathbf{x})_{1,2} = (0, -1) and (FTx′)1,2=(0,1)(F^{\mathsf T}\mathbf{x}')_{1,2} = (0, 1), so dS2=(y−y′)2/2d_S^2 = (y - y')^2 / 2. For y=10y = 10 and y′=12y' = 12, dS2=2d_S^2 = 2. This is exact: the best correction moves each point by 1 pixel toward the other, and 12+12=21^2 + 1^2 = 2.
  • Non-example: the algebraic error. (x′TFx)2(\mathbf{x}'^{\mathsf T}F\mathbf{x})^2 alone changes with the scale of FF and with the position of the match in the image.
  • Non-example: the symmetric epipolar distance. The sum of the squared distances of x′\mathbf{x}' to the epipolar line FxF\mathbf{x} and of x\mathbf{x} to the line FTx′F^{\mathsf T}\mathbf{x}' is ϵ2(1(Fx)12+(Fx)22+1(FTx′)12+(FTx′)22)\epsilon^2 \left( \frac{1}{(F\mathbf{x})_1^2 + (F\mathbf{x})_2^2} + \frac{1}{(F^{\mathsf T}\mathbf{x}')_1^2 + (F^{\mathsf T}\mathbf{x}')_2^2} \right). It has the same numerator but another weight. In the stereo example it gives 4+4=84 + 4 = 8, four times the Sampson value.
  • Reprojection error: the geometric distance that the Sampson distance approximates. For two views, the exact value needs optimal triangulation of the match.
  • Algebraic and geometric error: the Sampson distance is an algebraic residual with a weight that makes it a first-order geometric distance.
  • RANSAC: the Sampson distance is a common test for inliers of a fundamental or essential matrix, since it is cheap and is in pixels.
  • Homography estimation and the fundamental matrix: minimizing the sum of Sampson errors over the model parameters alone, with Gauss-Newton or Levenberg-Marquardt, gives results close to the Gold Standard method at a lower cost.
  • Sampson correction: the vector δS\boldsymbol{\delta}_S itself, added to the measured points, is a first-order correction of a match onto the variety (HZ Section 12.4).

References

  1. Paul D. Sampson, Fitting conic sections to very scattered data: an iterative refinement of the Bookstein algorithm, Computer Graphics and Image Processing 18(1), 1982, 97-108, the weighting of the algebraic residual of a conic by its gradient
  2. Richard Hartley and Andrew Zisserman, Multiple View Geometry in Computer Vision, second edition, Cambridge University Press, 2004, Section 4.2.6, Sampson error (the derivation for a homography and the general form); Section 11.4, Geometric distance (the Sampson approximation for the fundamental matrix); Section 12.4, Sampson approximation (first-order geometric correction)

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/JT9XCG/text.yaml