Class DualImageOfAbsoluteConicInitialCamerasEstimator

java.lang.Object
com.irurueta.ar.sfm.InitialCamerasEstimator
com.irurueta.ar.sfm.DualImageOfAbsoluteConicInitialCamerasEstimator

public class DualImageOfAbsoluteConicInitialCamerasEstimator extends InitialCamerasEstimator
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 Details

    • DEFAULT_TRIANGULATE_POINTS

      public static final boolean DEFAULT_TRIANGULATE_POINTS
      Indicates whether matched 2D points must be triangulated by default.
      See Also:
    • DEFAULT_MARK_VALID_TRIANGULATED_POINTS

      public static final boolean DEFAULT_MARK_VALID_TRIANGULATED_POINTS
      Indicates 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 aspectRatio
      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.
    • principalPointX

      private double 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

      private double 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

      private List<com.irurueta.geometry.Point2D> leftPoints
      Matched 2D points on left view.
    • rightPoints

      private List<com.irurueta.geometry.Point2D> rightPoints
      Matched 2D points on right view.
    • correctorType

      private CorrectorType correctorType
      Type of corrector to use to triangulate matched points or null if no corrector needs to be used.
    • triangulatePoints

      private boolean triangulatePoints
      Indicates whether matched 2D points need to be triangulated.
    • markValidTriangulatedPoints

      private boolean markValidTriangulatedPoints
      Marks which of the triangulated points are marked as valid (lie in front of both of the estimated cameras) and which ones aren't.
    • triangulatedPoints

      private List<com.irurueta.geometry.Point3D> triangulatedPoints
      Contains triangulated points.
    • validTriangulatedPoints

      private BitSet 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

      public DualImageOfAbsoluteConicInitialCamerasEstimator(FundamentalMatrix fundamentalMatrix)
      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

      public DualImageOfAbsoluteConicInitialCamerasEstimator(InitialCamerasEstimatorListener listener)
      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

      public InitialCamerasEstimatorMethod getMethod()
      Returns method used by this estimator.
      Specified by:
      getMethod in class InitialCamerasEstimator
      Returns:
      method used by this estimator.
    • isReady

      public boolean isReady()
      Indicates if estimator is ready.
      Specified by:
      isReady in class InitialCamerasEstimator
      Returns:
      true if estimator is ready, false otherwise.
    • estimate

      public void estimate() throws com.irurueta.geometry.estimators.LockedException, com.irurueta.geometry.estimators.NotReadyException, InitialCamerasEstimationFailedException
      Estimates cameras.
      Specified by:
      estimate in class InitialCamerasEstimator
      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

      public List<com.irurueta.geometry.Point2D> 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

      public List<com.irurueta.geometry.Point2D> 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

      public CorrectorType 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

      public List<com.irurueta.geometry.Point3D> getTriangulatedPoints()
      Gets triangulated points, if available.
      Returns:
      triangulated points or null.
    • getValidTriangulatedPoints

      public BitSet 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.