Class CameraParameters

Class Documentation

class CameraParameters

Parameters of the camera.

Public Functions

CameraParameters()

Empty constructor

CameraParameters(cv::Mat cameraMatrix, cv::Mat distorsionCoeff, cv::Size size)

Creates the object from the info passed

Parameters:
  • cameraMatrix – 3x3 matrix (fx 0 cx, 0 fy cy, 0 0 1)

  • distorsionCoeff – 4x1 matrix (k1,k2,p1,p2)

  • size – image size

void setParams(cv::Mat cameraMatrix, cv::Mat distorsionCoeff, cv::Size size)

Sets the parameters

Parameters:
  • cameraMatrix – 3x3 matrix (fx 0 cx, 0 fy cy, 0 0 1)

  • distorsionCoeff – 4x1 matrix (k1,k2,p1,p2)

  • size – image size

CameraParameters(const CameraParameters &CI)

Copy constructor

inline bool isValid() const

Indicates whether this object is valid

CameraParameters &operator=(const CameraParameters &CI)

Assign operator

void saveToFile(std::string path, bool inXML = true)

Saves this to a file

void readFromXMLFile(std::string filePath)

Reads from a YAML file generated with the opencv2.2 calibration utility

void resize(cv::Size size)

Adjust the parameters to the size of the image indicated

void glGetProjectionMatrix(cv::Size orgImgSize, cv::Size size, double proj_matrix[16], double gnear, double gfar, bool invert = false)

Given the intrinsic camera parameters returns the GL_PROJECTION matrix for opengl. PLease NOTE that when using OpenGL, it is assumed no camera distorsion! So, if it is not true, you should have undistor image

Parameters:
  • orgImgSize – size of the original image

  • size – of the image/window where to render (can be different from the real camera image). Please not that it must be related to CamMatrix

  • proj_matrix – output projection matrix to give to opengl

  • gnear, gfar – visible rendering range

  • invert – indicates if the output projection matrix has to yield a horizontally inverted image because image data has not been stored in the order of glDrawPixels: bottom-to-top.

void OgreGetProjectionMatrix(cv::Size orgImgSize, cv::Size size, double proj_matrix[16], double gnear, double gfar, bool invert = false)

setup camera for an Ogre project. Use: … Ogre::Matrix4 PM(proj_matrix[0], proj_matrix[1], … , proj_matrix[15]); yourCamera->setCustomProjectionMatrix(true, PM); yourCamera->setCustomViewMatrix(true, Ogre::Matrix4::IDENTITY); … As in OpenGL, it assumes no camera distorsion

void clear()

Makes this invalid

Public Members

cv::Mat CameraMatrix
cv::Mat Distorsion
cv::Size CamSize
cv::Mat ExtrinsicMatrix

Public Static Functions

static cv::Point3f getCameraLocation(const cv::Mat &Rvec, const cv::Mat &Tvec)

Returns the location of the camera in the reference system of the marker.

Rvec and Tvec are the transform from the marker to the camera as calculated in other parts of the library NOT TESTED

static cv::Mat getRTMatrix(const cv::Mat &R_, const cv::Mat &T_, int forceType)

Returns the 4x4 homogeneous transform matrix from the R and T vectors computed

Friends

friend ARUCO_EXPORT friend std::ostream & operator<< (std::ostream &str, const CameraParameters &cp)
friend ARUCO_EXPORT friend std::istream & operator>> (std::istream &str, CameraParameters &cp)