Class RadialDistortionEstimator
java.lang.Object
com.irurueta.ar.calibration.estimators.RadialDistortionEstimator
- Direct Known Subclasses:
LMSERadialDistortionEstimator,WeightedRadialDistortionEstimator
This class defines the interface for an estimator of radial distortion
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final RadialDistortionEstimatorTypeDefault estimator type.static final doubleDefines default focal length if none is defined.static final intDefault number of radial distortion parameters.static final doubleDefines default skewness if none is defined.protected List<com.irurueta.geometry.Point2D> List of distorted points.protected com.irurueta.geometry.Point2DDistortion center.protected doubleHorizontal focal length expressed in pixels.protected com.irurueta.algebra.MatrixIntrinsic parameters matrix.protected RadialDistortionEstimatorListenerListener to be notified of events such as when estimation starts, ends or estimation progress changes.protected booleanTrue when estimator is estimating radial distortion.static final intMinimum number of radial distortion parameters.protected intNumber of radial distortion parameters to estimate.protected doubleSkew in pixels.protected List<com.irurueta.geometry.Point2D> List of undistorted points.protected doubleVertical focal length expressed in pixels. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructor.protectedConstructor with listener.protectedRadialDistortionEstimator(com.irurueta.geometry.Point2D distortionCenter) Constructor with distortion center.protectedRadialDistortionEstimator(com.irurueta.geometry.Point2D distortionCenter, RadialDistortionEstimatorListener listener) Constructor with listener and distortion center.protectedRadialDistortionEstimator(List<com.irurueta.geometry.Point2D> distortedPoints, List<com.irurueta.geometry.Point2D> undistortedPoints) Constructor.protectedRadialDistortionEstimator(List<com.irurueta.geometry.Point2D> distortedPoints, List<com.irurueta.geometry.Point2D> undistortedPoints, RadialDistortionEstimatorListener listener) Constructor.protectedRadialDistortionEstimator(List<com.irurueta.geometry.Point2D> distortedPoints, List<com.irurueta.geometry.Point2D> undistortedPoints, com.irurueta.geometry.Point2D distortionCenter) Constructor with points and distortion center.protectedRadialDistortionEstimator(List<com.irurueta.geometry.Point2D> distortedPoints, List<com.irurueta.geometry.Point2D> undistortedPoints, com.irurueta.geometry.Point2D distortionCenter, RadialDistortionEstimatorListener listener) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionbooleanIndicates if lists of corresponding points have already been provided and are available for retrieval.booleanareValidPoints(List<com.irurueta.geometry.Point2D> distortedPoints, List<com.irurueta.geometry.Point2D> undistortedPoints) Indicates if lists of corresponding distorted and undistorted points are valid.static RadialDistortionEstimatorcreate()Creates an instance of a radial distortion estimator using default type.static RadialDistortionEstimatorCreates an instance of a radial distortion estimator using provided type.abstract RadialDistortionestimate()Estimates a radial distortion.List<com.irurueta.geometry.Point2D> Returns list of distorted points.com.irurueta.geometry.Point2DReturns distortion center.doubleReturns horizontal focal length expressed in pixels.com.irurueta.geometry.PinholeCameraIntrinsicParametersReturns pinhole camera intrinsic parameters associated to this estimator.Returns listener to be notified of events such as when estimation starts, ends or estimation progress changes.intReturns minimum number of required matched points to compute the radial distortion.intReturns number of radial distortion parameters to estimate.doublegetSkew()Returns skew expressed in pixels.abstract RadialDistortionEstimatorTypegetType()Returns type of radial distortion estimator.List<com.irurueta.geometry.Point2D> Returns list of undistorted points.doubleReturns vertical focal length expressed in pixels.private voidinternalSetPoints(List<com.irurueta.geometry.Point2D> distortedPoints, List<com.irurueta.geometry.Point2D> undistortedPoints) Sets list of corresponding distorted and undistorted points.booleanisLocked()Indicates whether this instance is locked.booleanisReady()Indicates if this estimator is ready to start th estimation.voidsetDistortionCenter(com.irurueta.geometry.Point2D distortionCenter) Sets distortion center.voidsetHorizontalFocalLength(double horizontalFocalLength) Sets horizontal focal length expressed in pixels.private voidsetInternalIntrinsic(com.irurueta.geometry.Point2D distortionCenter, double horizontalFocalLength, double verticalFocalLength, double skew) Internally sets intrinsic parameters.voidsetIntrinsic(com.irurueta.geometry.PinholeCameraIntrinsicParameters intrinsic) Sets intrinsic parameters for this estimator from pinhole camera intrinsic parameters.final voidsetIntrinsic(com.irurueta.geometry.Point2D distortionCenter, double horizontalFocalLength, double verticalFocalLength, double skew) Sets intrinsic parameters.voidsetListener(RadialDistortionEstimatorListener listener) Sets listener to be notified of events such as when estimation starts, ends or estimation progress changes.voidsetNumKParams(int numKParams) Sets number of radial distortion parameters to estimate.voidsetPoints(List<com.irurueta.geometry.Point2D> distortedPoints, List<com.irurueta.geometry.Point2D> undistortedPoints) Sets list of corresponding distorted and undistorted points.voidsetSkew(double skew) Sets skew expressed in pixels.voidsetVerticalFocalLength(double verticalFocalLength) Sets vertical focal length expressed in pixels.
-
Field Details
-
DEFAULT_NUM_K_PARAMS
public static final int DEFAULT_NUM_K_PARAMSDefault number of radial distortion parameters.- See Also:
-
MIN_K_PARAMS
public static final int MIN_K_PARAMSMinimum number of radial distortion parameters.- See Also:
-
DEFAULT_FOCAL_LENGTH
public static final double DEFAULT_FOCAL_LENGTHDefines default focal length if none is defined.- See Also:
-
DEFAULT_SKEW
public static final double DEFAULT_SKEWDefines default skewness if none is defined.- See Also:
-
DEFAULT_ESTIMATOR_TYPE
Default estimator type. -
locked
protected boolean lockedTrue when estimator is estimating radial distortion. -
listener
Listener to be notified of events such as when estimation starts, ends or estimation progress changes. -
distortionCenter
protected com.irurueta.geometry.Point2D distortionCenterDistortion center. This is usually equal to the principal point of an estimated camera. If not set it is assumed to be at the origin of coordinates (0,0). -
horizontalFocalLength
protected double horizontalFocalLengthHorizontal focal length expressed in pixels. -
verticalFocalLength
protected double verticalFocalLengthVertical focal length expressed in pixels. -
skew
protected double skewSkew in pixels. -
kInv
protected com.irurueta.algebra.Matrix kInvIntrinsic parameters matrix. -
distortedPoints
List of distorted points. Distorted points are obtained after radial distortion is applied to an undistorted point. -
undistortedPoints
List of undistorted points. -
numKParams
protected int numKParamsNumber of radial distortion parameters to estimate.
-
-
Constructor Details
-
RadialDistortionEstimator
protected RadialDistortionEstimator()Constructor. -
RadialDistortionEstimator
Constructor with listener.- Parameters:
listener- listener to be notified of events such as when estimation starts, ends or estimation progress changes.
-
RadialDistortionEstimator
protected RadialDistortionEstimator(List<com.irurueta.geometry.Point2D> distortedPoints, List<com.irurueta.geometry.Point2D> undistortedPoints) Constructor.- Parameters:
distortedPoints- list of distorted points. Distorted points are obtained after radial distortion is applied to an undistorted point.undistortedPoints- list of undistorted points.- Throws:
IllegalArgumentException- if provided lists of points don't have the same size.
-
RadialDistortionEstimator
protected RadialDistortionEstimator(List<com.irurueta.geometry.Point2D> distortedPoints, List<com.irurueta.geometry.Point2D> undistortedPoints, RadialDistortionEstimatorListener listener) Constructor.- Parameters:
distortedPoints- list of distorted points. Distorted points are obtained after radial distortion is applied to an undistorted point.undistortedPoints- list of undistorted points.listener- listener to be notified of events such as when estimation starts, ends or estimation progress changes.- Throws:
IllegalArgumentException- if provided lists of points don't have the same size.
-
RadialDistortionEstimator
protected RadialDistortionEstimator(com.irurueta.geometry.Point2D distortionCenter) Constructor with distortion center.- Parameters:
distortionCenter- Distortion center. This is usually equal to the principal point of an estimated camera. If not set it is assumed to be at the origin of coordinates (0,0).
-
RadialDistortionEstimator
protected RadialDistortionEstimator(com.irurueta.geometry.Point2D distortionCenter, RadialDistortionEstimatorListener listener) Constructor with listener and distortion center.- Parameters:
distortionCenter- Distortion center. This is usually equal to the principal point of an estimated camera. If not set it is assumed to be at the origin of coordinates (0,0).listener- listener to be notified of events such as when estimation starts, ends or estimation progress changes.
-
RadialDistortionEstimator
protected RadialDistortionEstimator(List<com.irurueta.geometry.Point2D> distortedPoints, List<com.irurueta.geometry.Point2D> undistortedPoints, com.irurueta.geometry.Point2D distortionCenter) Constructor with points and distortion center.- Parameters:
distortedPoints- list of distorted points. Distorted points are obtained after radial distortion is applied to an undistorted point.undistortedPoints- list of undistorted points.distortionCenter- Distortion center. This is usually equal to the principal point of an estimated camera. If not set it is assumed to be at the origin of coordinates (0,0).- Throws:
IllegalArgumentException- if provided lists of points don't have the same size.
-
RadialDistortionEstimator
protected RadialDistortionEstimator(List<com.irurueta.geometry.Point2D> distortedPoints, List<com.irurueta.geometry.Point2D> undistortedPoints, com.irurueta.geometry.Point2D distortionCenter, RadialDistortionEstimatorListener listener) Constructor.- Parameters:
distortedPoints- list of distorted points. Distorted points are obtained after radial distortion is applied to an undistorted point.undistortedPoints- list of undistorted points.distortionCenter- Distortion center. This is usually equal to the principal point of an estimated camera. If not set it is assumed to be at the origin of coordinates (0,0).listener- listener to be notified of events such as when estimation starts, ends or estimation progress changes.- Throws:
IllegalArgumentException- if provided lists of points don't have the same size.
-
-
Method Details
-
getListener
Returns listener to be notified of events such as when estimation starts, ends or estimation progress changes.- Returns:
- listener to be notified of events.
-
setListener
public void setListener(RadialDistortionEstimatorListener listener) throws com.irurueta.geometry.estimators.LockedException Sets listener to be notified of events such as when estimation starts, ends or estimation progress changes.- 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.- Returns:
- true if this estimator is busy estimating a camera, false otherwise.
-
setPoints
public void setPoints(List<com.irurueta.geometry.Point2D> distortedPoints, List<com.irurueta.geometry.Point2D> undistortedPoints) throws com.irurueta.geometry.estimators.LockedException Sets list of corresponding distorted and undistorted points.- Parameters:
distortedPoints- list of distorted points. Distorted points are obtained after radial distortion is applied to an undistorted point.undistortedPoints- list of undistorted points.- Throws:
com.irurueta.geometry.estimators.LockedException- if estimator is locked.IllegalArgumentException- if provided lists of points don't have the same size.
-
getDistortedPoints
Returns list of distorted points. Distorted points are obtained after radial distortion is applied to an undistorted point.- Returns:
- list of distorted points.
-
getUndistortedPoints
Returns list of undistorted points.- Returns:
- list of undistorted points.
-
getDistortionCenter
public com.irurueta.geometry.Point2D getDistortionCenter()Returns distortion center. This is usually equal to the principal point of an estimated camera. If not set it is assumed to be at the origin of coordinates (0,0).- Returns:
- distortion center or null.
-
setDistortionCenter
public void setDistortionCenter(com.irurueta.geometry.Point2D distortionCenter) throws com.irurueta.geometry.estimators.LockedException Sets distortion center. This is usually equal to the principal point of an estimated camera. If not set it is assumed to be at the origin of coordinates (0,0).- Parameters:
distortionCenter- distortion center, or null if set at origin of coordinates.- Throws:
com.irurueta.geometry.estimators.LockedException- if estimator is locked.
-
getHorizontalFocalLength
public double getHorizontalFocalLength()Returns horizontal focal length expressed in pixels.- Returns:
- horizontal focal length expressed in pixels.
-
setHorizontalFocalLength
public void setHorizontalFocalLength(double horizontalFocalLength) throws com.irurueta.geometry.estimators.LockedException, RadialDistortionException Sets horizontal focal length expressed in pixels.- Parameters:
horizontalFocalLength- horizontal focal length expressed in pixels.- Throws:
com.irurueta.geometry.estimators.LockedException- if estimator is locked.RadialDistortionException- if provided value is degenerate (i.e. zero).
-
getVerticalFocalLength
public double getVerticalFocalLength()Returns vertical focal length expressed in pixels.- Returns:
- vertical focal length expressed in pixels.
-
setVerticalFocalLength
public void setVerticalFocalLength(double verticalFocalLength) throws com.irurueta.geometry.estimators.LockedException, RadialDistortionException Sets vertical focal length expressed in pixels.- Parameters:
verticalFocalLength- vertical focal length expressed in pixels.- Throws:
com.irurueta.geometry.estimators.LockedException- if estimator is locked.RadialDistortionException- if provided value is degenerate (i.e. zero).
-
getSkew
public double getSkew()Returns skew expressed in pixels.- Returns:
- skew expressed in pixels.
-
setSkew
public void setSkew(double skew) throws com.irurueta.geometry.estimators.LockedException Sets skew expressed in pixels.- Parameters:
skew- skew expressed in pixels.- Throws:
com.irurueta.geometry.estimators.LockedException- if estimator is locked.
-
setIntrinsic
public final void setIntrinsic(com.irurueta.geometry.Point2D distortionCenter, double horizontalFocalLength, double verticalFocalLength, double skew) throws com.irurueta.geometry.estimators.LockedException, RadialDistortionException Sets intrinsic parameters.- Parameters:
distortionCenter- radial distortion center.horizontalFocalLength- horizontal focal length expressed in pixels.verticalFocalLength- vertical focal length expressed in pixels.skew- skew expressed in pixels.- Throws:
com.irurueta.geometry.estimators.LockedException- if estimator is locked.RadialDistortionException- if focal length is degenerate (i.e. zero).
-
getIntrinsic
public com.irurueta.geometry.PinholeCameraIntrinsicParameters getIntrinsic()Returns pinhole camera intrinsic parameters associated to this estimator.- Returns:
- pinhole camera intrinsic parameters associated to this estimator.
-
setIntrinsic
public void setIntrinsic(com.irurueta.geometry.PinholeCameraIntrinsicParameters intrinsic) throws com.irurueta.geometry.estimators.LockedException, RadialDistortionException Sets intrinsic parameters for this estimator from pinhole camera intrinsic parameters.- Parameters:
intrinsic- intrinsic parameters.- Throws:
com.irurueta.geometry.estimators.LockedException- if estimator is locked.RadialDistortionException- if focal length is degenerate (i.e. zero).
-
getNumKParams
public int getNumKParams()Returns number of radial distortion parameters to estimate.- Returns:
- number of radial distortion parameters to estimate.
-
setNumKParams
public void setNumKParams(int numKParams) throws com.irurueta.geometry.estimators.LockedException Sets number of radial distortion parameters to estimate.- Parameters:
numKParams- number of radial distortion parameters to estimate.- Throws:
com.irurueta.geometry.estimators.LockedException- if estimator is locked.IllegalArgumentException- if number of parameters is less than 1.
-
getMinNumberOfMatchedPoints
public int getMinNumberOfMatchedPoints()Returns minimum number of required matched points to compute the radial distortion. This is equal to the number of radial distortion parameters. The larger the number of radial distortion parameters, the larger the number of matched points required. Typically, 2 radial distortion parameters are enough, since the following terms can be safely neglected- Returns:
- minimum number of required matched points to compute the radial distortion.
-
areValidPoints
public boolean areValidPoints(List<com.irurueta.geometry.Point2D> distortedPoints, List<com.irurueta.geometry.Point2D> undistortedPoints) Indicates if lists of corresponding distorted and undistorted points are valid. Lists are considered valid if they have the same number of points and both have more than the required minimum of correspondences (which is 2)- Parameters:
distortedPoints- list of distorted points. Distorted points are obtained after radial distortion is applied to an undistorted point.undistortedPoints- list of undistorted points.- Returns:
- true if lists of points are valid, false otherwise.
-
arePointsAvailable
public boolean arePointsAvailable()Indicates if lists of corresponding points have already been provided and are available for retrieval.- Returns:
- true if available, false otherwise.
-
isReady
public boolean isReady()Indicates if this estimator is ready to start th estimation. This is true when lists of points are provided, having equal size and at least 2 points.- Returns:
- true if estimator is ready, false otherwise.
-
estimate
public abstract RadialDistortion estimate() throws com.irurueta.geometry.estimators.LockedException, com.irurueta.geometry.estimators.NotReadyException, RadialDistortionEstimatorExceptionEstimates a radial distortion.- Returns:
- estimated radial distortion.
- Throws:
com.irurueta.geometry.estimators.LockedException- if estimator is locked.com.irurueta.geometry.estimators.NotReadyException- if input has not yet been provided.RadialDistortionEstimatorException- if an error occurs during estimation, usually because input data is not valid.
-
getType
Returns type of radial distortion estimator.- Returns:
- type of radial distortion estimator.
-
create
Creates an instance of a radial distortion estimator using default type.- Returns:
- an instance of a radial distortion estimator.
-
create
Creates an instance of a radial distortion estimator using provided type.- Parameters:
type- type of radial distortion estimator.- Returns:
- an instance of a radial distortion estimator.
-
setInternalIntrinsic
private void setInternalIntrinsic(com.irurueta.geometry.Point2D distortionCenter, double horizontalFocalLength, double verticalFocalLength, double skew) throws RadialDistortionException Internally sets intrinsic parameters. This method does not check whether estimator is locked.- Parameters:
distortionCenter- radial distortion center.horizontalFocalLength- horizontal focal length expressed in pixels.verticalFocalLength- vertical focal length expressed in pixels.skew- skew expressed in pixels.- Throws:
RadialDistortionException- if focal length is degenerate (i.e. zero).
-
internalSetPoints
private void internalSetPoints(List<com.irurueta.geometry.Point2D> distortedPoints, List<com.irurueta.geometry.Point2D> undistortedPoints) Sets list of corresponding distorted and undistorted points. This method does not check whether estimator is locked.- Parameters:
distortedPoints- list of distorted points. Distorted points are obtained after radial distortion is applied to an undistorted point.undistortedPoints- list of undistorted points.- Throws:
IllegalArgumentException- if provided lists of points don't have the same size.
-