Class HomographyRadial6Pts

java.lang.Object
boofcv.alg.geo.h.HomographyRadial6Pts
All Implemented Interfaces:
VerbosePrint

public class HomographyRadial6Pts extends Object implements VerbosePrint

Estimates homography between two views and independent radial distortion from each camera. Radial distortion is modeled using the one parameter division model [1]. Implementation based on the 6-point algorithm in [2] that solves 2 quadratic equations and 6 linear equations. See Tech Report [3] for the final form of equations used in code below.

Undistortion model:

f(x,y) = [x, y, 1 + λ(x**2 + y**2)]T

where λ is the radial distortion parameter from one of the cameras.

NOTE: This assumes that the center of distortion is the center of the image. I.e. image center = (0,0)

NOTE: This will work on homographies induced from planes or pure rotations

NOTE: Modified from original description to handle > 6 points

  1. Fitzgibbon, Andrew W. "Simultaneous linear estimation of multiple view geometry and lens distortion." CVPR 2001
  2. Kukelova, Z., Heller, J., Bujnak, M., & Pajdla, T. "Radial distortion homography" (2015)
  3. Peter Abeles, "Notes on Scene Reconstruction: BoofCV Technical Report", 2022
  • Constructor Details

    • HomographyRadial6Pts

      public HomographyRadial6Pts()
  • Method Details

    • process

      public boolean process(List<AssociatedPair> points)

      Computes the homography matrix given a set of observed points in two images. A set of AssociatedPair is passed in. The computed homography 'H' is found such that the attributes 'p1' and 'p2' in AssociatedPair refers to x1 and x2, respectively, in the equation below:
      x2 = H*x1

      To get the output call #getFound(). One way to evaluate multiple solutions to see which one is best is to call computeResidualError(List, Result).
      Parameters:
      points - A set of observed image points that are generated from a planar object. Minimum of 6 pairs required.
      Returns:
      True if successful. False if it failed.
    • computeResidualError

      public static double computeResidualError(List<AssociatedPair> points, HomographyRadial6Pts.Result result)
      Used to evaluate how good a hypothesis is by removing radial distortion from points then applying the found homography. The difference between the observed undistorted point and the predicted point in view 2 is the computed and summed across all points.
      Parameters:
      points - Observed point pairs
      result - Hypothesis
      Returns:
      sqrt(sum residual error squared)/N
    • setVerbose

      public void setVerbose(@Nullable @Nullable PrintStream out, @Nullable @Nullable Set<String> configuration)
      Specified by:
      setVerbose in interface VerbosePrint