Class SingleHomographyPinholeCameraEstimator
java.lang.Object
com.irurueta.ar.calibration.estimators.SingleHomographyPinholeCameraEstimator
This class estimate intrinsic and extrinsic (rotation and camera center)
parameters of a camera by using provided homography.
For intrinsic parameters estimation it is assumed that skewness and principal
point are zero and that aspect ratio are known.
This class can be used in planar scenes where projected points of two views
are related by an homography.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final double
Default aspect ratio value.private double
Aspect ratio of intrinsic parameters.private com.irurueta.geometry.Transformation2D
Homography relating two views.Listener to be notified of events such as when estimation starts or ends.private boolean
True when estimation is in progress. -
Constructor Summary
ConstructorsConstructorDescriptionConstructor.Constructor with listener.SingleHomographyPinholeCameraEstimator
(com.irurueta.geometry.Transformation2D homography) Constructor with homography.SingleHomographyPinholeCameraEstimator
(com.irurueta.geometry.Transformation2D homography, SingleHomographyPinholeCameraEstimatorListener listener) Constructor with listener and homography. -
Method Summary
Modifier and TypeMethodDescriptioncom.irurueta.geometry.PinholeCamera
estimate()
Estimates a pinhole camera.void
estimate
(com.irurueta.geometry.PinholeCamera result) Estimates a pinhole camera.double
Gets aspect ratio of intrinsic parameters.com.irurueta.geometry.Transformation2D
Gets homography relating two views.Gets listener to be notified of events such as when estimation starts or ends.private void
internalSetHomography
(com.irurueta.geometry.Transformation2D homography) Sets homography to estimate camera and intrinsic parameters.boolean
isLocked()
Indicates whether this instance is locked or not.boolean
isReady()
Indicates whether this instance is locked.void
setFocalDistanceAspectRatio
(double focalDistanceAspectRatio) Sets aspect ratio of intrinsic parameters.void
setHomography
(com.irurueta.geometry.Transformation2D homography) Sets homography relating two views.void
Sets listener to be notified of events such as when estimation starts or ends.
-
Field Details
-
DEFAULT_ASPECT_RATIO
public static final double DEFAULT_ASPECT_RATIODefault aspect ratio value.- See Also:
-
focalDistanceAspectRatio
private double focalDistanceAspectRatioAspect ratio of intrinsic parameters. -
homography
private com.irurueta.geometry.Transformation2D homographyHomography relating two views. -
locked
private boolean lockedTrue when estimation is in progress. -
listener
Listener to be notified of events such as when estimation starts or ends.
-
-
Constructor Details
-
SingleHomographyPinholeCameraEstimator
public SingleHomographyPinholeCameraEstimator()Constructor. -
SingleHomographyPinholeCameraEstimator
public SingleHomographyPinholeCameraEstimator(SingleHomographyPinholeCameraEstimatorListener listener) Constructor with listener.- Parameters:
listener
- listener to be notified of events such as when estimation starts or ends.
-
SingleHomographyPinholeCameraEstimator
public SingleHomographyPinholeCameraEstimator(com.irurueta.geometry.Transformation2D homography) Constructor with homography.- Parameters:
homography
- homography to estimate camera and intrinsic parameters.- Throws:
NullPointerException
- if provided homography is null.
-
SingleHomographyPinholeCameraEstimator
public SingleHomographyPinholeCameraEstimator(com.irurueta.geometry.Transformation2D homography, SingleHomographyPinholeCameraEstimatorListener listener) Constructor with listener and homography.- Parameters:
homography
- homography to estimate camera and intrinsic parameters.listener
- listener to be notified of events such as when estimation starts or ends.
-
-
Method Details
-
getFocalDistanceAspectRatio
public double getFocalDistanceAspectRatio()Gets aspect ratio of intrinsic parameters.- Returns:
- aspect ratio of intrinsic parameters.
-
setFocalDistanceAspectRatio
public void setFocalDistanceAspectRatio(double focalDistanceAspectRatio) throws com.irurueta.geometry.estimators.LockedException Sets aspect ratio of intrinsic parameters.- Parameters:
focalDistanceAspectRatio
- aspect ratio of intrinsic parameters.- Throws:
com.irurueta.geometry.estimators.LockedException
- if estimator is locked.
-
getHomography
public com.irurueta.geometry.Transformation2D getHomography()Gets homography relating two views.- Returns:
- homography relating two views.
-
setHomography
public void setHomography(com.irurueta.geometry.Transformation2D homography) throws com.irurueta.geometry.estimators.LockedException Sets homography relating two views.- Parameters:
homography
- homography relating two views.- Throws:
com.irurueta.geometry.estimators.LockedException
- if estimator is locked.
-
isReady
public boolean isReady()Indicates whether this instance is locked.- Returns:
- true if this estimator is busy doing the estimation, false otherwise.
-
getListener
Gets listener to be notified of events such as when estimation starts or ends.- Returns:
- listener to be notified of events.
-
setListener
public void setListener(SingleHomographyPinholeCameraEstimatorListener listener) throws com.irurueta.geometry.estimators.LockedException Sets listener to be notified of events such as when estimation starts or ends.- Parameters:
listener
- listener to be notified of events.- Throws:
com.irurueta.geometry.estimators.LockedException
- if estimator is locked.
-
isLocked
public boolean isLocked()Indicates whether this instance is locked or not.- Returns:
- true if instance is locked, false otherwise.
-
estimate
public com.irurueta.geometry.PinholeCamera estimate() throws com.irurueta.geometry.estimators.LockedException, com.irurueta.geometry.estimators.NotReadyException, SingleHomographyPinholeCameraEstimatorExceptionEstimates a pinhole camera.- Returns:
- estimated pinhole camera.
- Throws:
com.irurueta.geometry.estimators.LockedException
- if estimator is locked.com.irurueta.geometry.estimators.NotReadyException
- if no homography has been provided yet.SingleHomographyPinholeCameraEstimatorException
- if estimation fails.
-
estimate
public void estimate(com.irurueta.geometry.PinholeCamera result) throws com.irurueta.geometry.estimators.LockedException, com.irurueta.geometry.estimators.NotReadyException, SingleHomographyPinholeCameraEstimatorException Estimates a pinhole camera.- Parameters:
result
- instance where estimated camera will be stored.- Throws:
com.irurueta.geometry.estimators.LockedException
- if estimator is locked.com.irurueta.geometry.estimators.NotReadyException
- if no homography has been provided yet.SingleHomographyPinholeCameraEstimatorException
- if estimation fails.
-
internalSetHomography
private void internalSetHomography(com.irurueta.geometry.Transformation2D homography) Sets homography to estimate camera and intrinsic parameters.- Parameters:
homography
- homography to be set.- Throws:
NullPointerException
- if provided homography is null.
-