Documentation of 'boofcv.alg.geo.MultiViewOps' Java class
MultiViewOps
boofcv.alg.geo

Class MultiViewOps



  • public class MultiViewOps
    extends java.lang.Object

    Contains commonly used operations used in 2-view and 3-view perspective geometry.

    LINES: lines on the image place are represented in homogeneous or generic form as a 3D vector. If a point in homogeneous coordinates is on a line and the dot product is computed the result will be zero.

    • Constructor Detail

      • MultiViewOps

        public MultiViewOps()
    • Method Detail

      • createTrifocal

        public static TrifocalTensor createTrifocal(org.ejml.data.DenseMatrix64F P2,
                                                    org.ejml.data.DenseMatrix64F P3,
                                                    TrifocalTensor ret)

        Creates a trifocal tensor from two camera matrices.

        IMPORTANT: It is assumed that the first camera has the following camera matrix P1 = [I|0], where I is an identify matrix.

        Parameters:
        P2 - Camera matrix from view 1 to view 2
        P3 - Camera matrix from view 1 to view 3
        ret - Storage for trifocal tensor. If null a new instance will be created.
        Returns:
        The trifocal tensor
      • createTrifocal

        public static TrifocalTensor createTrifocal(Se3_F64 P2,
                                                    Se3_F64 P3,
                                                    TrifocalTensor ret)

        Creates a trifocal tensor from two rigid body motions. This is for the calibrated camera case.

        NOTE: View 1 is the world coordinate system.

        Parameters:
        P2 - Transform from view 1 to view 2.
        P3 - Transform from view 1 to view 3.
        ret - Storage for trifocal tensor. If null a new instance will be created.
        Returns:
        The trifocal tensor
      • constraint

        public static Vector3D_F64 constraint(TrifocalTensor tensor,
                                              Vector3D_F64 l1,
                                              Vector3D_F64 l2,
                                              Vector3D_F64 l3,
                                              Vector3D_F64 ret)

        Trifocal tensor with line-line-line correspondence:
        (l2T*[T1,T2,T3]*L2)*[l1]x = 0

        Parameters:
        tensor - Trifocal tensor
        l1 - A line in the first view.
        l2 - A line in the second view.
        l3 - A line in the third view.
        ret - Storage for output. If null a new instance will be declared.
        Returns:
        Result of applying the constraint. With perfect inputs will be zero.
      • constraint

        public static double constraint(TrifocalTensor tensor,
                                        Point2D_F64 p1,
                                        Vector3D_F64 l2,
                                        Vector3D_F64 l3)

        Trifocal tensor with point-line-line correspondence:
        (l2T*(sum p1i*Ti)*l3 = 0

        Parameters:
        tensor - Trifocal tensor
        p1 - A point in the first view.
        l2 - A line in the second view.
        l3 - A line in the third view.
        Returns:
        Result of applying the constraint. With perfect inputs will be zero.
      • constraint

        public static Vector3D_F64 constraint(TrifocalTensor tensor,
                                              Point2D_F64 p1,
                                              Vector3D_F64 l2,
                                              Point2D_F64 p3,
                                              Vector3D_F64 ret)

        Trifocal tensor with point-line-point correspondence:
        (l2T(sum p1i*Ti)[p3]x = 0

        Parameters:
        tensor - Trifocal tensor
        p1 - A point in the first view.
        l2 - A line in the second view.
        p3 - A point in the third view.
        Returns:
        Result of applying the constraint. With perfect inputs will be zero.
      • constraint

        public static Vector3D_F64 constraint(TrifocalTensor tensor,
                                              Point2D_F64 p1,
                                              Point2D_F64 p2,
                                              Vector3D_F64 l3,
                                              Vector3D_F64 ret)

        Trifocal tensor with point-point-line correspondence:
        [p2]x(sum p1i*Ti)*l3 = 0

        Parameters:
        tensor - Trifocal tensor
        p1 - A point in the first view.
        p2 - A point in the second view.
        l3 - A line in the third view.
        Returns:
        Result of applying the constraint. With perfect inputs will be zero.
      • constraint

        public static org.ejml.data.DenseMatrix64F constraint(TrifocalTensor tensor,
                                                              Point2D_F64 p1,
                                                              Point2D_F64 p2,
                                                              Point2D_F64 p3,
                                                              org.ejml.data.DenseMatrix64F ret)

        Trifocal tensor with point-point-point correspondence:
        [p2]x(sum p1i*Ti)[p3]x = 0

        Parameters:
        tensor - Trifocal tensor
        p1 - A point in the first view.
        p2 - A point in the second view.
        p3 - A point in the third view.
        ret - Optional storage for output. 3x3 matrix. Modified.
        Returns:
        Result of applying the constraint. With perfect inputs will be zero.
      • constraint

        public static double constraint(org.ejml.data.DenseMatrix64F F,
                                        Point2D_F64 p1,
                                        Point2D_F64 p2)

        Applies the epipolar relationship constraint to an essential or fundamental matrix:
        0 = p2T*F*p1
        Input points are in normalized image coordinates for an essential matrix and pixels for fundamental.

        Parameters:
        F - 3x3 essential or fundamental matrix.
        p1 - Point in view 1.
        p2 - Point in view 2.
        Returns:
        Constraint value.
      • constraintHomography

        public static Point2D_F64 constraintHomography(org.ejml.data.DenseMatrix64F H,
                                                       Point2D_F64 p1,
                                                       Point2D_F64 outputP2)

        Applies the homography constraints to two points:
        z*p2 = H*p1
        where z is a scale factor and (p1,p2) are point observations. Note that since 2D points are inputted translation and normalization to homogeneous coordinates with z=1 is automatically handled.

        Parameters:
        H - Input: 3x3 Homography matrix.
        p1 - Input: Point in view 1.
        outputP2 - Output: storage for point in view 2.
        Returns:
        Predicted point in view 2
      • inducedHomography13

        public static org.ejml.data.DenseMatrix64F inducedHomography13(TrifocalTensor tensor,
                                                                       Vector3D_F64 line2,
                                                                       org.ejml.data.DenseMatrix64F output)
        Computes the homography induced from view 1 to 3 by a line in view 2. The provided line in view 2 must contain the view 2 observation. p3 = H13*p1
        Parameters:
        tensor - Input: Trifocal tensor
        line2 - Input: Line in view 2. General notation.
        output - Output: Optional storage for homography. 3x3 matrix
        Returns:
        Homography from view 1 to 3
      • inducedHomography12

        public static org.ejml.data.DenseMatrix64F inducedHomography12(TrifocalTensor tensor,
                                                                       Vector3D_F64 line3,
                                                                       org.ejml.data.DenseMatrix64F output)
        Computes the homography induced from view 1 to 2 by a line in view 3. The provided line in view 3 must contain the view 3 observation. p2 = H12*p1
        Parameters:
        tensor - Input: Trifocal tensor
        line3 - Input: Line in view 3. General notation.
        output - Output: Optional storage for homography. 3x3 matrix
        Returns:
        Homography from view 1 to 2
      • homographyStereo3Pts

        public static org.ejml.data.DenseMatrix64F homographyStereo3Pts(org.ejml.data.DenseMatrix64F F,
                                                                        AssociatedPair p1,
                                                                        AssociatedPair p2,
                                                                        AssociatedPair p3)
        Computes the homography induced from a planar surface when viewed from two views using correspondences of three points. Observations must be on the planar surface.
        Parameters:
        F - Fundamental matrix
        p1 - Associated point observation
        p2 - Associated point observation
        p3 - Associated point observation
        Returns:
        The homography from view 1 to view 2 or null if it fails
        See Also:
        HomographyInducedStereo3Pts
      • homographyStereoLinePt

        public static org.ejml.data.DenseMatrix64F homographyStereoLinePt(org.ejml.data.DenseMatrix64F F,
                                                                          PairLineNorm line,
                                                                          AssociatedPair point)
        Computes the homography induced from a planar surface when viewed from two views using correspondences of a line and a point. Observations must be on the planar surface.
        Parameters:
        F - Fundamental matrix
        line - Line on the plane
        point - Point on the plane
        Returns:
        The homography from view 1 to view 2 or null if it fails
        See Also:
        HomographyInducedStereoLinePt
      • homographyStereo2Lines

        public static org.ejml.data.DenseMatrix64F homographyStereo2Lines(org.ejml.data.DenseMatrix64F F,
                                                                          PairLineNorm line0,
                                                                          PairLineNorm line1)
        Computes the homography induced from a planar surface when viewed from two views using correspondences of two lines. Observations must be on the planar surface.
        Parameters:
        F - Fundamental matrix
        line0 - Line on the plane
        line1 - Line on the plane
        Returns:
        The homography from view 1 to view 2 or null if it fails
        See Also:
        HomographyInducedStereo2Line
      • extractEpipoles

        public static void extractEpipoles(TrifocalTensor tensor,
                                           Point3D_F64 e2,
                                           Point3D_F64 e3)

        Computes the epipoles of the first camera in the second and third images. Epipoles are found in homogeneous coordinates and have a norm of 1.

        Properties:

        • e2T*F12 = 0
        • e3T*F13 = 0
        where F1i is a fundamental matrix from image 1 to i.

        Parameters:
        tensor - Trifocal tensor. Not Modified
        e2 - Output: Epipole in image 2. Homogeneous coordinates. Modified
        e3 - Output: Epipole in image 3. Homogeneous coordinates. Modified
        See Also:
        TrifocalExtractEpipoles
      • extractFundamental

        public static void extractFundamental(TrifocalTensor tensor,
                                              org.ejml.data.DenseMatrix64F F2,
                                              org.ejml.data.DenseMatrix64F F3)

        Extract the fundamental matrices between views 1 + 2 and views 1 + 3. The returned Fundamental matrices will have the following properties: xiT*Fi*x1 = 0, where i is view 2 or 3.

        NOTE: The first camera is assumed to have the camera matrix of P1 = [I|0]. Thus observations in pixels for the first camera will not meet the epipolar constraint when applied to the returned fundamental matrices.

        Parameters:
        tensor - Trifocal tensor. Not modified.
        F2 - Output: Fundamental matrix for views 1 and 2. Modified.
        F3 - Output: Fundamental matrix for views 1 and 3. Modified.
      • extractCameraMatrices

        public static void extractCameraMatrices(TrifocalTensor tensor,
                                                 org.ejml.data.DenseMatrix64F P2,
                                                 org.ejml.data.DenseMatrix64F P3)

        Extract the camera matrices up to a common projective transform.

        NOTE: The camera matrix for the first view is assumed to be P1 = [I|0].

        Parameters:
        tensor - Trifocal tensor. Not modified.
        P2 - Output: 3x4 camera matrix for views 1 to 2. Modified.
        P3 - Output: 3x4 camera matrix for views 1 to 3. Modified.
      • createEssential

        public static org.ejml.data.DenseMatrix64F createEssential(org.ejml.data.DenseMatrix64F R,
                                                                   Vector3D_F64 T)

        Computes an essential matrix from a rotation and translation. This motion is the motion from the first camera frame into the second camera frame. The essential matrix 'E' is defined as:
        E = hat(T)*R
        where hat(T) is the skew symmetric cross product matrix for vector T.

        Parameters:
        R - Rotation matrix.
        T - Translation vector.
        Returns:
        Essential matrix
      • createFundamental

        public static org.ejml.data.DenseMatrix64F createFundamental(org.ejml.data.DenseMatrix64F E,
                                                                     org.ejml.data.DenseMatrix64F K)
        Computes a Fundamental matrix given an Essential matrix and the camera calibration matrix. F = (K-1)T*E*K-1
        Parameters:
        E - Essential matrix
        K - Intrinsic camera calibration matrix
        Returns:
        Fundamental matrix
      • createFundamental

        public static org.ejml.data.DenseMatrix64F createFundamental(org.ejml.data.DenseMatrix64F E,
                                                                     org.ejml.data.DenseMatrix64F K1,
                                                                     org.ejml.data.DenseMatrix64F K2)
        Computes a Fundamental matrix given an Essential matrix and the camera calibration matrix. F = (K2-1)T*E*K1-1
        Parameters:
        E - Essential matrix
        K1 - Intrinsic camera calibration matrix for camera 1
        K2 - Intrinsic camera calibration matrix for camera 2
        Returns:
        Fundamental matrix
      • createHomography

        public static org.ejml.data.DenseMatrix64F createHomography(org.ejml.data.DenseMatrix64F R,
                                                                    Vector3D_F64 T,
                                                                    double d,
                                                                    Vector3D_F64 N)

        Computes a homography matrix from a rotation, translation, plane normal and plane distance:
        H = R+(1/d)*T*NT

        Parameters:
        R - Rotation matrix.
        T - Translation vector.
        d - Distance of closest point on plane to camera
        N - Normal of plane
        Returns:
        Calibrated homography matrix
      • createHomography

        public static org.ejml.data.DenseMatrix64F createHomography(org.ejml.data.DenseMatrix64F R,
                                                                    Vector3D_F64 T,
                                                                    double d,
                                                                    Vector3D_F64 N,
                                                                    org.ejml.data.DenseMatrix64F K)

        Computes a homography matrix from a rotation, translation, plane normal, plane distance, and calibration matrix:
        H = K*(R+(1/d)*T*NT)*K-1

        Parameters:
        R - Rotation matrix.
        T - Translation vector.
        d - Distance of closest point on plane to camera
        N - Normal of plane
        K - Intrinsic calibration matrix
        Returns:
        Uncalibrated homography matrix
      • extractEpipoles

        public static void extractEpipoles(org.ejml.data.DenseMatrix64F F,
                                           Point3D_F64 e1,
                                           Point3D_F64 e2)

        Extracts the epipoles from an essential or fundamental matrix. The epipoles are extracted from the left and right null space of the provided matrix. Note that the found epipoles are in homogeneous coordinates. If the epipole is at infinity then z=0

        Left: e2T*F = 0
        Right: F*e1 = 0

        Parameters:
        F - Input: Fundamental or Essential 3x3 matrix. Not modified.
        e1 - Output: Right epipole in homogeneous coordinates. Can be null. Modified.
        e2 - Output: Left epipole in homogeneous coordinates. Can be null. Modified.
      • canonicalCamera

        public static org.ejml.data.DenseMatrix64F canonicalCamera(org.ejml.data.DenseMatrix64F F,
                                                                   Point3D_F64 e2,
                                                                   Vector3D_F64 v,
                                                                   double lambda)

        Given a fundamental matrix a pair of projection matrices [R|T] can be extracted. There are multiple solutions which can be found, the canonical projection matrix is defined as:

         P=[I|0] and P'= [M|-M*t] = [[e']*F + e'*v^t | lambda*e']
         
        where e' is the epipole FTe' = 0, [e'] is the cross product matrix for the enclosed vector, v is an arbitrary 3-vector and lambda is a non-zero scalar.

        Page 256 in R. Hartley, and A. Zisserman, "Multiple View Geometry in Computer Vision", 2nd Ed, Cambridge 2003

        Parameters:
        F - A fundamental matrix
        v - Arbitrary 3-vector. Just pick some value, say (1,1,1).
        lambda - A non zero scalar. Try one.
        e2 - Left epipole of fundamental matrix, FT*e2 = 0.
        Returns:
        The canonical camera matrix P'
        See Also:
        extractEpipoles(boofcv.struct.geo.TrifocalTensor, georegression.struct.point.Point3D_F64, georegression.struct.point.Point3D_F64)
      • decomposeCameraMatrix

        public static void decomposeCameraMatrix(org.ejml.data.DenseMatrix64F P,
                                                 org.ejml.data.DenseMatrix64F K,
                                                 Se3_F64 pose)

        Decomposes a camera matrix P=A*[R|T], where A is an upper triangular camera calibration matrix, R is a rotation matrix, and T is a translation vector.

        • NOTE: There are multiple valid solutions to this problem and only one solution is returned.
        • NOTE: The camera center will be on the plane at infinity.

        Parameters:
        P - Input: Camera matrix, 3 by 4
        K - Output: Camera calibration matrix, 3 by 3.
        pose - Output: The rotation and translation.
      • decomposeEssential

        public static java.util.List<Se3_F64> decomposeEssential(org.ejml.data.DenseMatrix64F E)
        Decomposes an essential matrix into the rigid body motion which it was constructed from. Due to ambiguities there are four possible solutions. See DecomposeEssential for the details. The correct solution can be found using triangulation and the positive depth constraint, e.g. the objects must be in front of the camera to be seen. Also note that the scale of the translation is lost, even with perfect data.
        Parameters:
        E - An essential matrix.
        Returns:
        Four possible motions
        See Also:
        DecomposeEssential
      • decomposeHomography

        public static java.util.List<Tuple2<Se3_F64,Vector3D_F64>> decomposeHomography(org.ejml.data.DenseMatrix64F H)
        Decomposes a homography matrix that's in Euclidean space (computed from features in normalized image coordinates). The homography is defined as H = (R + (1/d)*T*NT), where R is a 3x3 rotation matrix, d is the distance of the plane, N is the plane's normal (unit vector), T is the translation vector. If the homography is from view 'a' to 'b' then transform (R,T) will be from reference 'a' to 'b'. Note that the returned 'T' is divided by 'd'.
        Parameters:
        H - Homography in Euclidean space
        Returns:
        The set of four possible solutions. First param: motion (R,T). Second param: plane normal vector.
        See Also:
        DecomposeHomography

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.