Loading...
Searching...
No Matches
pcl::visualization::Camera Class Reference

Camera class holds a set of camera parameters together with the window pos/size. More...

`#include <pcl/visualization/common/common.h>`

## Public Member Functions

| Camera ()
| Construct a camera with meaningful default values.
| Camera (vtkCamera &camera)
| Construct a camera by copying parameters from a VTK camera.
| Camera (vtkCamera &camera, vtkRenderWindow &window)
| Construct a camera by copying parameters from a VTK camera and a VTK render window.
void | computeViewMatrix (Eigen::Matrix4d &view_mat) const
| Computes View matrix for Camera (Based on gluLookAt).
void | computeProjectionMatrix (Eigen::Matrix4d &proj) const
| Computes Projection Matrix for Camera.
template<typename PointT>
void | cvtWindowCoordinates (const PointT &pt, Eigen::Vector4d &window_cord) const
| Converts point to window coordinates.
template<typename PointT>
void | cvtWindowCoordinates (const PointT &pt, Eigen::Vector4d &window_cord, const Eigen::Matrix4d &composite_mat) const
| Converts point to window coordinates.

## Public Attributes

double | focal [3]
| Focal point or lookAt.
double | pos [3]
| Position of the camera.
double | view [3]
| Up vector of the camera.
double | clip [2]
| Clipping planes depths.
double | fovy
| Field of view angle in y direction (radians).
double | window_size [2]
double | window_pos [2]

## Detailed Description

Camera class holds a set of camera parameters together with the window pos/size.

Definition at line 152 of file common.h.

## Constructor & Destructor Documentation

## Camera() [1/3]

pcl::visualization::Camera::Camera | ( |  | ) |

Construct a camera with meaningful default values.

The camera is positioned at origin, looks along z-axis and has up-vector along y-axis. Window position and size are initialized with (0, 0) and (1, 1) respectively.

## Camera() [2/3]

pcl::visualization::Camera::Camera | ( | vtkCamera & | camera | ) |

Construct a camera by copying parameters from a VTK camera.

Window position and size are initialized with (0, 0) and (1, 1) respectively.

## Camera() [3/3]

pcl::visualization::Camera::Camera | ( | vtkCamera & | camera,
|  | vtkRenderWindow & | window )

Construct a camera by copying parameters from a VTK camera and a VTK render window.

## Member Function Documentation

## computeProjectionMatrix()

void pcl::visualization::Camera::computeProjectionMatrix | ( | Eigen::Matrix4d & | proj | ) | const

Computes Projection Matrix for Camera.

Parameters

  [out] | proj | the resultant matrix

References cvtWindowCoordinates().

Referenced by cvtWindowCoordinates().

## computeViewMatrix()

void pcl::visualization::Camera::computeViewMatrix | ( | Eigen::Matrix4d & | view_mat | ) | const

Computes View matrix for Camera (Based on gluLookAt).

Parameters

  [out] | view_mat | the resultant matrix

Referenced by cvtWindowCoordinates().

## cvtWindowCoordinates() [1/2]

template<typename PointT>

void Camera::cvtWindowCoordinates | ( | const PointT & | pt,
|  | Eigen::Vector4d & | window_cord ) const

Converts point to window coordinates.

Parameters

  [in] | pt | xyz point to be converted
  [out] | window_cord | vector containing the pts' window X,Y, Z and 1

Note
  This function computes the projection and view matrix every time. It is very inefficient to use this for every point in the point cloud!

Definition at line 43 of file common.hpp.

References computeProjectionMatrix(), computeViewMatrix(), cvtWindowCoordinates(), and view.

Referenced by computeProjectionMatrix(), and cvtWindowCoordinates().

## cvtWindowCoordinates() [2/2]

template<typename PointT>

void Camera::cvtWindowCoordinates | ( | const PointT & | pt,
|  | Eigen::Vector4d & | window_cord,
|  | const Eigen::Matrix4d & | composite_mat ) const

Converts point to window coordinates.

Parameters

  [in] | pt | xyz point to be converted
  [out] | window_cord | vector containing the pts' window X,Y, Z and 1
  [in] | composite_mat | composite transformation matrix (proj*view)

Note
  Use this function to compute window coordinates with a pre-computed transformation function. The typical composite matrix will be the projection matrix * the view matrix. However, additional matrices like a camera distortion matrix can also be added.

Definition at line 53 of file common.hpp.

References window_size.

## Member Data Documentation

## clip

double pcl::visualization::Camera::clip[2]

Clipping planes depths.

clip[0] is near clipping plane, and clip [1] is the far clipping plane

Definition at line 182 of file common.h.

## focal

double pcl::visualization::Camera::focal[3]

Focal point or lookAt.

Note
  The view direction can be obtained by (focal-pos).normalized ()

Definition at line 170 of file common.h.

## fovy

double pcl::visualization::Camera::fovy

Field of view angle in y direction (radians).

Definition at line 185 of file common.h.

## pos

double pcl::visualization::Camera::pos[3]

Position of the camera.

Definition at line 173 of file common.h.

## view

double pcl::visualization::Camera::view[3]

Up vector of the camera.

Note
  Not to be confused with the view direction, bad naming here.

Definition at line 177 of file common.h.

Referenced by cvtWindowCoordinates().

## window_pos

double pcl::visualization::Camera::window_pos[2]

Definition at line 190 of file common.h.

## window_size

double pcl::visualization::Camera::window_size[2]

Definition at line 189 of file common.h.

Referenced by cvtWindowCoordinates().

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

- pcl/visualization/common/common.h
- pcl/visualization/common/impl/common.hpp