Class RefineDualQuadraticAlgebraicError

All Implemented Interfaces:

public class RefineDualQuadraticAlgebraicError extends Object implements VerbosePrint

Non-linear refinement of Dual Quadratic using algebraic error. Different assumptions about the intrinsics parameters can be made, and the number of cameras can be less than the number of views. This should be called after a linear estimate has been generated and should be followed up by bundle adjustment. The optimization function is parameterized using intrinsic parameters of each camera directly along with the plane at infinity.

Optional Assumptions: known aspect ratio, known principle point, single camera.

w*i = Ki *KTi
w*i = PiQ*PTi

where Ki is the 3x3 camera calibration matrix for view i. Q is a 4x4 symmetric matrix and is the absolute dual quadratic. Pi is a projective transform from view i+1 to i.

A[i] = PiQ*PTi
residual[i] = w*i/||w*i|| - A[i]/||A[i]||

Residuals are computed for each projective. The F-norm of the residuals are what is minimized. w and A are normalized to ensure that they have the same scale. NOTE: It would be possible to add zero-skew but this is much more simplistic without it and you rarely need to relax the assumptions.
  1. R. Hartley, and A. Zisserman, "Multiple View Geometry in Computer Vision", 2nd Ed, Cambridge 2003
See Also:
  • Field Details

    • minimizer

      Optimization algorithm
    • knownAspect

      public boolean knownAspect
      If true then the images are assumed to have a known aspect ratio
    • knownPrinciplePoint

      public boolean knownPrinciplePoint
      If true then the image center is assumed to be known
    • converge

      public final ConfigConverge converge
      Convergence criteria
    • planeAtInfinity

      public final Point3D_F64 planeAtInfinity
      Resulting plane at infinity that was found
    • cameras

      Found/updated camera parameters
  • Constructor Details

    • RefineDualQuadraticAlgebraicError

      public RefineDualQuadraticAlgebraicError()
  • Method Details

    • initialize

      public void initialize(int numCameras, int numViews)
      Must call this function before all others. Specifies the number of cameras and views. Preallocates memory.
      numCameras - Number of cameras.
      numViews - Number of views.
    • setCamera

      public void setCamera(int cameraIndex, double fx, double cx, double cy, double aspectRatio)
      Specifies the initial parameters or known parameters for a camera
      cameraIndex - index of the camera
      fx - focal length x-axis
      cx - image center. x-axis
      cy - image center. y-axis
      aspectRatio - aspect ratio
    • setViewToCamera

      public void setViewToCamera(int viewIndex, int cameraIndex)
      Specifies which view was generated by which camera
    • setProjective

      public void setProjective(int cameraIndex, DMatrixRMaj P)
      The observed camera matrix
      P - Camera matrix. 3x4
    • setPlaneAtInfinity

      public void setPlaneAtInfinity(double x, double y, double z)
      Specifies the initial state for the plane at infinity
    • refine

      public boolean refine()
      Refines the initial parameters to minimize algebraic error.
      true if there are no catastrophic errors
    • encodeParameters

      protected void encodeParameters(Point3D_F64 planeAtInfinity, DogArray<RefineDualQuadraticAlgebraicError.CameraState> cameras, double[] parameters)
    • decodeParameters

      protected void decodeParameters(double[] parameters, DogArray<RefineDualQuadraticAlgebraicError.CameraState> cameras, Point3D_F64 planeAtInfinity)
    • encodeKK

      protected void encodeKK(RefineDualQuadraticAlgebraicError.CameraState camera, DMatrixRMaj kk)
      Computes K*K
    • encodeQ

      protected void encodeQ(RefineDualQuadraticAlgebraicError.CameraState camera, double infx, double infy, double infz, DMatrixRMaj Q)
      Encodes the ADQ
    • setVerbose

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