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

Class PerspectiveOps



  • public class PerspectiveOps
    extends java.lang.Object
    Functions related to perspective geometry and intrinsic camera calibration.
    • Constructor Detail

      • PerspectiveOps

        public PerspectiveOps()
    • Method Detail

      • createIntrinsic

        public static IntrinsicParameters createIntrinsic(int width,
                                                          int height,
                                                          double hfov,
                                                          double vfov)
        Creates a set of intrinsic parameters, without distortion, for a camera with the specified characteristics
        Parameters:
        width - Image width
        height - Image height
        hfov - Horizontal FOV in degrees
        vfov - Vertical FOV in degrees
        Returns:
        guess camera parameters
      • createIntrinsic

        public static IntrinsicParameters createIntrinsic(int width,
                                                          int height,
                                                          double hfov)
        Creates a set of intrinsic parameters, without distortion, for a camera with the specified characteristics. The focal length is assumed to be the same for x and y.
        Parameters:
        width - Image width
        height - Image height
        hfov - Horizontal FOV in degrees
        Returns:
        guess camera parameters
      • scaleIntrinsic

        public static void scaleIntrinsic(IntrinsicParameters param,
                                          double scale)
        Multiplies each element of the intrinsic parameters by the provided scale factor. Useful if the image has been rescaled.
        Parameters:
        param - Intrinsic parameters
        scale - Scale factor that input image is being scaled by.
      • adjustIntrinsic

        public static IntrinsicParameters adjustIntrinsic(IntrinsicParameters parameters,
                                                          org.ejml.data.DenseMatrix64F adjustMatrix,
                                                          IntrinsicParameters adjustedParam)

        Recomputes the IntrinsicParameters given an adjustment matrix.

        KA = A*K
        Where KA is the returned adjusted intrinsic matrix, A is the adjustment matrix and K is the original intrinsic calibration matrix.

        NOTE: Distortion parameters are ignored in the provided IntrinsicParameters class.

        Parameters:
        parameters - (Input) Original intrinsic parameters. Not modified.
        adjustMatrix - (Input) Adjustment matrix. Not modified.
        adjustedParam - (Output) Optional storage for adjusted intrinsic parameters. Can be null.
        Returns:
        Adjusted intrinsic parameters.
      • calibrationMatrix

        public static org.ejml.data.DenseMatrix64F calibrationMatrix(double fx,
                                                                     double fy,
                                                                     double skew,
                                                                     double xc,
                                                                     double yc)
        Given the intrinsic parameters create a calibration matrix
        Parameters:
        fx - Focal length x-axis in pixels
        fy - Focal length y-axis in pixels
        skew - skew in pixels
        xc - camera center x-axis in pixels
        yc - center center y-axis in pixels
        Returns:
        Calibration matrix 3x3
      • calibrationMatrix

        public static org.ejml.data.DenseMatrix64F calibrationMatrix(IntrinsicParameters param,
                                                                     org.ejml.data.DenseMatrix64F K)
        Given the intrinsic parameters create a calibration matrix
        Parameters:
        param - Intrinsic parameters structure that is to be converted into a matrix
        K - Storage for calibration matrix, must be 3x3. If null then a new matrix is declared
        Returns:
        Calibration matrix 3x3
      • matrixToParam

        public static IntrinsicParameters matrixToParam(org.ejml.data.DenseMatrix64F K,
                                                        int width,
                                                        int height,
                                                        IntrinsicParameters param)
        Converts a calibration matrix into intrinsic parameters
        Parameters:
        K - Camera calibration matrix.
        width - Image width in pixels
        height - Image height in pixels
        param - Where the intrinsic parameter are written to. If null then a new instance is declared.
        Returns:
        IntrinsicParameters structure.
      • convertNormToPixel

        public static Point2D_F64 convertNormToPixel(IntrinsicParameters param,
                                                     double x,
                                                     double y,
                                                     Point2D_F64 pixel)

        Convenient function for converting from normalized image coordinates to the original image pixel coordinate. If speed is a concern then NormalizedToPixel_F64 should be used instead.

        Parameters:
        param - Intrinsic camera parameters
        x - X-coordinate of normalized.
        y - Y-coordinate of normalized.
        pixel - Optional storage for output. If null a new instance will be declared.
        Returns:
        pixel image coordinate
      • convertNormToPixel

        public static Point2D_F32 convertNormToPixel(IntrinsicParameters param,
                                                     float x,
                                                     float y,
                                                     Point2D_F32 pixel)

        Convenient function for converting from normalized image coordinates to the original image pixel coordinate. If speed is a concern then NormalizedToPixel_F32 should be used instead.

        Parameters:
        param - Intrinsic camera parameters
        x - X-coordinate of normalized.
        y - Y-coordinate of normalized.
        pixel - Optional storage for output. If null a new instance will be declared.
        Returns:
        pixel image coordinate
      • convertNormToPixel

        public static Point2D_F64 convertNormToPixel(IntrinsicParameters param,
                                                     Point2D_F64 norm,
                                                     Point2D_F64 pixel)

        Convenient function for converting from normalized image coordinates to the original image pixel coordinate. If speed is a concern then NormalizedToPixel_F64 should be used instead.

        NOTE: norm and pixel can be the same instance.
        Parameters:
        param - Intrinsic camera parameters
        norm - Normalized image coordinate.
        pixel - Optional storage for output. If null a new instance will be declared.
        Returns:
        pixel image coordinate
      • convertNormToPixel

        public static Point2D_F64 convertNormToPixel(org.ejml.data.DenseMatrix64F K,
                                                     Point2D_F64 norm,
                                                     Point2D_F64 pixel)

        Convenient function for converting from normalized image coordinates to the original image pixel coordinate. If speed is a concern then NormalizedToPixel_F64 should be used instead.

        NOTE: norm and pixel can be the same instance.
        Parameters:
        K - Intrinsic camera calibration matrix
        norm - Normalized image coordinate.
        pixel - Optional storage for output. If null a new instance will be declared.
        Returns:
        pixel image coordinate
      • convertPixelToNorm

        public static Point2D_F64 convertPixelToNorm(IntrinsicParameters param,
                                                     Point2D_F64 pixel,
                                                     Point2D_F64 norm)

        Convenient function for converting from original image pixel coordinate to normalized< image coordinates. If speed is a concern then PixelToNormalized_F64 should be used instead.

        NOTE: norm and pixel can be the same instance.
        Parameters:
        param - Intrinsic camera parameters
        pixel - Pixel coordinate
        norm - Optional storage for output. If null a new instance will be declared.
        Returns:
        normalized image coordinate
      • convertPixelToNorm

        public static Point2D_F32 convertPixelToNorm(IntrinsicParameters param,
                                                     Point2D_F32 pixel,
                                                     Point2D_F32 norm)

        Convenient function for converting from original image pixel coordinate to normalized< image coordinates. If speed is a concern then PixelToNormalized_F32 should be used instead.

        NOTE: norm and pixel can be the same instance.
        Parameters:
        param - Intrinsic camera parameters
        pixel - Pixel coordinate
        norm - Optional storage for output. If null a new instance will be declared.
        Returns:
        normalized image coordinate
      • convertPixelToNorm

        public static Point2D_F64 convertPixelToNorm(org.ejml.data.DenseMatrix64F K,
                                                     Point2D_F64 pixel,
                                                     Point2D_F64 norm)

        Convenient function for converting from original image pixel coordinate to normalized< image coordinates. If speed is a concern then PixelToNormalized_F64 should be used instead.

        NOTE: norm and pixel can be the same instance.
        Parameters:
        K - Intrinsic camera calibration matrix
        pixel - Pixel coordinate.
        norm - Optional storage for output. If null a new instance will be declared.
        Returns:
        normalized image coordinate
      • renderPixel

        public static Point2D_F64 renderPixel(Se3_F64 worldToCamera,
                                              org.ejml.data.DenseMatrix64F K,
                                              Point3D_F64 X)
        Renders a point in world coordinates into the image plane in pixels or normalized image coordinates.
        Parameters:
        worldToCamera - Transform from world to camera frame
        K - Optional. Intrinsic camera calibration matrix. If null then normalized image coordinates are returned.
        X - 3D Point in world reference frame..
        Returns:
        2D Render point on image plane or null if it's behind the camera
      • renderPixel

        public static Point2D_F64 renderPixel(IntrinsicParameters intrinsic,
                                              Point3D_F64 X)
        Renders a point in camera coordinates into the image plane in pixels.
        Parameters:
        intrinsic - Intrinsic camera parameters.
        X - 3D Point in world reference frame..
        Returns:
        2D Render point on image plane or null if it's behind the camera
      • renderPixel

        public static Point2D_F64 renderPixel(org.ejml.data.DenseMatrix64F worldToCamera,
                                              Point3D_F64 X)
        Computes the image coordinate of a point given its 3D location and the camera matrix.
        Parameters:
        worldToCamera - 3x4 camera matrix for transforming a 3D point from world to image coordinates.
        X - 3D Point in world reference frame..
        Returns:
        2D Render point on image plane.
      • splitAssociated

        public static void splitAssociated(java.util.List<AssociatedPair> pairs,
                                           java.util.List<Point2D_F64> view1,
                                           java.util.List<Point2D_F64> view2)
        Takes a list of AssociatedPair as input and breaks it up into two lists for each view.
        Parameters:
        pairs - Input: List of associated pairs.
        view1 - Output: List of observations from view 1
        view2 - Output: List of observations from view 2
      • splitAssociated

        public static void splitAssociated(java.util.List<AssociatedTriple> pairs,
                                           java.util.List<Point2D_F64> view1,
                                           java.util.List<Point2D_F64> view2,
                                           java.util.List<Point2D_F64> view3)
        Takes a list of AssociatedTriple as input and breaks it up into three lists for each view.
        Parameters:
        pairs - Input: List of associated triples.
        view1 - Output: List of observations from view 1
        view2 - Output: List of observations from view 2
        view3 - Output: List of observations from view 3
      • createCameraMatrix

        public static org.ejml.data.DenseMatrix64F createCameraMatrix(org.ejml.data.DenseMatrix64F R,
                                                                      Vector3D_F64 T,
                                                                      org.ejml.data.DenseMatrix64F K,
                                                                      org.ejml.data.DenseMatrix64F ret)
        Create a 3x4 camera matrix. For calibrated camera P = [R|T]. For uncalibrated camera it is P = K*[R|T].
        Parameters:
        R - Rotation matrix. 3x3
        T - Translation vector.
        K - Optional camera calibration matrix 3x3.
        ret - Storage for camera calibration matrix. If null a new instance will be created.
        Returns:
        Camera calibration matrix.

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.