Package com.irurueta.geometry.refiners
Class PointCorrespondencePinholeCameraRefiner
java.lang.Object
com.irurueta.geometry.refiners.Refiner<PinholeCamera>
com.irurueta.geometry.refiners.InliersDataRefiner<PinholeCamera>
com.irurueta.geometry.refiners.PairMatchesAndInliersDataRefiner<PinholeCamera,Point3D,Point2D>
com.irurueta.geometry.refiners.PinholeCameraRefiner<Point3D,Point2D>
com.irurueta.geometry.refiners.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 Summary
FieldsModifier and TypeFieldDescriptionprivate final Point2DPoint to be reused when computing residuals.Fields inherited from class com.irurueta.geometry.refiners.PinholeCameraRefiner
DEFAULT_SUGGEST_ASPECT_RATIO_ENABLED, DEFAULT_SUGGEST_CENTER_ENABLED, DEFAULT_SUGGEST_HORIZONTAL_FOCAL_LENGTH_ENABLED, DEFAULT_SUGGEST_PRINCIPAL_POINT_ENABLED, DEFAULT_SUGGEST_ROTATION_ENABLED, DEFAULT_SUGGEST_SKEWNESS_VALUE_ENABLED, DEFAULT_SUGGEST_VERTICAL_FOCAL_LENGTH_ENABLED, DEFAULT_SUGGESTED_ASPECT_RATIO_VALUE, DEFAULT_SUGGESTED_SKEWNESS_VALUE, refinementStandardDeviationFields inherited from class com.irurueta.geometry.refiners.PairMatchesAndInliersDataRefiner
samples1, samples2Fields inherited from class com.irurueta.geometry.refiners.InliersDataRefiner
inliers, numInliers, residualsFields inherited from class com.irurueta.geometry.refiners.Refiner
covariance, DEFAULT_KEEP_COVARIANCE, initialEstimation, keepCovariance, listener, locked -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructor.protectedPointCorrespondencePinholeCameraRefiner(PinholeCamera initialEstimation, boolean keepCovariance, com.irurueta.numerical.robust.InliersData inliersData, List<Point3D> samples1, List<Point2D> samples2, double refinementStandardDeviation) Constructor.protectedPointCorrespondencePinholeCameraRefiner(PinholeCamera initialEstimation, boolean keepCovariance, BitSet inliers, double[] residuals, int numInliers, List<Point3D> samples1, List<Point2D> samples2, double refinementStandardDeviation) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprivate doubleprojectionResidual(PinholeCamera pinholeCamera) Computes total point projection residual for provided camera.protected doubleresidualLevenbergMarquardt(PinholeCamera pinholeCamera, Point3D point3D, Point2D point2D, double[] params, double weight) Computes total residual to be used during Levenberg/Marquardt covariance estimation.protected doubleresidualPowell(PinholeCamera pinholeCamera, double[] params, double weight) Total residual to be used during Powell refinement.private doublesingleProjectionResidual(PinholeCamera pinholeCamera, Point3D point3D, Point2D point2D) Projection residual/error for a single point using provided camera.Methods inherited from class com.irurueta.geometry.refiners.PinholeCameraRefiner
cameraToParameters, getRefinementStandardDeviation, getSuggestedAspectRatioValue, getSuggestedCenterValue, getSuggestedHorizontalFocalLengthValue, getSuggestedPrincipalPointValue, getSuggestedRotationValue, getSuggestedSkewnessValue, getSuggestedVerticalFocalLengthValue, hasSuggestions, isSuggestAspectRatioEnabled, isSuggestCenterEnabled, isSuggestHorizontalFocalLengthEnabled, isSuggestPrincipalPointEnabled, isSuggestRotationEnabled, isSuggestSkewnessValueEnabled, isSuggestVerticalFocalLengthEnabled, parametersToCamera, refine, setRefinementStandardDeviation, setSuggestAspectRatioEnabled, setSuggestCenterEnabled, setSuggestedAspectRatioValue, setSuggestedCenterValue, setSuggestedHorizontalFocalLengthValue, setSuggestedPrincipalPointValue, setSuggestedRotationValue, setSuggestedSkewnessValue, setSuggestedVerticalFocalLengthValue, setSuggestHorizontalFocalLengthEnabled, setSuggestPrincipalPointEnabled, setSuggestRotationEnabled, setSuggestSkewnessValueEnabled, setSuggestVerticalFocalLengthEnabled, suggestionResidualMethods inherited from class com.irurueta.geometry.refiners.PairMatchesAndInliersDataRefiner
getSamples1, getSamples2, isReady, setSamples1, setSamples2Methods inherited from class com.irurueta.geometry.refiners.InliersDataRefiner
getInliers, getNumInliers, getResiduals, getTotalSamples, setInliers, setInliersData, setNumInliers, setResidualsMethods inherited from class com.irurueta.geometry.refiners.Refiner
getCovariance, getInitialEstimation, getListener, isCovarianceKept, isLocked, refine, setCovarianceKept, setInitialEstimation, setListener
-
Field Details
-
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
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
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.
-