Package com.irurueta.geometry.refiners
Class PinholeCameraRefiner<S1,S2>
java.lang.Object
com.irurueta.geometry.refiners.Refiner<PinholeCamera>
com.irurueta.geometry.refiners.InliersDataRefiner<PinholeCamera>
com.irurueta.geometry.refiners.PairMatchesAndInliersDataRefiner<PinholeCamera,S1,S2>
com.irurueta.geometry.refiners.PinholeCameraRefiner<S1,S2>
- Type Parameters:
S1- type of matched samples in 1st set.S2- type of matched samples in 2nd set.
- Direct Known Subclasses:
LinePlaneCorrespondencePinholeCameraRefiner,PointCorrespondencePinholeCameraRefiner
public abstract class PinholeCameraRefiner<S1,S2>
extends PairMatchesAndInliersDataRefiner<PinholeCamera,S1,S2>
Base class for pinhole camera refiners.
Implementations of this class refine a pinhole camera by taking into account
an initial estimation, inlier point or line 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 TypeFieldDescriptionstatic final booleanDefault value indicating whether aspect ratio is suggested or not.static final booleanDefault value indicating whether center is suggested or not.static final booleanDefault value indicating whether horizontal focal length value is suggested or not.static final booleanDefault value indicating whether principal point is suggested or not.static final booleanDefault value indicating whether rotation is suggested or not.static final booleanDefault value indicating whether skewness value is suggested or not.static final booleanDefault value indicating whether vertical focal length value is suggested or not.static final doubleDefault value of aspect ratio to be suggested when suggestion is enabled.static final doubleDefault value of skewness to be suggested when suggestion is enabled.protected doubleStandard deviation used for Levenberg-Marquardt fitting during refinement.private InhomogeneousPoint3DInstance to be reused to compute center.private PinholeCameraIntrinsicParametersInstance to be reused to compute residual for intrinsic parameters.private InhomogeneousPoint2DInstance to be reused to compute residual on principal point.private QuaternionInstance to be reused to compute residual on rotation.private booleanIndicates whether aspect ratio is suggested or not.private booleanIndicates whether camera center is suggested or not.private doubleSuggested aspect ratio value to be reached when suggestion is enabled.private InhomogeneousPoint3DSuggested center to be reached when suggestion is enabled.private doubleSuggested horizontal focal length value to be reached when suggestion is enabled.private InhomogeneousPoint2DSuggested principal point value to be reached when suggestion is enabled.private QuaternionSuggested rotation to be reached when suggestion is enabled.private doubleSuggested skewness value to be reached when suggestion is enabled.private doubleSuggested vertical focal length value to be reached when suggestion is enabled.private booleanIndicates whether horizontal focal length is suggested or not.private booleanIndicates whether principal point is suggested or not.private booleanIndicates whether camera rotation is suggested or not.private booleanIndicates whether skewness value is suggested or not.private booleanIndicates whether vertical focal length is suggested or not.Fields 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.protectedPinholeCameraRefiner(PinholeCamera initialEstimation, boolean keepCovariance, com.irurueta.numerical.robust.InliersData inliersData, List<S1> samples1, List<S2> samples2, double refinementStandardDeviation) Constructor.protectedPinholeCameraRefiner(PinholeCamera initialEstimation, boolean keepCovariance, BitSet inliers, double[] residuals, int numInliers, List<S1> samples1, List<S2> samples2, double refinementStandardDeviation) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcameraToParameters(PinholeCamera camera, double[] result) Sets camera parameters into array of parameters.doubleGets standard deviation used for Levenberg-Marquardt fitting during refinement.doubleGets suggested aspect ratio value to be reached when suggestion is enabled.Gets suggested center to be reached when suggestion is enabled.doubleGets suggested horizontal focal length value to be reached when suggestion is enabled.Gets suggested principal point value to be reached when suggestion is enabled.Gets suggested rotation to be reached when suggestion is enabled.doubleGets suggested skewness value to be reached when suggestion is enabled.doubleGets suggested vertical focal length value to be reached when suggestion is enabled.private booleanIndicates whether suggestions for any extrinsic parameter are required or not.private booleanIndicates whether suggestions for any intrinsic parameter are required or not.protected booleanIndicates whether obtained solution requires refinement to apply provided suggestions.booleanIndicates whether aspect ratio is suggested or not.booleanIndicates whether camera center is suggested or not.booleanIndicates whether horizontal focal length is suggested or not.booleanIndicates whether principal point is suggested or not.booleanIndicates whether camera rotation is suggested or not.booleanIndicates whether skewness value is suggested or not.booleanIndicates whether vertical focal length is suggested or not.protected voidparametersToCamera(double[] params, PinholeCamera result) Sets array of parameters into a pinhole camera.refine()Refines provided initial estimation.voidsetRefinementStandardDeviation(double refinementStandardDeviation) Sets standard deviation used for Levenberg-Marquardt fitting during refinement.voidsetSuggestAspectRatioEnabled(boolean suggestAspectRatioEnabled) Specifies whether aspect ratio is suggested or not.voidsetSuggestCenterEnabled(boolean suggestCenterEnabled) Specifies whether camera center is suggested or not.voidsetSuggestedAspectRatioValue(double suggestedAspectRatioValue) Sets suggested aspect ratio value to be reached when suggestion is enabled.voidsetSuggestedCenterValue(InhomogeneousPoint3D suggestedCenterValue) Sets suggested center to be reached when suggestion is enabled.voidsetSuggestedHorizontalFocalLengthValue(double suggestedHorizontalFocalLengthValue) Sets suggested horizontal focal length value to be reached when suggestion is enabled.voidsetSuggestedPrincipalPointValue(InhomogeneousPoint2D suggestedPrincipalPointValue) Sets suggested principal point value to be reached when suggestion is enabled.voidsetSuggestedRotationValue(Quaternion suggestedRotationValue) Sets suggested rotation to be reached when suggestion is enabled.voidsetSuggestedSkewnessValue(double suggestedSkewnessValue) Sets suggested skewness value to be reached when suggestion is enabled.voidsetSuggestedVerticalFocalLengthValue(double suggestedVerticalFocalLengthValue) Sets suggested vertical focal length value to be reached when suggestion is enabled.voidsetSuggestHorizontalFocalLengthEnabled(boolean suggestHorizontalFocalLengthEnabled) Specifies whether horizontal focal length is suggested or not.voidsetSuggestPrincipalPointEnabled(boolean suggestPrincipalPointEnabled) Specifies whether principal point is suggested or not.voidsetSuggestRotationEnabled(boolean suggestRotationEnabled) Specifies whether camera rotation is suggested or not.voidsetSuggestSkewnessValueEnabled(boolean suggestSkewnessValueEnabled) Specifies whether skewness value is suggested or not.voidsetSuggestVerticalFocalLengthEnabled(boolean suggestVerticalFocalLengthEnabled) Specifies whether vertical focal length is suggested or not.protected doublesuggestionResidual(double[] params, double weight) Residual term for any required suggestions.Methods 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
-
DEFAULT_SUGGEST_SKEWNESS_VALUE_ENABLED
public static final boolean DEFAULT_SUGGEST_SKEWNESS_VALUE_ENABLEDDefault value indicating whether skewness value is suggested or not. By default, this is disabled.- See Also:
-
DEFAULT_SUGGESTED_SKEWNESS_VALUE
public static final double DEFAULT_SUGGESTED_SKEWNESS_VALUEDefault value of skewness to be suggested when suggestion is enabled. By default suggested skewness is zero.- See Also:
-
DEFAULT_SUGGEST_HORIZONTAL_FOCAL_LENGTH_ENABLED
public static final boolean DEFAULT_SUGGEST_HORIZONTAL_FOCAL_LENGTH_ENABLEDDefault value indicating whether horizontal focal length value is suggested or not. By default, this is disabled.- See Also:
-
DEFAULT_SUGGEST_VERTICAL_FOCAL_LENGTH_ENABLED
public static final boolean DEFAULT_SUGGEST_VERTICAL_FOCAL_LENGTH_ENABLEDDefault value indicating whether vertical focal length value is suggested or not. By default, this is disabled.- See Also:
-
DEFAULT_SUGGEST_ASPECT_RATIO_ENABLED
public static final boolean DEFAULT_SUGGEST_ASPECT_RATIO_ENABLEDDefault value indicating whether aspect ratio is suggested or not. By default, this is disabled.- See Also:
-
DEFAULT_SUGGESTED_ASPECT_RATIO_VALUE
public static final double DEFAULT_SUGGESTED_ASPECT_RATIO_VALUEDefault value of aspect ratio to be suggested when suggestion is enabled. By default, suggested aspect ratio is 1.0, although also -1.0 is a typical value when vertical coordinates increase downwards.- See Also:
-
DEFAULT_SUGGEST_PRINCIPAL_POINT_ENABLED
public static final boolean DEFAULT_SUGGEST_PRINCIPAL_POINT_ENABLEDDefault value indicating whether principal point is suggested or not. By default, this is disabled.- See Also:
-
DEFAULT_SUGGEST_ROTATION_ENABLED
public static final boolean DEFAULT_SUGGEST_ROTATION_ENABLEDDefault value indicating whether rotation is suggested or not. By default, this is disabled.- See Also:
-
DEFAULT_SUGGEST_CENTER_ENABLED
public static final boolean DEFAULT_SUGGEST_CENTER_ENABLEDDefault value indicating whether center is suggested or not. By default, this is disabled.- See Also:
-
refinementStandardDeviation
protected double refinementStandardDeviationStandard deviation used for Levenberg-Marquardt fitting during refinement. Returned value gives an indication of how much variance each residual has. Typically, this value is related to the threshold used on each robust estimation, since residuals of found inliers are within the range of such threshold. -
suggestSkewnessValueEnabled
private boolean suggestSkewnessValueEnabledIndicates whether skewness value is suggested or not. When enabled, the estimator will attempt to enforce suggested value in an iterative manner starting from an initially estimated camera. Even when suggestion is enabled, the iterative algorithm might not reach suggested value if the initial value largely differs from the suggested value. -
suggestedSkewnessValue
private double suggestedSkewnessValueSuggested skewness value to be reached when suggestion is enabled. Suggested value should be close to the initially estimated value otherwise the iterative refinement might not converge to provided value. -
suggestHorizontalFocalLengthEnabled
private boolean suggestHorizontalFocalLengthEnabledIndicates whether horizontal focal length is suggested or not. When enabled, the estimator will attempt to enforce suggested value in an iterative manner starting from an initially estimated camera. Even when suggestion is enabled, the iterative algorithm might not reach suggested value if the initial value largely differs from the suggested value. -
suggestedHorizontalFocalLengthValue
private double suggestedHorizontalFocalLengthValueSuggested horizontal focal length value to be reached when suggestion is enabled. Suggested value should be close to the initially estimated value otherwise the iterative refinement might not converge to provided value. -
suggestVerticalFocalLengthEnabled
private boolean suggestVerticalFocalLengthEnabledIndicates whether vertical focal length is suggested or not. When enabled, the estimator will attempt to enforce suggested value in an iterative manner starting from an initially estimated camera. Even when suggestion is enabled, the iterative algorithm might not reach suggested value if the initial value largely differs from the suggested value. -
suggestedVerticalFocalLengthValue
private double suggestedVerticalFocalLengthValueSuggested vertical focal length value to be reached when suggestion is enabled. Suggested value should be close to the initially estimated value otherwise the iterative refinement might not converge to provided value. -
suggestAspectRatioEnabled
private boolean suggestAspectRatioEnabledIndicates whether aspect ratio is suggested or not. When enabled, the estimator will attempt to enforce suggested value in an iterative manner starting from an initially estimated camera. Even when suggestion is enabled, the iterative algorithm might not reach suggested value if the initial value largely differs from the suggested value. -
suggestedAspectRatioValue
private double suggestedAspectRatioValueSuggested aspect ratio value to be reached when suggestion is enabled. Suggested value should be close to the initially estimated value otherwise the iterative refinement might not converge to provided value. -
suggestPrincipalPointEnabled
private boolean suggestPrincipalPointEnabledIndicates whether principal point is suggested or not. When enabled, the estimator will attempt to enforce suggested value in an iterative manner starting from an initially estimated camera. Even when suggestion is enabled, the iterative algorithm might not reach suggested value if the initial value largely differs from the suggested value. -
suggestedPrincipalPointValue
Suggested principal point value to be reached when suggestion is enabled. Suggested value should be close to the initially estimated value otherwise the iterative refinement might not converge to provided value. -
suggestRotationEnabled
private boolean suggestRotationEnabledIndicates whether camera rotation is suggested or not. When enabled, the estimator will attempt to enforce suggested value in an iterative manner starting from an initially estimated camera. Even when suggestion is enabled, the iterative algorithm might not reach suggested value if the initial value largely differs from the suggested value. -
suggestedRotationValue
Suggested rotation to be reached when suggestion is enabled. Suggested value should be close to the initially estimated value otherwise the iterative refinement might not converge to provided value. -
suggestCenterEnabled
private boolean suggestCenterEnabledIndicates whether camera center is suggested or not. When enabled, the estimator will attempt to enforce suggested value in an iterative manner starting from an initially estimated camera. Even when suggestion is enabled, the iterative algorithm might not reach suggested value if the initial value largely differs from the suggested value. -
suggestedCenterValue
Suggested center to be reached when suggestion is enabled. Suggested value should be close to the initially estimated value otherwise the iterative refinement might not converge to provided value. -
residualIntrinsic
Instance to be reused to compute residual for intrinsic parameters. -
residualPrincipalPoint
Instance to be reused to compute residual on principal point. -
residualRotation
Instance to be reused to compute residual on rotation. -
residualCenter
Instance to be reused to compute center.
-
-
Constructor Details
-
PinholeCameraRefiner
protected PinholeCameraRefiner()Constructor. -
PinholeCameraRefiner
protected PinholeCameraRefiner(PinholeCamera initialEstimation, boolean keepCovariance, BitSet inliers, double[] residuals, int numInliers, List<S1> samples1, List<S2> 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.
-
PinholeCameraRefiner
protected PinholeCameraRefiner(PinholeCamera initialEstimation, boolean keepCovariance, com.irurueta.numerical.robust.InliersData inliersData, List<S1> samples1, List<S2> 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
-
getRefinementStandardDeviation
public double getRefinementStandardDeviation()Gets standard deviation used for Levenberg-Marquardt fitting during refinement. Returned value gives an indication of how much variance each residual has. Typically, this value is related to the threshold used on each robust estimation, since residuals of found inliers are within the range of such threshold.- Returns:
- standard deviation used for refinement.
-
setRefinementStandardDeviation
public void setRefinementStandardDeviation(double refinementStandardDeviation) throws LockedException Sets standard deviation used for Levenberg-Marquardt fitting during refinement. Returned value gives an indication of how much variance each residual has. Typically, this value is related to the threshold used on each robust estimation, since residuals of found inliers are within the range of such threshold.- Parameters:
refinementStandardDeviation- standard deviation used for refinement.- Throws:
LockedException- if estimator is locked.
-
isSuggestSkewnessValueEnabled
public boolean isSuggestSkewnessValueEnabled()Indicates whether skewness value is suggested or not. When enabled, the estimator will attempt to enforce suggested value in an iterative manner starting from an initially estimated camera. Even when suggestion is enabled, the iterative algorithm might not reach suggested value if the initial value largely differs from the suggested value.- Returns:
- true if skewness value is suggested, false otherwise.
-
setSuggestSkewnessValueEnabled
public void setSuggestSkewnessValueEnabled(boolean suggestSkewnessValueEnabled) throws LockedException Specifies whether skewness value is suggested or not. When enabled, the estimator will attempt to enforce suggested value in an iterative manner starting from an initially estimated camera. Even when suggestion is enabled, the iterative algorithm might not reach suggested value if the initial value largely differs from the suggested value.- Parameters:
suggestSkewnessValueEnabled- true if skewness value is suggested, false otherwise.- Throws:
LockedException- if estimator is locked.
-
getSuggestedSkewnessValue
public double getSuggestedSkewnessValue()Gets suggested skewness value to be reached when suggestion is enabled. Suggested value should be close to the initially estimated value otherwise the iterative refinement might not converge to provided value.- Returns:
- suggested skewness value.
-
setSuggestedSkewnessValue
Sets suggested skewness value to be reached when suggestion is enabled. Suggested value should be close to the initially estimated value otherwise the iterative refinement might not converge to provided value.- Parameters:
suggestedSkewnessValue- suggested skewness value.- Throws:
LockedException- if estimator is locked.
-
isSuggestHorizontalFocalLengthEnabled
public boolean isSuggestHorizontalFocalLengthEnabled()Indicates whether horizontal focal length is suggested or not. When enabled, the estimator will attempt to enforce suggested value in an iterative manner starting from an initially estimated camera. Even when suggestion is enabled, the iterative algorithm might not reach suggested value if the initial value largely differs from the suggested value.- Returns:
- true if horizontal focal length is suggested, false otherwise.
-
setSuggestHorizontalFocalLengthEnabled
public void setSuggestHorizontalFocalLengthEnabled(boolean suggestHorizontalFocalLengthEnabled) throws LockedException Specifies whether horizontal focal length is suggested or not. When enabled, the estimator will attempt to enforce suggested value in an iterative manner starting from an initially estimated camera. Even when suggestion is enabled, the iterative algorithm might not reach suggested value if the initial value largely differs from the suggested value.- Parameters:
suggestHorizontalFocalLengthEnabled- true if horizontal focal length is suggested, false otherwise.- Throws:
LockedException- if estimator is locked.
-
getSuggestedHorizontalFocalLengthValue
public double getSuggestedHorizontalFocalLengthValue()Gets suggested horizontal focal length value to be reached when suggestion is enabled. Suggested value should be close to the initially estimated value otherwise the iterative refinement might not converge to provided value.- Returns:
- suggested horizontal focal length value.
-
setSuggestedHorizontalFocalLengthValue
public void setSuggestedHorizontalFocalLengthValue(double suggestedHorizontalFocalLengthValue) throws LockedException Sets suggested horizontal focal length value to be reached when suggestion is enabled. Suggested value should be close to the initially estimated value otherwise the iterative refinement might not converge to provided value.- Parameters:
suggestedHorizontalFocalLengthValue- suggested horizontal focal length value.- Throws:
LockedException- if estimator is locked.
-
isSuggestVerticalFocalLengthEnabled
public boolean isSuggestVerticalFocalLengthEnabled()Indicates whether vertical focal length is suggested or not. When enabled, the estimator will attempt to enforce suggested value in an iterative manner starting from an initially estimated camera. Even when suggestion is enabled, the iterative algorithm might not reach suggested value if the initial value largely differs from the suggested value.- Returns:
- true if vertical focal length is suggested, false otherwise.
-
setSuggestVerticalFocalLengthEnabled
public void setSuggestVerticalFocalLengthEnabled(boolean suggestVerticalFocalLengthEnabled) throws LockedException Specifies whether vertical focal length is suggested or not. When enabled, the estimator will attempt to enforce suggested value in an iterative manner starting from an initially estimated camera. Even when suggestion is enabled, the iterative algorithm might not reach suggested value if the initial value largely differs from the suggested value.- Parameters:
suggestVerticalFocalLengthEnabled- true if vertical focal length is suggested, false otherwise.- Throws:
LockedException- if estimator is locked.
-
getSuggestedVerticalFocalLengthValue
public double getSuggestedVerticalFocalLengthValue()Gets suggested vertical focal length value to be reached when suggestion is enabled. Suggested value should be close to the initially estimated value otherwise the iterative refinement might not converge to provided value.- Returns:
- suggested vertical focal length.
-
setSuggestedVerticalFocalLengthValue
public void setSuggestedVerticalFocalLengthValue(double suggestedVerticalFocalLengthValue) throws LockedException Sets suggested vertical focal length value to be reached when suggestion is enabled. Suggested value should be close to the initially estimated value otherwise the iterative refinement might not converge to provided value.- Parameters:
suggestedVerticalFocalLengthValue- suggested vertical focal length.- Throws:
LockedException- if estimator is locked.
-
isSuggestAspectRatioEnabled
public boolean isSuggestAspectRatioEnabled()Indicates whether aspect ratio is suggested or not. When enabled, the estimator will attempt to enforce suggested value in an iterative manner starting from an initially estimated camera. Even when suggestion is enabled, the iterative algorithm might not reach suggested value if the initial value largely differs from the suggested value.- Returns:
- true if aspect ratio is suggested, false otherwise.
-
setSuggestAspectRatioEnabled
Specifies whether aspect ratio is suggested or not. When enabled, the estimator will attempt to enforce suggested value in an iterative manner starting from an initially estimated camera. Even when suggestion is enabled, the iterative algorithm might not reach suggested value if the initial value largely differs from the suggested value.- Parameters:
suggestAspectRatioEnabled- true if aspect ratio is suggested, false otherwise.- Throws:
LockedException- if estimator is locked.
-
getSuggestedAspectRatioValue
public double getSuggestedAspectRatioValue()Gets suggested aspect ratio value to be reached when suggestion is enabled. Suggested value should be close to the initially estimated value otherwise the iterative refinement might not converge to provided value.- Returns:
- suggested aspect ratio value.
-
setSuggestedAspectRatioValue
Sets suggested aspect ratio value to be reached when suggestion is enabled. Suggested value should be close to the initially estimated value otherwise the iterative refinement might not converge to provided value.- Parameters:
suggestedAspectRatioValue- suggested aspect ratio value.- Throws:
LockedException- if estimator is locked.
-
isSuggestPrincipalPointEnabled
public boolean isSuggestPrincipalPointEnabled()Indicates whether principal point is suggested or not. When enabled, the estimator will attempt to enforce suggested value in an iterative manner starting from an initially estimated camera. Even when suggestion is enabled, the iterative algorithm might not reach suggested value if the initial value largely differs from the suggested value.- Returns:
- true if principal point is suggested, false otherwise.
-
setSuggestPrincipalPointEnabled
public void setSuggestPrincipalPointEnabled(boolean suggestPrincipalPointEnabled) throws LockedException Specifies whether principal point is suggested or not. When enabled, the estimator will attempt to enforce suggested value in an iterative manner starting from an initially estimated camera. Even when suggestion is enabled, the iterative algorithm might not reach suggested value if the initial value largely differs from the suggested value.- Parameters:
suggestPrincipalPointEnabled- true if principal point is suggested, false otherwise.- Throws:
LockedException- if estimator is locked.
-
getSuggestedPrincipalPointValue
Gets suggested principal point value to be reached when suggestion is enabled. Suggested value should be close to the initially estimated value otherwise the iterative refinement might not converge to provided value.- Returns:
- suggested principal point value to be reached when suggestion is enabled.
-
setSuggestedPrincipalPointValue
public void setSuggestedPrincipalPointValue(InhomogeneousPoint2D suggestedPrincipalPointValue) throws LockedException Sets suggested principal point value to be reached when suggestion is enabled. Suggested value should be close to the initially estimated value otherwise the iterative refinement might not converge to provided value.- Parameters:
suggestedPrincipalPointValue- suggested principal point value to be reached when suggestion is enabled.- Throws:
LockedException- if estimator is locked.
-
isSuggestRotationEnabled
public boolean isSuggestRotationEnabled()Indicates whether camera rotation is suggested or not. When enabled, the estimator will attempt to enforce suggested value in an iterative manner starting from an initially estimated camera. Even when suggestion is enabled, the iterative algorithm might not reach suggested value if the initial value largely differs from the suggested value.- Returns:
- true if camera rotation is suggested, false otherwise.
-
setSuggestRotationEnabled
Specifies whether camera rotation is suggested or not. When enabled, the estimator will attempt to enforce suggested value in an iterative manner starting from an initially estimated camera. Even when suggestion is enabled, the iterative algorithm might not reach suggested value if the initial value largely differs from the suggested value.- Parameters:
suggestRotationEnabled- true if camera rotation is suggested, false otherwise.- Throws:
LockedException- if estimator is locked.
-
getSuggestedRotationValue
Gets suggested rotation to be reached when suggestion is enabled. Suggested value should be close to the initially estimated value otherwise the iterative refinement might not converge to provided value.- Returns:
- suggested rotation to be reached when suggestion is enabled.
-
setSuggestedRotationValue
Sets suggested rotation to be reached when suggestion is enabled. Suggested value should be close to the initially estimated value otherwise the iterative refinement might not converge to provided value.- Parameters:
suggestedRotationValue- suggested rotation to be reached when suggestion is enabled.- Throws:
LockedException- if estimator is locked.
-
isSuggestCenterEnabled
public boolean isSuggestCenterEnabled()Indicates whether camera center is suggested or not. When enabled, the estimator will attempt to enforce suggested value in an iterative manner starting from an initially estimated camera. Even when suggestion is enabled, the iterative algorithm might not reach suggested value if the initial value largely differs from the suggested value.- Returns:
- true if camera center is suggested, false otherwise.
-
setSuggestCenterEnabled
Specifies whether camera center is suggested or not. When enabled, the estimator will attempt to enforce suggested value in an iterative manner starting from an initially estimated camera. Even when suggestion is enabled, the iterative algorithm might not reach suggested value if the initial value largely differs from the suggested value.- Parameters:
suggestCenterEnabled- true if camera is suggested, false otherwise.- Throws:
LockedException- if estimator is locked.
-
getSuggestedCenterValue
Gets suggested center to be reached when suggestion is enabled. Suggested value should be close to the initially estimated value otherwise the iterative refinement might not converge to provided value.- Returns:
- suggested center to be reached when suggestion is enabled.
-
setSuggestedCenterValue
public void setSuggestedCenterValue(InhomogeneousPoint3D suggestedCenterValue) throws LockedException Sets suggested center to be reached when suggestion is enabled. Suggested value should be close to the initially estimated value otherwise the iterative refinement might not converge to provided value.- Parameters:
suggestedCenterValue- suggested center to be reached when suggestion is enabled.- Throws:
LockedException- if estimator is locked.
-
refine
Refines provided initial estimation.- Specified by:
refinein classRefiner<PinholeCamera>- Returns:
- refines estimation.
- Throws:
NotReadyException- if not enough input data has been provided.LockedException- if estimator is locked because refinement is already in progress.RefinerException- if refinement fails for some reason (e.g. unable to converge to a result).
-
suggestionResidual
protected double suggestionResidual(double[] params, double weight) Residual term for any required suggestions.- Parameters:
params- parameters being optimized. 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 to apply to obtained residual. This weight increases on each iteration to help into achieving required suggested values.- Returns:
- term for any required suggestion.
-
parametersToCamera
Sets array of parameters into a pinhole camera. This method is used internally during refinement.- Parameters:
params- parameters to be set. 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.result- instance where parameters will be set.
-
cameraToParameters
protected void cameraToParameters(PinholeCamera camera, double[] result) throws CameraException, NotAvailableException Sets camera parameters into array of parameters. This method is used internally during refinement.- Parameters:
camera- camera to obtain parameters to be set into array.result- array where extracted parameters are stored. 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.- Throws:
CameraException- if camera cannot be decomposed.NotAvailableException- if any camera component cannot be retrieved.
-
hasSuggestions
protected boolean hasSuggestions()Indicates whether obtained solution requires refinement to apply provided suggestions.- Returns:
- true if solution requires refinement to apply provided suggestions, false otherwise.
-
hasIntrinsicSuggestions
private boolean hasIntrinsicSuggestions()Indicates whether suggestions for any intrinsic parameter are required or not.- Returns:
- true if suggestions for any intrinsic parameters are required, false otherwise.
-
hasExtrinsicSuggestions
private boolean hasExtrinsicSuggestions()Indicates whether suggestions for any extrinsic parameter are required or not.- Returns:
- true if suggestions for any extrinsic parameter are required, false otherwise.
-