Class DecomposedLinePlaneCorrespondencePinholeCameraRefiner


public class DecomposedLinePlaneCorrespondencePinholeCameraRefiner extends LinePlaneCorrespondencePinholeCameraRefiner
A pinhole camera refiner using line/plane correspondences and the Powell algorithm to try to decrease overall error in LMSE terms among inlier samples by taking the decomposed parameters of a pinhole camera. Typically, this refiner is used by a robust estimator, however it can also be useful in some other situations.
  • Field Details

    • DEFAULT_MIN_SUGGESTION_WEIGHT

      public static final double DEFAULT_MIN_SUGGESTION_WEIGHT
      Default value for minimum suggestion weight. This weight is used to slowly draw original camera parameters into desired suggested values. Suggestion weight slowly increases each time Levenberg-Marquardt is used to find a solution so that the algorithm can converge into desired value. The faster the weights are increased the less likely that suggested values can be converged if they differ too much from the original ones.
      See Also:
    • DEFAULT_MAX_SUGGESTION_WEIGHT

      public static final double DEFAULT_MAX_SUGGESTION_WEIGHT
      Default value for maximum suggestion weight. This weight is used to slowly draw original camera parameters into desired suggested values. Suggestion weight slowly increases each time Levenberg-Marquardt is used to find a solution so that the algorithm can converge into desired value. The faster the weights are increased the less likely that suggested values can be converged if they differ too much from the original ones.
      See Also:
    • DEFAULT_SUGGESTION_WEIGHT_STEP

      public static final double DEFAULT_SUGGESTION_WEIGHT_STEP
      Default value for the step to increase suggestion weight. This weight is used to slowly draw original camera parameters into desired suggested values. Suggestion weight slowly increases each time Levenberg-Marquardt is used to find a solution so that the algorithm can converge into desired value. The faster the weights are increased the less likely that suggested values can be converged if they differ too much from the original ones.
      See Also:
    • REFINE_DIMS

      private static final int REFINE_DIMS
      Dimensions for refinement.
      See Also:
    • minSuggestionWeight

      private double minSuggestionWeight
      Minimum suggestion weight. This weight is used to slowly draw original camera parameters into desired suggested values. Suggestion weight slowly increases each time Levenberg-Marquardt is used to find a solution so that the algorithm can converge into desired value. The faster the weights are increased the less likely that suggested values can be converged if they differ too much from the original ones.
    • maxSuggestionWeight

      private double maxSuggestionWeight
      Maximum suggestion weight. This weight is used to slowly draw original camera parameters into desired suggested values. Suggestion weight slowly increases each time Levenberg-Marquardt is used to find a solution so that the algorithm can converge into desired value. The faster the weights are increased the less likely that suggested values can be converged if they differ too much from the original ones.
    • suggestionWeightStep

      private double suggestionWeightStep
      Step to increase suggestion weight. This weight is used to slowly draw original camera parameters into desired suggested values. Suggestion weight slowly increases each time Levenberg-Marquardt is used to find a solution so that the algorithm can converge into desired value. The faster the weights are increased the less likely that suggested values can be converged if they differ too much from the original ones.
    • refineCamera

      private PinholeCamera refineCamera
      Instance of a pinhole camera to be reused during refinement.
    • currentWeight

      private double currentWeight
      Current weight during refinement.
  • Constructor Details

    • DecomposedLinePlaneCorrespondencePinholeCameraRefiner

      public DecomposedLinePlaneCorrespondencePinholeCameraRefiner()
      Constructor.
    • DecomposedLinePlaneCorrespondencePinholeCameraRefiner

      public DecomposedLinePlaneCorrespondencePinholeCameraRefiner(PinholeCamera initialEstimation, boolean keepCovariance, BitSet inliers, double[] residuals, int numInliers, List<Plane> samples1, List<Line2D> 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.
    • DecomposedLinePlaneCorrespondencePinholeCameraRefiner

      public DecomposedLinePlaneCorrespondencePinholeCameraRefiner(PinholeCamera initialEstimation, boolean keepCovariance, com.irurueta.numerical.robust.InliersData inliersData, List<Plane> samples1, List<Line2D> 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

    • getMinSuggestionWeight

      public double getMinSuggestionWeight()
      Gets minimum suggestion weight. This weight is used to slowly draw original camera parameters into desired suggested values. Suggestion weight slowly increases each time Levenberg-Marquardt is used to find a solution so that the algorithm can converge into desired value. The faster the weights are increased the less likely that suggested values can be converged if they differ too much from the original ones.
      Returns:
      minimum suggestion weight.
    • setMinSuggestionWeight

      public void setMinSuggestionWeight(double minSuggestionWeight) throws LockedException
      Sets minimum suggestion weight. This weight is used to slowly draw original camera parameters into desired suggested values. Suggestion weight slowly increases each time Levenberg-Marquardt is used to find a solution so that the algorithm can converge into desired value. The faster the weights are increased the less likely that suggested values can be converged if they differ too much from the original ones.
      Parameters:
      minSuggestionWeight - minimum suggestion weight.
      Throws:
      LockedException - if estimator is locked.
    • getMaxSuggestionWeight

      public double getMaxSuggestionWeight()
      Gets maximum suggestion weight. This weight is used to slowly draw original camera parameters into desired suggested values. Suggestion weight slowly increases each time Levenberg-Marquardt is used to find a solution so that the algorithm can converge into desired value. The faster the weights are increased the less likely that suggested values can be converged if they differ too much from the original ones.
      Returns:
      maximum suggestion weight.
    • setMaxSuggestionWeight

      public void setMaxSuggestionWeight(double maxSuggestionWeight) throws LockedException
      Sets maximum suggestion weight. This weight is used to slowly draw original camera parameters into desired suggested values. Suggestion weight slowly increases each time Levenberg-Marquardt is used to find a solution so that the algorithm can converge into desired value. The faster the weights are increased the less likely that suggested values can be converged if they differ too much from the original ones.
      Parameters:
      maxSuggestionWeight - maximum suggestion weight.
      Throws:
      LockedException - if estimator is locked.
    • setMinMaxSuggestionWeight

      public void setMinMaxSuggestionWeight(double minSuggestionWeight, double maxSuggestionWeight) throws LockedException
      Sets minimum and maximum suggestion weights. Suggestion weight is used to slowly draw original camera parameters into desired suggested values. Suggestion weight slowly increases each time Levenberg-Marquardt is used to find a solution so that the algorithm can converge into desired value. The faster the weights are increased the less likely that suggested values can be converged if they differ too much from the original ones.
      Parameters:
      minSuggestionWeight - minimum suggestion weight.
      maxSuggestionWeight - maximum suggestion weight.
      Throws:
      LockedException - if estimator is locked.
      IllegalArgumentException - if minimum suggestion weight is greater or equal than maximum value.
    • getSuggestionWeightStep

      public double getSuggestionWeightStep()
      Gets step to increase suggestion weight. This weight is used to slowly draw original camera parameters into desired suggested values. Suggestion weight slowly increases each time Levenberg-Marquardt is used to find a solution so that the algorithm can converge into desired value. The faster the weights are increased the less likely that suggested values can be converged if they differ too much from the original ones.
      Returns:
      step to increase suggestion weight.
    • setSuggestionWeightStep

      public void setSuggestionWeightStep(double suggestionWeightStep) throws LockedException
      Sets step to increase suggestion weight. This weight is used to slowly draw original camera parameters into desired suggested values. Suggestion weight slowly increases each time Levenberg-Marquardt is used to find a solution so that the algorithm can converge into desired value. The faster the weights are increased the less likely that suggested values can be converged if they differ too much from the original ones.
      Parameters:
      suggestionWeightStep - step to increase suggestion weight.
      Throws:
      LockedException - if estimator is locked.
      IllegalArgumentException - if provided step is negative or zero.
    • refine

      public boolean refine(PinholeCamera result) throws NotReadyException, LockedException
      Refines provided initial estimation. This method always sets a value into provided result instance regardless of the fact that error has actually improved in LMSE terms or not.
      Specified by:
      refine in class Refiner<PinholeCamera>
      Parameters:
      result - instance where refined estimation will be stored.
      Returns:
      true if result improves (decreases) in LMSE terms respect to initial estimation, false if no improvement has been achieved.
      Throws:
      NotReadyException - if not enough input data has been provided.
      LockedException - if estimator is locked because refinement is already in progress.
    • estimateCovarianceLevenbergMarquardt

      private com.irurueta.algebra.Matrix estimateCovarianceLevenbergMarquardt(PinholeCamera pinholeCamera, double weight)
      Estimates covariance matrix for provided estimated and refined camera
      Parameters:
      pinholeCamera - pinhole camera to estimate covariance for.
      weight - weight for suggestion residual.
      Returns:
      estimated covariance or null if anything fails.
    • refinePowell

      private boolean refinePowell(PinholeCamera result)
      Refines camera using Powell optimization to minimize a cost function consisting on the sum of squared projection residuals plus the suggestion residual for any suggested terms.
      Parameters:
      result - instance where refined estimation will be stored.
      Returns:
      true if result improves (decreases) in LMSE terms respect to initial estimation, false if no improvement has been achieved.
    • refinementStepPowell

      private boolean refinementStepPowell(com.irurueta.numerical.optimization.PowellMultiOptimizer optimizer, DecomposedLinePlaneCorrespondencePinholeCameraRefiner.RefinementMultiDimensionFunctionEvaluatorListener listener, double[] startPoint, double weight) throws GeometryException, com.irurueta.numerical.NumericalException
      Computes one refinement step using Powell optimizer for a given weight on suggestion terms.
      Parameters:
      optimizer - Powell optimizer to be reused.
      listener - Powell optimizer listener to be reused.
      startPoint - starting point for powell optimization. This array is passed only for reuse purposes.
      weight - suggestion terms weight.
      Returns:
      true if this refinement step decreased projection error in LMSE terms, false otherwise.
      Throws:
      GeometryException - if something failed.
      com.irurueta.numerical.NumericalException - if something failed.