Class cv::viz::Camera#

This class wraps intrinsic parameters of a camera. View details

Collaboration diagram for cv::viz::Camera:

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. :

Examples
samples/cpp/stitching_detailed.cpp, and samples/dnn/object_detection.cpp.

Constructor & Destructor Documentation#

Camera()#

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

  • K — Intrinsic matrix of the camera with the following form

    \[\begin{split} \begin{bmatrix} f_x & 0 & c_x\\ 0 & f_y & c_y\\ 0 & 0 & 1\\ \end{bmatrix} \end{split}\]
  • window_size — Size of the window. This together with intrinsic matrix determines the field of view.

Camera()#

cv::viz::Camera::Camera(
const Matx44d & proj,
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

  • proj — Projection matrix of the camera with the following form

    \[\begin{split} \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} \end{split}\]
  • window_size — Size of the window. This together with projection matrix determines the field of view.

Camera()#

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

  • fov — Field of view (horizontal, vertical) in radians

  • window_size — Size of the window. Principal point is at the center of the window by default.

Camera()#

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

Constructs a Camera.

Parameters

  • fx — Horizontal focal length.

  • fy — Vertical focal length.

  • cx — x coordinate of the principal point.

  • cy — y coordinate of the principal point.

  • window_size — Size of the window. This together with focal length and principal point determines the field of view.

Member Function Documentation#

computeProjectionMatrix()#

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

Computes projection matrix using intrinsic parameters of the camera.

Parameters

  • proj — Output projection matrix with the following form

    \[\begin{split} \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} \end{split}\]

getClip()#

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

getFocalLength()#

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

getFov()#

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

getPrincipalPoint()#

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

getWindowSize()#

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

setClip()#

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

setFov()#

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

setWindowSize()#

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

KinectCamera()#

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

Creates a Kinect Camera with.

  • fx = fy = 525

  • cx = 320

  • cy = 240

Parameters

  • window_size — Size of the window. This together with intrinsic matrix of a Kinect Camera determines the field of view.

init()#

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

Member Data Documentation#

clip_#

Vec2d cv::viz::Camera::clip_

The near plane and the far plane.

  • clip_[0]: the near plane; default value is 0.01

  • clip_[1]: the far plane; default value is 1000.01

focal_#

Vec2d cv::viz::Camera::focal_

Focal length.

  • focal_[0]: fx

  • focal_[1]: fy

fov_#

Vec2d cv::viz::Camera::fov_

Field of view.

  • fov_[0]: horizontal(x-axis) field of view in radians

  • fov_[1]: vertical(y-axis) field of view in radians

principal_point_#

Vec2d cv::viz::Camera::principal_point_

Principal point.

  • principal_point_[0]: cx

  • principal_point_[1]: cy

window_size_#

Size cv::viz::Camera::window_size_

Window size.

Source file#

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