Class StereoCameraModel


  • public class StereoCameraModel
    extends SensorModel
    The Camera class defines a general interface to a stereo camera.
    A stereo camera consists of two cameras with the same intrinsic parameters,
    but with different extrinsic parameters.

    Since ideal cameras are assumed, the intrinsics are given as a horizontal/vertical
    pixel resolution as well as a horizontal field of view (FOV).

    The extrinsic parameters are given simply as two transformation matrices,
    which give the pose of the cameras relative some external frame.
    • Constructor Detail

      • StereoCameraModel

        public StereoCameraModel​(long cPtr,
                                 boolean cMemoryOwn)
      • StereoCameraModel

        public StereoCameraModel​(java.lang.String name,
                                 double fov,
                                 double width,
                                 double height,
                                 Transform3Dd TL,
                                 Transform3Dd TR,
                                 Frame frame,
                                 java.lang.String modelInfo)
        constructor
        Parameters:
        name - [in] name of sensor
        fov - [in] horizontal field of view
        width - [in] width of image
        height - [in] height of image
        TL - [in] transform from sensor frame to left camera frame
        TR - [in] transform from sensor frame to right camera frame
        frame - [in] sensor frame
        modelInfo - [in] info string
      • StereoCameraModel

        public StereoCameraModel​(java.lang.String name,
                                 double fov,
                                 double width,
                                 double height,
                                 Transform3Dd TL,
                                 Transform3Dd TR,
                                 Frame frame)
        constructor
        Parameters:
        name - [in] name of sensor
        fov - [in] horizontal field of view
        width - [in] width of image
        height - [in] height of image
        TL - [in] transform from sensor frame to left camera frame
        TR - [in] transform from sensor frame to right camera frame
        frame - [in] sensor frame
    • Method Detail

      • getLeftImage

        public ImagePtr getLeftImage​(State state)
        get left image
      • setLeftImage

        public void setLeftImage​(ImagePtr img,
                                 State state)
        set left image
      • getRightImage

        public ImagePtr getRightImage​(State state)
        get right image
      • setRightImage

        public void setRightImage​(ImagePtr img,
                                  State state)
        set right image
      • SaveCalibration

        public static boolean SaveCalibration​(java.lang.String filename,
                                              double fov,
                                              double wx,
                                              double wy,
                                              Transform3Dd TL,
                                              Transform3Dd TR,
                                              StereoCameraModel.FOVDirection direction,
                                              StereoCameraModel.CalibrationFormat format)
        utility function for saving a stereo calibration to a file

        Parameters:
        filename - [in] file to save to
        fov - [in] field of view (FOV) [rad]
        wx - [in] horizontal pixels
        wy - [in] vertical pixels
        TL - [in] transformation of left camera frame
        TR - [in] transformation of right camera frame
        direction - [in] the direction of the specified FOV
        format - [in] calibration file format to use
        Returns:
        true if the file was successfully saved, false otherwise
      • SaveCalibration

        public static boolean SaveCalibration​(java.lang.String filename,
                                              double fov,
                                              double wx,
                                              double wy,
                                              Transform3Dd TL,
                                              Transform3Dd TR,
                                              StereoCameraModel.FOVDirection direction)
        utility function for saving a stereo calibration to a file

        Parameters:
        filename - [in] file to save to
        fov - [in] field of view (FOV) [rad]
        wx - [in] horizontal pixels
        wy - [in] vertical pixels
        TL - [in] transformation of left camera frame
        TR - [in] transformation of right camera frame
        direction - [in] the direction of the specified FOV

        Returns:
        true if the file was successfully saved, false otherwise
      • SaveCalibration

        public static boolean SaveCalibration​(java.lang.String filename,
                                              double fov,
                                              double wx,
                                              double wy,
                                              Transform3Dd TL,
                                              Transform3Dd TR)
        utility function for saving a stereo calibration to a file

        Parameters:
        filename - [in] file to save to
        fov - [in] field of view (FOV) [rad]
        wx - [in] horizontal pixels
        wy - [in] vertical pixels
        TL - [in] transformation of left camera frame
        TR - [in] transformation of right camera frame


        Returns:
        true if the file was successfully saved, false otherwise
      • WriteCalibration

        public static void WriteCalibration​(SWIGTYPE_p_std__ostream os,
                                            double fov,
                                            double wx,
                                            double wy,
                                            Transform3Dd T,
                                            VectorDouble dist,
                                            StereoCameraModel.FOVDirection direction,
                                            StereoCameraModel.CalibrationFormat format)
        utility function for writing a camera calibration to a stream

        Parameters:
        os - the stream to write to
        fov - field of view (FOV) [rad]
        wx - horizontal pixels
        wy - vertical pixels
        T - [in] transformation of the camera frame
        dist - [in] distortion parameters
        direction - [in] the direction of the specified FOV
        format - [in] calibration file format to use
      • WriteCalibration

        public static void WriteCalibration​(SWIGTYPE_p_std__ostream os,
                                            double fov,
                                            double wx,
                                            double wy,
                                            Transform3Dd T,
                                            VectorDouble dist,
                                            StereoCameraModel.FOVDirection direction)
        utility function for writing a camera calibration to a stream

        Parameters:
        os - the stream to write to
        fov - field of view (FOV) [rad]
        wx - horizontal pixels
        wy - vertical pixels
        T - [in] transformation of the camera frame
        dist - [in] distortion parameters
        direction - [in] the direction of the specified FOV
      • WriteCalibration

        public static void WriteCalibration​(SWIGTYPE_p_std__ostream os,
                                            double fov,
                                            double wx,
                                            double wy,
                                            Transform3Dd T,
                                            VectorDouble dist)
        utility function for writing a camera calibration to a stream

        Parameters:
        os - the stream to write to
        fov - field of view (FOV) [rad]
        wx - horizontal pixels
        wy - vertical pixels
        T - [in] transformation of the camera frame
        dist - [in] distortion parameters

      • WriteCalibration

        public static void WriteCalibration​(SWIGTYPE_p_std__ostream os,
                                            double fov,
                                            double wx,
                                            double wy,
                                            Transform3Dd T)
        utility function for writing a camera calibration to a stream

        Parameters:
        os - the stream to write to
        fov - field of view (FOV) [rad]
        wx - horizontal pixels
        wy - vertical pixels
        T - [in] transformation of the camera frame