Package com.irurueta.ar.sfm
Class DualImageOfAbsoluteConicInitialCamerasEstimator
java.lang.Object
com.irurueta.ar.sfm.InitialCamerasEstimator
com.irurueta.ar.sfm.DualImageOfAbsoluteConicInitialCamerasEstimator
Estimates an initial pair of cameras in the metric stratum (up to an
arbitrary scale) using a given fundamental matrix to obtain the Dual Image
of Absolute Conic by solving Kruppa equations to obtain the Essential matrix,
so that once it is computed it can be used to determine best pair of camera
poses and translations by triangulating a set of matched points and checking
that their triangulation lies in front of cameras.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate double
Aspect ratio of intrinsic parameters of cameras.private CorrectorType
Type of corrector to use to triangulate matched points or null if no corrector needs to be used.static final boolean
Indicates whether triangulated points must be marked as valid (i.e. when they lie in front of both of the estimated cameras) or not.static final boolean
Indicates whether matched 2D points must be triangulated by default.private List<com.irurueta.geometry.Point2D>
Matched 2D points on left view.private boolean
Marks which of the triangulated points are marked as valid (lie in front of both of the estimated cameras) and which ones aren't.private double
Horizontal coordinate of principal point.private double
Vertical coordinate of principal point.private List<com.irurueta.geometry.Point2D>
Matched 2D points on right view.private List<com.irurueta.geometry.Point3D>
Contains triangulated points.private boolean
Indicates whether matched 2D points need to be triangulated.private BitSet
Contains booleans indicating whether triangulated points are valid (i.e.Fields inherited from class com.irurueta.ar.sfm.InitialCamerasEstimator
DEFAULT_METHOD, estimatedLeftCamera, estimatedRightCamera, fundamentalMatrix, listener, locked
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor.DualImageOfAbsoluteConicInitialCamerasEstimator
(FundamentalMatrix fundamentalMatrix) Constructor.DualImageOfAbsoluteConicInitialCamerasEstimator
(FundamentalMatrix fundamentalMatrix, InitialCamerasEstimatorListener listener) Constructor.DualImageOfAbsoluteConicInitialCamerasEstimator
(FundamentalMatrix fundamentalMatrix, List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints) Constructor.DualImageOfAbsoluteConicInitialCamerasEstimator
(FundamentalMatrix fundamentalMatrix, List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints, InitialCamerasEstimatorListener listener) Constructor.Constructor.DualImageOfAbsoluteConicInitialCamerasEstimator
(List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints) Constructor.DualImageOfAbsoluteConicInitialCamerasEstimator
(List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints, InitialCamerasEstimatorListener listener) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Indicates whether matched 2D points need to be triangulated or not.boolean
Indicates which triangulated points are marked as valid (lie in front of both of the estimated cameras) and which ones aren't.void
estimate()
Estimates cameras.static int
generateInitialMetricCamerasUsingDIAC
(FundamentalMatrix fundamentalMatrix, double principalPointX, double principalPointY, double aspectRatio, List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints, CorrectorType correctorType, com.irurueta.geometry.PinholeCamera leftCamera, com.irurueta.geometry.PinholeCamera rightCamera) Generates a pair of metric cameras (up to an arbitrary space) by estimating the intrinsic parameters of the views by solving the Kruppa equations to obtain the Dual Image of Absolute Conic (DIAC).static int
generateInitialMetricCamerasUsingDIAC
(FundamentalMatrix fundamentalMatrix, double principalPointX, double principalPointY, double aspectRatio, List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints, CorrectorType correctorType, com.irurueta.geometry.PinholeCamera leftCamera, com.irurueta.geometry.PinholeCamera rightCamera, List<com.irurueta.geometry.Point3D> triangulatedPoints, BitSet validTriangulatedPoints) Generates a pair of metric cameras (up to an arbitrary space) by estimating the intrinsic parameters of the views by solving the Kruppa equations to obtain the Dual Image of Absolute Conic (DIAC).static int
generateInitialMetricCamerasUsingDIAC
(FundamentalMatrix fundamentalMatrix, double principalPointX, double principalPointY, double aspectRatio, List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints, com.irurueta.geometry.PinholeCamera leftCamera, com.irurueta.geometry.PinholeCamera rightCamera) Generates a pair of metric cameras (up to an arbitrary space) by estimating the intrinsic parameters of the views by solving the Kruppa equations to obtain the Dual Image of Absolute Conic (DIAC).static int
generateInitialMetricCamerasUsingDIAC
(FundamentalMatrix fundamentalMatrix, double principalPointX, double principalPointY, double aspectRatio, List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints, com.irurueta.geometry.PinholeCamera leftCamera, com.irurueta.geometry.PinholeCamera rightCamera, List<com.irurueta.geometry.Point3D> triangulatedPoints, BitSet validTriangulatedPoints) Generates a pair of metric cameras (up to an arbitrary space) by estimating the intrinsic parameters of the views by solving the Kruppa equations to obtain the Dual Image of Absolute Conic (DIAC).static int
generateInitialMetricCamerasUsingDIAC
(FundamentalMatrix fundamentalMatrix, double principalPointX, double principalPointY, List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints, CorrectorType correctorType, com.irurueta.geometry.PinholeCamera leftCamera, com.irurueta.geometry.PinholeCamera rightCamera) Generates a pair of metric cameras (up to an arbitrary space) by estimating the intrinsic parameters of the views by solving the Kruppa equations to obtain the Dual Image of Absolute Conic (DIAC).static int
generateInitialMetricCamerasUsingDIAC
(FundamentalMatrix fundamentalMatrix, double principalPointX, double principalPointY, List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints, CorrectorType correctorType, com.irurueta.geometry.PinholeCamera leftCamera, com.irurueta.geometry.PinholeCamera rightCamera, List<com.irurueta.geometry.Point3D> triangulatedPoints, BitSet validTriangulatedPoints) Generates a pair of metric cameras (up to an arbitrary space) by estimating the intrinsic parameters of the views by solving the Kruppa equations to obtain the Dual Image of Absolute Conic (DIAC).static int
generateInitialMetricCamerasUsingDIAC
(FundamentalMatrix fundamentalMatrix, double principalPointX, double principalPointY, List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints, com.irurueta.geometry.PinholeCamera leftCamera, com.irurueta.geometry.PinholeCamera rightCamera) Generates a pair of metric cameras (up to an arbitrary space) by estimating the intrinsic parameters of the views by solving the Kruppa equations to obtain the Dual Image of Absolute Conic (DIAC).static int
generateInitialMetricCamerasUsingDIAC
(FundamentalMatrix fundamentalMatrix, double principalPointX, double principalPointY, List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints, com.irurueta.geometry.PinholeCamera leftCamera, com.irurueta.geometry.PinholeCamera rightCamera, List<com.irurueta.geometry.Point3D> triangulatedPoints, BitSet validTriangulatedPoints) Generates a pair of metric cameras (up to an arbitrary space) by estimating the intrinsic parameters of the views by solving the Kruppa equations to obtain the Dual Image of Absolute Conic (DIAC).double
Gets aspect ratio of intrinsic parameters of cameras.Gets type of corrector to use to triangulate matched points or null if no corrector needs to be used.List<com.irurueta.geometry.Point2D>
Gets matched 2D points on left view.Returns method used by this estimator.double
Gets horizontal coordinate of principal point.double
Gets vertical coordinate of principal point.List<com.irurueta.geometry.Point2D>
Gets matched 2D points on right view.List<com.irurueta.geometry.Point3D>
Gets triangulated points, if available.Gets bitset indicating which of the triangulated points are valid and which ones aren't.private void
internalSetLeftAndRightPoints
(List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints) Internal method to set matched 2D points on left and right views.boolean
isReady()
Indicates if estimator is ready.void
setAspectRatio
(double aspectRatio) Sets aspect ratio of intrinsic parameters of cameras.void
setCorrectorType
(CorrectorType correctorType) Sets type of corrector to use to triangulate matched points or null if no corrector needs to be used.void
setLeftAndRightPoints
(List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints) Sets matched 2D points on left and right views.void
setLeftPoints
(List<com.irurueta.geometry.Point2D> leftPoints) Sets matched 2D points on left view.void
setPointsTriangulated
(boolean triangulatePoints) Specifies whether matched 2D points need to be triangulated or not.void
setPrincipalPoint
(double principalPointX, double principalPointY) Sets horizontal and vertical coordinates of principal point.void
setPrincipalPointX
(double principalPointX) Sets horizontal coordinate of principal point.void
setPrincipalPointY
(double principalPointY) Sets vertical coordinate of principal point.void
setRightPoints
(List<com.irurueta.geometry.Point2D> rightPoints) Sets matched 2D points on right view.void
setValidTriangulatedPointsMarked
(boolean markValidTriangulatedPoints) Specifies whether triangulated points are marked as valid (lie in front of both of the estimated cameras) and which ones aren't.Methods inherited from class com.irurueta.ar.sfm.InitialCamerasEstimator
create, create, create, create, create, create, create, create, getEstimatedLeftCamera, getEstimatedRightCamera, getFundamentalMatrix, getListener, isLocked, setFundamentalMatrix, setListener
-
Field Details
-
DEFAULT_TRIANGULATE_POINTS
public static final boolean DEFAULT_TRIANGULATE_POINTSIndicates whether matched 2D points must be triangulated by default.- See Also:
-
DEFAULT_MARK_VALID_TRIANGULATED_POINTS
public static final boolean DEFAULT_MARK_VALID_TRIANGULATED_POINTSIndicates whether triangulated points must be marked as valid (i.e. when they lie in front of both of the estimated cameras) or not.- See Also:
-
aspectRatio
private double aspectRatioAspect ratio of intrinsic parameters of cameras. Typically, this value is 1.0 if vertical coordinates increase upwards, or -1.0 if it is the opposite. -
principalPointX
private double principalPointXHorizontal coordinate of principal point. This value should be the coordinates of the center of an image assuming that the coordinates start on the top-left or bottom-left corner. Using a value close to zero will produce inaccurate results. -
principalPointY
private double principalPointYVertical coordinate of principal point. This value should be the coordinates of the center of an image assuming that the coordinates start on the top-left or bottom-left corner. Using a value close to zero will produce inaccurate results. -
leftPoints
Matched 2D points on left view. -
rightPoints
Matched 2D points on right view. -
correctorType
Type of corrector to use to triangulate matched points or null if no corrector needs to be used. -
triangulatePoints
private boolean triangulatePointsIndicates whether matched 2D points need to be triangulated. -
markValidTriangulatedPoints
private boolean markValidTriangulatedPointsMarks which of the triangulated points are marked as valid (lie in front of both of the estimated cameras) and which ones aren't. -
triangulatedPoints
Contains triangulated points. -
validTriangulatedPoints
Contains booleans indicating whether triangulated points are valid (i.e. lie in front of both estimated cameras) or not.
-
-
Constructor Details
-
DualImageOfAbsoluteConicInitialCamerasEstimator
public DualImageOfAbsoluteConicInitialCamerasEstimator()Constructor. -
DualImageOfAbsoluteConicInitialCamerasEstimator
Constructor.- Parameters:
fundamentalMatrix
- fundamental matrix relating two views.
-
DualImageOfAbsoluteConicInitialCamerasEstimator
public DualImageOfAbsoluteConicInitialCamerasEstimator(List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints) Constructor.- Parameters:
leftPoints
- matched 2D points on left view.rightPoints
- matched 2D points on right view.- Throws:
IllegalArgumentException
- if provided lists don't have the same size.
-
DualImageOfAbsoluteConicInitialCamerasEstimator
public DualImageOfAbsoluteConicInitialCamerasEstimator(FundamentalMatrix fundamentalMatrix, List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints) Constructor.- Parameters:
fundamentalMatrix
- fundamental matrix relating two views.leftPoints
- matched 2D points on left view.rightPoints
- matched 2D points on right view.- Throws:
IllegalArgumentException
- if provided lists don't have the same size.
-
DualImageOfAbsoluteConicInitialCamerasEstimator
Constructor.- Parameters:
listener
- listener to handle events raised by this instance.
-
DualImageOfAbsoluteConicInitialCamerasEstimator
public DualImageOfAbsoluteConicInitialCamerasEstimator(FundamentalMatrix fundamentalMatrix, InitialCamerasEstimatorListener listener) Constructor.- Parameters:
fundamentalMatrix
- fundamental matrix relating two views.listener
- listener to handle events raised by this instance.
-
DualImageOfAbsoluteConicInitialCamerasEstimator
public DualImageOfAbsoluteConicInitialCamerasEstimator(List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints, InitialCamerasEstimatorListener listener) Constructor.- Parameters:
leftPoints
- matched 2D points on left view.rightPoints
- matched 2D points on right view.listener
- listener to handle events raised by this instance.- Throws:
IllegalArgumentException
- if provided lists don't have the same size.
-
DualImageOfAbsoluteConicInitialCamerasEstimator
public DualImageOfAbsoluteConicInitialCamerasEstimator(FundamentalMatrix fundamentalMatrix, List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints, InitialCamerasEstimatorListener listener) Constructor.- Parameters:
fundamentalMatrix
- fundamental matrix relating two views.leftPoints
- matched 2D points on left view.rightPoints
- matched 2D points on right view.listener
- listener to handle events raised by this instance.- Throws:
IllegalArgumentException
- if provided lists don't have the same size.
-
-
Method Details
-
getMethod
Returns method used by this estimator.- Specified by:
getMethod
in classInitialCamerasEstimator
- Returns:
- method used by this estimator.
-
isReady
public boolean isReady()Indicates if estimator is ready.- Specified by:
isReady
in classInitialCamerasEstimator
- Returns:
- true if estimator is ready, false otherwise.
-
estimate
public void estimate() throws com.irurueta.geometry.estimators.LockedException, com.irurueta.geometry.estimators.NotReadyException, InitialCamerasEstimationFailedExceptionEstimates cameras.- Specified by:
estimate
in classInitialCamerasEstimator
- Throws:
com.irurueta.geometry.estimators.LockedException
- if estimator is locked.com.irurueta.geometry.estimators.NotReadyException
- if estimator is not ready.InitialCamerasEstimationFailedException
- if estimation of cameras fails for some reason, typically due to numerical instabilities.
-
getAspectRatio
public double getAspectRatio()Gets aspect ratio of intrinsic parameters of cameras. Typically, this value is 1.0 if vertical coordinates increase upwards, or -1.0 if it is the opposite.- Returns:
- aspect ratio of intrinsic parameters of cameras.
-
setAspectRatio
public void setAspectRatio(double aspectRatio) throws com.irurueta.geometry.estimators.LockedException Sets aspect ratio of intrinsic parameters of cameras. Typically, this value is 1.0 if vertical coordinates increase upwards, or -1.0 if it is the opposite.- Parameters:
aspectRatio
- aspect ratio of intrinsic parameters of cameras.- Throws:
com.irurueta.geometry.estimators.LockedException
- if estimator is locked.
-
getPrincipalPointX
public double getPrincipalPointX()Gets horizontal coordinate of principal point. This value should be the coordinates of the center of an image assuming that the coordinates start on the top-left or bottom-left corner. Using a value close to zero will produce inaccurate results.- Returns:
- horizontal coordinate of principal point.
-
setPrincipalPointX
public void setPrincipalPointX(double principalPointX) throws com.irurueta.geometry.estimators.LockedException Sets horizontal coordinate of principal point. This value should be the coordinates of the center of an image assuming that the coordinates start on the top-left or bottom-left corner. Using a value close to zero will produce inaccurate results.- Parameters:
principalPointX
- horizontal coordinate of principal point.- Throws:
com.irurueta.geometry.estimators.LockedException
- if estimator is locked.
-
getPrincipalPointY
public double getPrincipalPointY()Gets vertical coordinate of principal point. This value should be the coordinates of the center of an image assuming that the coordinates start on the top-left or bottom-left corner. Using a value close to zero will produce inaccurate results.- Returns:
- vertical coordinate of principal point.
-
setPrincipalPointY
public void setPrincipalPointY(double principalPointY) throws com.irurueta.geometry.estimators.LockedException Sets vertical coordinate of principal point. This value should be the coordinates of the center of an image assuming that the coordinates start on the top-left or bottom-left corner. Using a value close to zero will produce inaccurate results.- Parameters:
principalPointY
- vertical coordinate of principal point.- Throws:
com.irurueta.geometry.estimators.LockedException
- if estimator is locked.
-
setPrincipalPoint
public void setPrincipalPoint(double principalPointX, double principalPointY) throws com.irurueta.geometry.estimators.LockedException Sets horizontal and vertical coordinates of principal point. This value should be the coordinates of the center of an image assuming that the coordinates start on the top-left or bottom-left corner. Using a value close to zero will produce inaccurate results.- Parameters:
principalPointX
- horizontal coordinate of principal point.principalPointY
- vertical coordinate of principal point.- Throws:
com.irurueta.geometry.estimators.LockedException
- if estimator is locked.
-
getLeftPoints
Gets matched 2D points on left view.- Returns:
- matched 2D points on left view.
-
setLeftPoints
public void setLeftPoints(List<com.irurueta.geometry.Point2D> leftPoints) throws com.irurueta.geometry.estimators.LockedException Sets matched 2D points on left view.- Parameters:
leftPoints
- matched 2D points on left view.- Throws:
com.irurueta.geometry.estimators.LockedException
- if estimator is locked.
-
getRightPoints
Gets matched 2D points on right view.- Returns:
- matched 2D points on right view.
-
setRightPoints
public void setRightPoints(List<com.irurueta.geometry.Point2D> rightPoints) throws com.irurueta.geometry.estimators.LockedException Sets matched 2D points on right view.- Parameters:
rightPoints
- matched 2D points on right view.- Throws:
com.irurueta.geometry.estimators.LockedException
- if estimator is locked.
-
setLeftAndRightPoints
public void setLeftAndRightPoints(List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints) throws com.irurueta.geometry.estimators.LockedException Sets matched 2D points on left and right views.- Parameters:
leftPoints
- matched 2D points on left view.rightPoints
- matched 2D points on right view.- Throws:
com.irurueta.geometry.estimators.LockedException
- if estimator is locked.IllegalArgumentException
- if provided lists don't have the same size.
-
getCorrectorType
Gets type of corrector to use to triangulate matched points or null if no corrector needs to be used.- Returns:
- type of corrector to use.
-
setCorrectorType
public void setCorrectorType(CorrectorType correctorType) throws com.irurueta.geometry.estimators.LockedException Sets type of corrector to use to triangulate matched points or null if no corrector needs to be used.- Parameters:
correctorType
- type of corrector to use.- Throws:
com.irurueta.geometry.estimators.LockedException
- if estimator is locked.
-
arePointsTriangulated
public boolean arePointsTriangulated()Indicates whether matched 2D points need to be triangulated or not.- Returns:
- true if 2D points need to be triangulated, false otherwise.
-
setPointsTriangulated
public void setPointsTriangulated(boolean triangulatePoints) throws com.irurueta.geometry.estimators.LockedException Specifies whether matched 2D points need to be triangulated or not.- Parameters:
triangulatePoints
- true if 2D points need to be triangulated, false otherwise.- Throws:
com.irurueta.geometry.estimators.LockedException
- if estimator is locked.
-
areValidTriangulatedPointsMarked
public boolean areValidTriangulatedPointsMarked()Indicates which triangulated points are marked as valid (lie in front of both of the estimated cameras) and which ones aren't.- Returns:
- true to mark valid and invalid triangulated points, false otherwise.
-
setValidTriangulatedPointsMarked
public void setValidTriangulatedPointsMarked(boolean markValidTriangulatedPoints) throws com.irurueta.geometry.estimators.LockedException Specifies whether triangulated points are marked as valid (lie in front of both of the estimated cameras) and which ones aren't.- Parameters:
markValidTriangulatedPoints
- true to mark valid and invalid triangulated points, false otherwise.- Throws:
com.irurueta.geometry.estimators.LockedException
- if estimator is locked.
-
getTriangulatedPoints
Gets triangulated points, if available.- Returns:
- triangulated points or null.
-
getValidTriangulatedPoints
Gets bitset indicating which of the triangulated points are valid and which ones aren't.- Returns:
- bitset indicating validity of triangulated points or null if not available.
-
generateInitialMetricCamerasUsingDIAC
public static int generateInitialMetricCamerasUsingDIAC(FundamentalMatrix fundamentalMatrix, double principalPointX, double principalPointY, List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints, com.irurueta.geometry.PinholeCamera leftCamera, com.irurueta.geometry.PinholeCamera rightCamera) throws InitialCamerasEstimationFailedException Generates a pair of metric cameras (up to an arbitrary space) by estimating the intrinsic parameters of the views by solving the Kruppa equations to obtain the Dual Image of Absolute Conic (DIAC). The estimated intrinsic parameters can later be used to find the essential matrix (assuming that both views have the same intrinsic parameters), and the essential matrix along with provided matched 2D points can be used to determine the best pair of camera pose and translation that yields the largest number of triangulated points laying in front of both of the estimated cameras. This method uses default corrector type, does not keep triangulated points or valid triangulated points, and uses default aspect ratio (1.0).- Parameters:
fundamentalMatrix
- fundamental matrix relating both left and right views.principalPointX
- horizontal coordinate of principal point. This value should be the coordinates of the center of an image assuming that the coordinates start on the top-left or bottom-left corner. Using a value close to zero will produce inaccurate results.principalPointY
- vertical coordinate of principal point. This value should be the coordinates of the center of an image assuming that the coordinates start on the top-left or bottom-left corner. Using a value close to zero will produce inaccurate results.leftPoints
- points on left view matched with points on right view, so they can be triangulated using estimated cameras. Both lists of points must have the same size.rightPoints
- points on right view matched with points on left view, so they can be triangulated using estimated cameras. Both lists of points must have the same size.leftCamera
- instance where estimated left camera will be stored.rightCamera
- instance where estimated right camera will be stored.- Returns:
- number of valid triangulated points which lie in front of the two estimated cameras.
- Throws:
InitialCamerasEstimationFailedException
- if estimation of cameras fails for some reason, typically due to numerical instabilities.IllegalArgumentException
- if provided lists of left and right points don't have the same size.
-
generateInitialMetricCamerasUsingDIAC
public static int generateInitialMetricCamerasUsingDIAC(FundamentalMatrix fundamentalMatrix, double principalPointX, double principalPointY, List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints, CorrectorType correctorType, com.irurueta.geometry.PinholeCamera leftCamera, com.irurueta.geometry.PinholeCamera rightCamera) throws InitialCamerasEstimationFailedException Generates a pair of metric cameras (up to an arbitrary space) by estimating the intrinsic parameters of the views by solving the Kruppa equations to obtain the Dual Image of Absolute Conic (DIAC). The estimated intrinsic parameters can later be used to find the essential matrix (assuming that both views have the same intrinsic parameters), and the essential matrix along with provided matched 2D points can be used to determine the best pair of camera pose and translation that yields the largest number of triangulated points laying in front of both of the estimated cameras. This method does not keep triangulated points or valid triangulated points and uses default aspect ratio (1.0).- Parameters:
fundamentalMatrix
- fundamental matrix relating both left and right views.principalPointX
- horizontal coordinate of principal point. This value should be the coordinates of the center of an image assuming that the coordinates start on the top-left or bottom-left corner. Using a value close to zero will produce inaccurate results.principalPointY
- vertical coordinate of principal point. This value should be the coordinates of the center of an image assuming that the coordinates start on the top-left or bottom-left corner. Using a value close to zero will produce inaccurate results.leftPoints
- points on left view matched with points on right view, so they can be triangulated using estimated cameras. Both lists of points must have the same size.rightPoints
- points on right view matched with points on left view, so they can be triangulated using estimated cameras. Both lists of points must have the same size.correctorType
- corrector type to be used to correct 2D points, so they follow the epipolar geometry defined by provided fundamental matrix so that error on triangulated points is reduced. If null, no corrector will be used.leftCamera
- instance where estimated left camera will be stored.rightCamera
- instance where estimated right camera will be stored.- Returns:
- number of valid triangulated points which lie in front of the two estimated cameras.
- Throws:
InitialCamerasEstimationFailedException
- if estimation of cameras fails for some reason, typically due to numerical instabilities.IllegalArgumentException
- if provided lists of left and right points don't have the same size.
-
generateInitialMetricCamerasUsingDIAC
public static int generateInitialMetricCamerasUsingDIAC(FundamentalMatrix fundamentalMatrix, double principalPointX, double principalPointY, List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints, com.irurueta.geometry.PinholeCamera leftCamera, com.irurueta.geometry.PinholeCamera rightCamera, List<com.irurueta.geometry.Point3D> triangulatedPoints, BitSet validTriangulatedPoints) throws InitialCamerasEstimationFailedException Generates a pair of metric cameras (up to an arbitrary space) by estimating the intrinsic parameters of the views by solving the Kruppa equations to obtain the Dual Image of Absolute Conic (DIAC). The estimated intrinsic parameters can later be used to find the essential matrix (assuming that both views have the same intrinsic parameters), and the essential matrix along with provided matched 2D points can be used to determine the best pair of camera pose and translation that yields the largest number of triangulated points laying in front of both of the estimated cameras. This method uses default corrector type and default aspect ratio (1.0).- Parameters:
fundamentalMatrix
- fundamental matrix relating both left and right views.principalPointX
- horizontal coordinate of principal point. This value should be the coordinates of the center of an image assuming that the coordinates start on the top-left or bottom-left corner. Using a value close to zero will produce inaccurate results.principalPointY
- vertical coordinate of principal point. This value should be the coordinates of the center of an image assuming that the coordinates start on the top-left or bottom-left corner. Using a value close to zero will produce inaccurate results.leftPoints
- points on left view matched with points on right view, so they can be triangulated using estimated cameras. Both lists of points must have the same size.rightPoints
- points on right view matched with points on left view, so they can be triangulated using estimated cameras. Both lists of points must have the same size.leftCamera
- instance where estimated left camera will be stored.rightCamera
- instance where estimated right camera will be stored.triangulatedPoints
- instance where triangulated 3D points will be stored or null if triangulated points don't need to be kept.validTriangulatedPoints
- instance which indicates which triangulated 3D points are considered valid because they lie in front of both cameras or null if such data doesn't need to be kept.- Returns:
- number of valid triangulated points which lie in front of the two estimated cameras.
- Throws:
InitialCamerasEstimationFailedException
- if estimation of cameras fails for some reason, typically due to numerical instabilities.IllegalArgumentException
- if provided lists of left and right points don't have the same size.
-
generateInitialMetricCamerasUsingDIAC
public static int generateInitialMetricCamerasUsingDIAC(FundamentalMatrix fundamentalMatrix, double principalPointX, double principalPointY, List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints, CorrectorType correctorType, com.irurueta.geometry.PinholeCamera leftCamera, com.irurueta.geometry.PinholeCamera rightCamera, List<com.irurueta.geometry.Point3D> triangulatedPoints, BitSet validTriangulatedPoints) throws InitialCamerasEstimationFailedException Generates a pair of metric cameras (up to an arbitrary space) by estimating the intrinsic parameters of the views by solving the Kruppa equations to obtain the Dual Image of Absolute Conic (DIAC). The estimated intrinsic parameters can later be used to find the essential matrix (assuming that both views have the same intrinsic parameters), and the essential matrix along with provided matched 2D points can be used to determine the best pair of camera pose and translation that yields the largest number of triangulated points laying in front of both of the estimated cameras. This method uses default aspect ratio (1.0).- Parameters:
fundamentalMatrix
- fundamental matrix relating both left and right views.principalPointX
- horizontal coordinate of principal point. This value should be the coordinates of the center of an image assuming that the coordinates start on the top-left or bottom-left corner. Using a value close to zero will produce inaccurate results.principalPointY
- vertical coordinate of principal point. This value should be the coordinates of the center of an image assuming that the coordinates start on the top-left or bottom-left corner. Using a value close to zero will produce inaccurate results.leftPoints
- points on left view matched with points on right view, so they can be triangulated using estimated cameras. Both lists of points must have the same size.rightPoints
- points on right view matched with points on left view, so they can be triangulated using estimated cameras. Both lists of points must have the same size.correctorType
- corrector type to be used to correct 2D points, so they follow the epipolar geometry defined by provided fundamental matrix so that error on triangulated points is reduced. If null, no corrector will be used.leftCamera
- instance where estimated left camera will be stored.rightCamera
- instance where estimated right camera will be stored.triangulatedPoints
- instance where triangulated 3D points will be stored or null if triangulated points don't need to be kept.validTriangulatedPoints
- instance which indicates which triangulated 3D points are considered valid because they lie in front of both cameras or null if such data doesn't need to be kept.- Returns:
- number of valid triangulated points which lie in front of the two estimated cameras.
- Throws:
InitialCamerasEstimationFailedException
- if estimation of cameras fails for some reason, typically due to numerical instabilities.IllegalArgumentException
- if provided lists of left and right points don't have the same size.
-
generateInitialMetricCamerasUsingDIAC
public static int generateInitialMetricCamerasUsingDIAC(FundamentalMatrix fundamentalMatrix, double principalPointX, double principalPointY, double aspectRatio, List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints, com.irurueta.geometry.PinholeCamera leftCamera, com.irurueta.geometry.PinholeCamera rightCamera) throws InitialCamerasEstimationFailedException Generates a pair of metric cameras (up to an arbitrary space) by estimating the intrinsic parameters of the views by solving the Kruppa equations to obtain the Dual Image of Absolute Conic (DIAC). The estimated intrinsic parameters can later be used to find the essential matrix (assuming that both views have the same intrinsic parameters), and the essential matrix along with provided matched 2D points can be used to determine the best pair of camera pose and translation that yields the largest number of triangulated points laying in front of both of the estimated cameras. This method uses default corrector type and does not keep triangulated points or valid triangulated points.- Parameters:
fundamentalMatrix
- fundamental matrix relating both left and right views.principalPointX
- horizontal coordinate of principal point. This value should be the coordinates of the center of an image assuming that the coordinates start on the top-left or bottom-left corner. Using a value close to zero will produce inaccurate results.principalPointY
- vertical coordinate of principal point. This value should be the coordinates of the center of an image assuming that the coordinates start on the top-left or bottom-left corner. Using a value close to zero will produce inaccurate results.aspectRatio
- aspect ratio for estimated intrinsic parameters. This is typically 1.0 if vertical coordinates increase upwards or -1.0 if it is the opposite.leftPoints
- points on left view matched with points on right view, so they can be triangulated using estimated cameras. Both lists of points must have the same size.rightPoints
- points on right view matched with points on left view, so they can be triangulated using estimated cameras. Both lists of points must have the same size.leftCamera
- instance where estimated left camera will be stored.rightCamera
- instance where estimated right camera will be stored.- Returns:
- number of valid triangulated points which lie in front of the two estimated cameras.
- Throws:
InitialCamerasEstimationFailedException
- if estimation of cameras fails for some reason, typically due to numerical instabilities.IllegalArgumentException
- if provided lists of left and right points don't have the same size.
-
generateInitialMetricCamerasUsingDIAC
public static int generateInitialMetricCamerasUsingDIAC(FundamentalMatrix fundamentalMatrix, double principalPointX, double principalPointY, double aspectRatio, List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints, CorrectorType correctorType, com.irurueta.geometry.PinholeCamera leftCamera, com.irurueta.geometry.PinholeCamera rightCamera) throws InitialCamerasEstimationFailedException Generates a pair of metric cameras (up to an arbitrary space) by estimating the intrinsic parameters of the views by solving the Kruppa equations to obtain the Dual Image of Absolute Conic (DIAC). The estimated intrinsic parameters can later be used to find the essential matrix (assuming that both views have the same intrinsic parameters), and the essential matrix along with provided matched 2D points can be used to determine the best pair of camera pose and translation that yields the largest number of triangulated points laying in front of both of the estimated cameras. This method does not keep triangulated points or valid triangulated points.- Parameters:
fundamentalMatrix
- fundamental matrix relating both left and right views.principalPointX
- horizontal coordinate of principal point. This value should be the coordinates of the center of an image assuming that the coordinates start on the top-left or bottom-left corner. Using a value close to zero will produce inaccurate results.principalPointY
- vertical coordinate of principal point. This value should be the coordinates of the center of an image assuming that the coordinates start on the top-left or bottom-left corner. Using a value close to zero will produce inaccurate results.aspectRatio
- aspect ratio for estimated intrinsic parameters. This is typically 1.0 if vertical coordinates increase upwards or -1.0 if it is the opposite.leftPoints
- points on left view matched with points on right view, so they can be triangulated using estimated cameras. Both lists of points must have the same size.rightPoints
- points on right view matched with points on left view, so they can be triangulated using estimated cameras. Both lists of points must have the same size.correctorType
- corrector type to be used to correct 2D points, so they follow the epipolar geometry defined by provided fundamental matrix so that error on triangulated points is reduced. If null, no corrector will be used.leftCamera
- instance where estimated left camera will be stored.rightCamera
- instance where estimated right camera will be stored.- Returns:
- number of valid triangulated points which lie in front of the two estimated cameras.
- Throws:
InitialCamerasEstimationFailedException
- if estimation of cameras fails for some reason, typically due to numerical instabilities.IllegalArgumentException
- if provided lists of left and right points don't have the same size.
-
generateInitialMetricCamerasUsingDIAC
public static int generateInitialMetricCamerasUsingDIAC(FundamentalMatrix fundamentalMatrix, double principalPointX, double principalPointY, double aspectRatio, List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints, com.irurueta.geometry.PinholeCamera leftCamera, com.irurueta.geometry.PinholeCamera rightCamera, List<com.irurueta.geometry.Point3D> triangulatedPoints, BitSet validTriangulatedPoints) throws InitialCamerasEstimationFailedException Generates a pair of metric cameras (up to an arbitrary space) by estimating the intrinsic parameters of the views by solving the Kruppa equations to obtain the Dual Image of Absolute Conic (DIAC). The estimated intrinsic parameters can later be used to find the essential matrix (assuming that both views have the same intrinsic parameters), and the essential matrix along with provided matched 2D points can be used to determine the best pair of camera pose and translation that yields the largest number of triangulated points laying in front of both of the estimated cameras. This method uses default corrector type.- Parameters:
fundamentalMatrix
- fundamental matrix relating both left and right views.principalPointX
- horizontal coordinate of principal point. This value should be the coordinates of the center of an image assuming that the coordinates start on the top-left or bottom-left corner. Using a value close to zero will produce inaccurate results.principalPointY
- vertical coordinate of principal point. This value should be the coordinates of the center of an image assuming that the coordinates start on the top-left or bottom-left corner. Using a value close to zero will produce inaccurate results.aspectRatio
- aspect ratio for estimated intrinsic parameters. This is typically 1.0 if vertical coordinates increase upwards or -1.0 if it is the opposite.leftPoints
- points on left view matched with points on right view, so they can be triangulated using estimated cameras. Both lists of points must have the same size.rightPoints
- points on right view matched with points on left view, so they can be triangulated using estimated cameras. Both lists of points must have the same size.leftCamera
- instance where estimated left camera will be stored.rightCamera
- instance where estimated right camera will be stored.triangulatedPoints
- instance where triangulated 3D points will be stored or null if triangulated points don't need to be kept.validTriangulatedPoints
- instance which indicates which triangulated 3D points are considered valid because they lie in front of both cameras or null if such data doesn't need to be kept.- Returns:
- number of valid triangulated points which lie in front of the two estimated cameras.
- Throws:
InitialCamerasEstimationFailedException
- if estimation of cameras fails for some reason, typically due to numerical instabilities.IllegalArgumentException
- if provided lists of left and right points don't have the same size.
-
generateInitialMetricCamerasUsingDIAC
public static int generateInitialMetricCamerasUsingDIAC(FundamentalMatrix fundamentalMatrix, double principalPointX, double principalPointY, double aspectRatio, List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints, CorrectorType correctorType, com.irurueta.geometry.PinholeCamera leftCamera, com.irurueta.geometry.PinholeCamera rightCamera, List<com.irurueta.geometry.Point3D> triangulatedPoints, BitSet validTriangulatedPoints) throws InitialCamerasEstimationFailedException Generates a pair of metric cameras (up to an arbitrary space) by estimating the intrinsic parameters of the views by solving the Kruppa equations to obtain the Dual Image of Absolute Conic (DIAC). The estimated intrinsic parameters can later be used to find the essential matrix (assuming that both views have the same intrinsic parameters), and the essential matrix along with provided matched 2D points can be used to determine the best pair of camera pose and translation that yields the largest number of triangulated points laying in front of both of the estimated cameras.- Parameters:
fundamentalMatrix
- fundamental matrix relating both left and right views.principalPointX
- horizontal coordinate of principal point. This value should be the coordinates of the center of an image assuming that the coordinates start on the top-left or bottom-left corner. Using a value close to zero will produce inaccurate results.principalPointY
- vertical coordinate of principal point. This value should be the coordinates of the center of an image assuming that the coordinates start on the top-left or bottom-left corner. Using a value close to zero will produce inaccurate results.aspectRatio
- aspect ratio for estimated intrinsic parameters. This is typically 1.0 if vertical coordinates increase upwards or -1.0 if it is the opposite.leftPoints
- points on left view matched with points on right view, so they can be triangulated using estimated cameras. Both lists of points must have the same size.rightPoints
- points on right view matched with points on left view, so they can be triangulated using estimated cameras. Both lists of points must have the same size.correctorType
- corrector type to be used to correct 2D points, so they follow the epipolar geometry defined by provided fundamental matrix so that error on triangulated points is reduced. If null, no corrector will be used.leftCamera
- instance where estimated left camera will be stored.rightCamera
- instance where estimated right camera will be stored.triangulatedPoints
- instance where triangulated 3D points will be stored or null if triangulated points don't need to be kept.validTriangulatedPoints
- instance which indicates which triangulated 3D points are considered valid because they lie in front of both cameras or null if such data doesn't need to be kept.- Returns:
- number of valid triangulated points which lie in front of the two estimated cameras.
- Throws:
InitialCamerasEstimationFailedException
- if estimation of cameras fails for some reason, typically due to numerical instabilities.IllegalArgumentException
- if provided lists of left and right points don't have the same size.
-
internalSetLeftAndRightPoints
private void internalSetLeftAndRightPoints(List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints) Internal method to set matched 2D points on left and right views. This method does not check whether the estimator is locked or not, only ensures that provided lists have the same size.- Parameters:
leftPoints
- matched 2D points on left view.rightPoints
- matched 2D points on right view.- Throws:
IllegalArgumentException
- if provided lists don't have the same size.
-