class cv::viz::Camera

Overview

This class wraps intrinsic parameters of a camera. Moreā€¦

#include <types.hpp>

class Camera
{
public:
    // construction

    Camera(
        double fx,
        double fy,
        double cx,
        double cy,
        const Size& window_size
        );

    Camera(
        const Vec2d& fov,
        const Size& window_size
        );

    Camera(
        const Matx33d& K,
        const Size& window_size
        );

    Camera(
        const Matx44d& proj,
        const Size& window_size
        );

    // methods

    void
    computeProjectionMatrix(Matx44d& proj) const;

    const Vec2d&
    getClip() const;

    const Vec2d&
    getFocalLength() const;

    const Vec2d&
    getFov() const;

    const Vec2d&
    getPrincipalPoint() const;

    const Size&
    getWindowSize() const;

    void
    setClip(const Vec2d& clip);

    void
    setFov(const Vec2d& fov);

    void
    setWindowSize(const Size& window_size);

    static
    Camera
    KinectCamera(const Size& window_size);
};

Detailed Documentation

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

Construction

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.
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)
window_size Size of the window. Principal point is at the center of the window by default.
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.
window_size Size of the window. This together with intrinsic matrix determines the field of view.
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.
window_size Size of the window. This together with projection matrix determines the field of view.

Methods

void
computeProjectionMatrix(Matx44d& proj) const

Computes projection matrix using intrinsic parameters of the camera.

Parameters:

proj Output projection matrix.
static
Camera
KinectCamera(const Size& window_size)

Creates a Kinect Camera.

Parameters:

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