OpenCV  3.4.20
Open Source Computer Vision
Public Member Functions | Static Public Member Functions | List of all members
cv::viz::Camera Class Reference

This class wraps intrinsic parameters of a camera. More...

#include <opencv2/viz/types.hpp>

Public Member Functions

 Camera (double fx, double fy, double cx, double cy, const Size &window_size)
 Constructs a Camera. More...
 
 Camera (const Vec2d &fov, const Size &window_size)
 
 Camera (const Matx33d &K, const Size &window_size)
 
 Camera (const Matx44d &proj, const Size &window_size)
 
void computeProjectionMatrix (Matx44d &proj) const
 Computes projection matrix using intrinsic parameters of the camera. More...
 
const Vec2dgetClip () const
 
const Vec2dgetFocalLength () const
 
const Vec2dgetFov () const
 
const Vec2dgetPrincipalPoint () const
 
const SizegetWindowSize () const
 
void setClip (const Vec2d &clip)
 
void setFov (const Vec2d &fov)
 
void setWindowSize (const Size &window_size)
 

Static Public Member Functions

static Camera KinectCamera (const Size &window_size)
 Creates a Kinect Camera with. More...
 

Detailed Description

This class wraps intrinsic parameters of a camera.

It provides several constructors that can extract the intrinsic parameters from field of view, intrinsic matrix and projection matrix. :

Constructor & Destructor Documentation

◆ Camera() [1/4]

cv::viz::Camera::Camera ( double  fx,
double  fy,
double  cx,
double  cy,
const Size window_size 
)

Constructs a Camera.

Parameters
fxHorizontal focal length.
fyVertical focal length.
cxx coordinate of the principal point.
cyy coordinate of the principal point.
window_sizeSize of the window. This together with focal length and principal point determines the field of view.

◆ Camera() [2/4]

cv::viz::Camera::Camera ( const Vec2d fov,
const Size window_size 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
fovField of view (horizontal, vertical) in radians
window_sizeSize of the window. Principal point is at the center of the window by default.

◆ Camera() [3/4]

cv::viz::Camera::Camera ( const Matx33d K,
const Size window_size 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
KIntrinsic matrix of the camera with the following form

\[ \begin{bmatrix} f_x & 0 & c_x\\ 0 & f_y & c_y\\ 0 & 0 & 1\\ \end{bmatrix} \]

window_sizeSize of the window. This together with intrinsic matrix determines the field of view.

◆ Camera() [4/4]

cv::viz::Camera::Camera ( const Matx44d proj,
const Size window_size 
)
explicit

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
projProjection matrix of the camera with the following form

\[ \begin{bmatrix} \frac{2n}{r-l} & 0 & \frac{r+l}{r-l} & 0\\ 0 & \frac{2n}{t-b} & \frac{t+b}{t-b} & 0\\ 0 & 0 & -\frac{f+n}{f-n} & -\frac{2fn}{f-n}\\ 0 & 0 & -1 & 0\\ \end{bmatrix} \]

window_sizeSize of the window. This together with projection matrix determines the field of view.

Member Function Documentation

◆ computeProjectionMatrix()

void cv::viz::Camera::computeProjectionMatrix ( Matx44d proj) const

Computes projection matrix using intrinsic parameters of the camera.

Parameters
projOutput projection matrix with the following form

\[ \begin{bmatrix} \frac{2n}{r-l} & 0 & \frac{r+l}{r-l} & 0\\ 0 & \frac{2n}{t-b} & \frac{t+b}{t-b} & 0\\ 0 & 0 & -\frac{f+n}{f-n} & -\frac{2fn}{f-n}\\ 0 & 0 & -1 & 0\\ \end{bmatrix} \]

◆ getClip()

const Vec2d& cv::viz::Camera::getClip ( ) const
inline

◆ getFocalLength()

const Vec2d& cv::viz::Camera::getFocalLength ( ) const
inline

◆ getFov()

const Vec2d& cv::viz::Camera::getFov ( ) const
inline

◆ getPrincipalPoint()

const Vec2d& cv::viz::Camera::getPrincipalPoint ( ) const
inline

◆ getWindowSize()

const Size& cv::viz::Camera::getWindowSize ( ) const
inline

◆ KinectCamera()

static Camera cv::viz::Camera::KinectCamera ( const Size window_size)
static

Creates a Kinect Camera with.

  • fx = fy = 525
  • cx = 320
  • cy = 240
Parameters
window_sizeSize of the window. This together with intrinsic matrix of a Kinect Camera determines the field of view.

◆ setClip()

void cv::viz::Camera::setClip ( const Vec2d clip)
inline

◆ setFov()

void cv::viz::Camera::setFov ( const Vec2d fov)
inline

◆ setWindowSize()

void cv::viz::Camera::setWindowSize ( const Size window_size)

The documentation for this class was generated from the following file: