Class PointCorrespondencePinholeCameraRefiner

Direct Known Subclasses:
DecomposedPointCorrespondencePinholeCameraRefiner, NonDecomposedPointCorrespondencePinholeCameraRefiner

public abstract class PointCorrespondencePinholeCameraRefiner extends PinholeCameraRefiner<Point3D,Point2D>
Base class for a pinhole camera refiner using point correspondences. Implementations of this class refine a pinhole camera by taking into account an initial estimation, inlier point matches and their residuals. This class can be used to find a solution that minimizes error of inliers in LMSE terms. Typically, a refiner is used by a robust estimator, however it can also be useful in some other situations.
  • Field Details

    • residualTestPoint

      private final Point2D residualTestPoint
      Point to be reused when computing residuals.
  • Constructor Details

    • PointCorrespondencePinholeCameraRefiner

      protected PointCorrespondencePinholeCameraRefiner()
      Constructor.
    • PointCorrespondencePinholeCameraRefiner

      protected PointCorrespondencePinholeCameraRefiner(PinholeCamera initialEstimation, boolean keepCovariance, BitSet inliers, double[] residuals, int numInliers, List<Point3D> samples1, List<Point2D> samples2, double refinementStandardDeviation)
      Constructor.
      Parameters:
      initialEstimation - initial estimation to be set.
      keepCovariance - true if covariance of estimation must be kept after refinement, false otherwise.
      inliers - set indicating which of the provided matches are inliers.
      residuals - residuals for matched samples.
      numInliers - number of inliers on initial estimation.
      samples1 - 1st set of paired samples.
      samples2 - 2nd set of paired samples.
      refinementStandardDeviation - standard deviation used for Levenberg-Marquardt fitting.
    • PointCorrespondencePinholeCameraRefiner

      protected PointCorrespondencePinholeCameraRefiner(PinholeCamera initialEstimation, boolean keepCovariance, com.irurueta.numerical.robust.InliersData inliersData, List<Point3D> samples1, List<Point2D> samples2, double refinementStandardDeviation)
      Constructor.
      Parameters:
      initialEstimation - initial estimation to be set.
      keepCovariance - true if covariance of estimation must be kept after refinement, false otherwise.
      inliersData - inlier data, typically obtained from a robust estimator.
      samples1 - 1st set of paired samples.
      samples2 - 2nd set of paired samples.
      refinementStandardDeviation - standard deviation used for Levenberg-Marquardt fitting.
  • Method Details

    • residualPowell

      protected double residualPowell(PinholeCamera pinholeCamera, double[] params, double weight)
      Total residual to be used during Powell refinement. Powell's refinement uses Powell algorithm to minimize a cost function consisting on the sum of squared projection residuals plus the suggestion residual for any suggested terms.
      Parameters:
      pinholeCamera - camera to be checked.
      params - camera parameters. In the following order: skewness, horizontal focal length, vertical focal length, horizontal principal point, vertical principal point, quaternion A, quaternion B, quaternion C, quaternion D, center x, center y, center z.
      weight - weight for suggestion residual.
      Returns:
      total residual during Powell refinement.
    • projectionResidual

      private double projectionResidual(PinholeCamera pinholeCamera)
      Computes total point projection residual for provided camera. This method computes the sum of the squared residuals for all inlier projected points.
      Parameters:
      pinholeCamera - camera to compute residual for.
      Returns:
      total projection residual.
    • residualLevenbergMarquardt

      protected double residualLevenbergMarquardt(PinholeCamera pinholeCamera, Point3D point3D, Point2D point2D, double[] params, double weight)
      Computes total residual to be used during Levenberg/Marquardt covariance estimation.
      Parameters:
      pinholeCamera - camera to estimate covariance for.
      point3D - 3D point to be projected with provided pinhole camera.
      point2D - 2D point to be compared with projected point.
      params - camera parameters. In the following order: skewness, horizontal focal length, vertical focal length, horizontal principal point, vertical principal point, quaternion A, quaternion B, quaternion C, quaternion D, center x, center y, center z.
      weight - weight for suggestion residual.
      Returns:
      total residual.
    • singleProjectionResidual

      private double singleProjectionResidual(PinholeCamera pinholeCamera, Point3D point3D, Point2D point2D)
      Projection residual/error for a single point using provided camera.
      Parameters:
      pinholeCamera - camera to be checked.
      point3D - point to be projected.
      point2D - point to check against.
      Returns:
      distance between projected point and 2D point.