MVE - Multi-View Environment mve-devel
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
mve::CameraInfo Struct Reference

Per-view camera information with various helper functions. More...

#include <camera.h>

Public Member Functions

 CameraInfo (void)
 Creates a new camera and invalidates it (sets 'flen' to 0.0f).
 
void debug_print (void) const
 Prints debug information to stdout.
 
void fill_calibration (float *mat, float width, float height) const
 Stores the 3x3 calibration (or projection) matrix (K-matrix in Hartley, Zisserman).
 
void fill_cam_to_world (float *mat) const
 Stores camera to world 4x4 matrix in array pointed to by mat.
 
void fill_cam_to_world_rot (float *mat) const
 Stores the camera to world 3x3 rotation matrix in mat.
 
void fill_camera_pos (float *pos) const
 Stores camera position 3-vector into array pointed to by pos.
 
void fill_camera_translation (float *trans) const
 Stores the camera translation 3-vector into array pointed to by pos.
 
void fill_gl_projection (float *mat, float width, float height, float znear, float zfar) const
 Stores OpenGl projection 4x4 matrix in array pointed to by mat.
 
void fill_gl_viewtrans (float *mat) const
 Stores OpenGl view transformation 4x4 matrix in array pointed to by mat.
 
void fill_inverse_calibration (float *mat, float width, float height) const
 Stores 3x3 inverse calibration (or inverse projection) matrix.
 
void fill_reprojection (CameraInfo const &destination, float src_width, float src_height, float dst_width, float dst_height, float *mat, float *vec) const
 Stores the reprojection operator (mat, vec) from pixel coordinates in this source view to the given destination view.
 
void fill_viewing_direction (float *viewdir) const
 Stores the (normalized) viewing direction in world coordinates into the array pointed to by 'viewdir'.
 
void fill_world_to_cam (float *mat) const
 Stores world to camera 4x4 matrix in array pointed to by mat.
 
void fill_world_to_cam_rot (float *mat) const
 Stores the world to camera 3x3 rotation matrix in mat.
 
std::string get_rotation_string (void) const
 Retuns the rotation in string format.
 
std::string get_translation_string (void) const
 Retuns the translation in string format.
 
void set_rotation_from_string (std::string const &rot_string)
 Sets the rotation from string.
 
void set_transformation (float const *mat)
 Initializes 'rot' and 'trans' members using the 4x4 matrix 'mat'.
 
void set_translation_from_string (std::string const &trans_string)
 Sets the translation from string.
 

Public Attributes

float dist [2]
 Image distortion parameters.
 
float flen
 Focal length.
 
float paspect
 Pixel aspect ratio pixel_width / pixel_height.
 
float ppoint [2]
 Principal point in x- and y-direction.
 
float rot [9]
 Camera rotation which transforms from world to cam.
 
float trans [3]
 Camera translation vector.
 

Detailed Description

Per-view camera information with various helper functions.

An invalid camera is indicated with focal length set to 0.0f.

Definition at line 23 of file camera.h.

Constructor & Destructor Documentation

◆ CameraInfo()

mve::CameraInfo::CameraInfo ( void  )

Creates a new camera and invalidates it (sets 'flen' to 0.0f).

Definition at line 20 of file camera.cc.

Member Function Documentation

◆ debug_print()

void mve::CameraInfo::debug_print ( void  ) const

Prints debug information to stdout.

Definition at line 265 of file camera.cc.

◆ fill_calibration()

void mve::CameraInfo::fill_calibration ( float *  mat,
float  width,
float  height 
) const

Stores the 3x3 calibration (or projection) matrix (K-matrix in Hartley, Zisserman).

The matrix projects a point in camera coordinates to the image plane with dimensions 'width' and 'height'. The convention is that the camera looks along the positive z-axis. To obtain the pixel coordinates after projection, 0.5 must be subtracted from the coordinates.

If the dimensions of the image are unknown, the generic projection matrix with w=1 and h=1 can be used. Image coordinates x' and y' for image size w and h are then computed as follows:

For w > h: x' = x * w and y' = y * w - (w - h) / 2. For h > w: x' = x * h - (h - w) / 2 and y' = y * h.

Definition at line 125 of file camera.cc.

◆ fill_cam_to_world()

void mve::CameraInfo::fill_cam_to_world ( float *  mat) const

Stores camera to world 4x4 matrix in array pointed to by mat.

Definition at line 83 of file camera.cc.

◆ fill_cam_to_world_rot()

void mve::CameraInfo::fill_cam_to_world_rot ( float *  mat) const

Stores the camera to world 3x3 rotation matrix in mat.

This is identical to the transposed rotation stored in the camera.

Definition at line 105 of file camera.cc.

◆ fill_camera_pos()

void mve::CameraInfo::fill_camera_pos ( float *  pos) const

Stores camera position 3-vector into array pointed to by pos.

This can be thought of as the camera to world translation. The position is calculated with: -R^T * t.

Definition at line 34 of file camera.cc.

◆ fill_camera_translation()

void mve::CameraInfo::fill_camera_translation ( float *  trans) const

Stores the camera translation 3-vector into array pointed to by pos.

This can be thought of as the world to camera translation. This is identical to the translation stored in the camera.

Definition at line 44 of file camera.cc.

◆ fill_gl_projection()

void mve::CameraInfo::fill_gl_projection ( float *  mat,
float  width,
float  height,
float  znear,
float  zfar 
) const

Stores OpenGl projection 4x4 matrix in array pointed to by mat.

Definition at line 149 of file camera.cc.

◆ fill_gl_viewtrans()

void mve::CameraInfo::fill_gl_viewtrans ( float *  mat) const

Stores OpenGl view transformation 4x4 matrix in array pointed to by mat.

Definition at line 72 of file camera.cc.

◆ fill_inverse_calibration()

void mve::CameraInfo::fill_inverse_calibration ( float *  mat,
float  width,
float  height 
) const

Stores 3x3 inverse calibration (or inverse projection) matrix.

The matrix projects a point (x, y, 1) from the image plane into the camera coordinate system. Note that 0.5 must be added to the pixel coordinates x and y before projection.

Definition at line 180 of file camera.cc.

◆ fill_reprojection()

void mve::CameraInfo::fill_reprojection ( CameraInfo const &  destination,
float  src_width,
float  src_height,
float  dst_width,
float  dst_height,
float *  mat,
float *  vec 
) const

Stores the reprojection operator (mat, vec) from pixel coordinates in this source view to the given destination view.

The reprojection of a pixel coordinate 'xs' in a source view with respect to depth 'd' to coordinate 'xd' in a destination view is given by:

xd = Kd ( Rd Rs^-1 ( Ks^-1 * xs * d - ts ) + td )

which gives rise to the reprojection operator (T,t) with

xd = T * xs * d + t

Here, (T,t) is returned (mat, vec). Note that the depth in these formulas represents the distance along the z-axis in the camera frame, NOT the distance from the camera center.

Definition at line 205 of file camera.cc.

◆ fill_viewing_direction()

void mve::CameraInfo::fill_viewing_direction ( float *  viewdir) const

Stores the (normalized) viewing direction in world coordinates into the array pointed to by 'viewdir'.

Definition at line 52 of file camera.cc.

◆ fill_world_to_cam()

void mve::CameraInfo::fill_world_to_cam ( float *  mat) const

Stores world to camera 4x4 matrix in array pointed to by mat.

Definition at line 61 of file camera.cc.

◆ fill_world_to_cam_rot()

void mve::CameraInfo::fill_world_to_cam_rot ( float *  mat) const

Stores the world to camera 3x3 rotation matrix in mat.

This is identical to the rotation stored in the camera.

Definition at line 97 of file camera.cc.

◆ get_rotation_string()

std::string mve::CameraInfo::get_rotation_string ( void  ) const

Retuns the rotation in string format.

Definition at line 227 of file camera.cc.

◆ get_translation_string()

std::string mve::CameraInfo::get_translation_string ( void  ) const

Retuns the translation in string format.

Definition at line 237 of file camera.cc.

◆ set_rotation_from_string()

void mve::CameraInfo::set_rotation_from_string ( std::string const &  rot_string)

Sets the rotation from string.

Definition at line 255 of file camera.cc.

◆ set_transformation()

void mve::CameraInfo::set_transformation ( float const *  mat)

Initializes 'rot' and 'trans' members using the 4x4 matrix 'mat'.

Definition at line 115 of file camera.cc.

◆ set_translation_from_string()

void mve::CameraInfo::set_translation_from_string ( std::string const &  trans_string)

Sets the translation from string.

Definition at line 247 of file camera.cc.

Member Data Documentation

◆ dist

float mve::CameraInfo::dist[2]

Image distortion parameters.

Definition at line 162 of file camera.h.

◆ flen

float mve::CameraInfo::flen

Focal length.

Definition at line 156 of file camera.h.

◆ paspect

float mve::CameraInfo::paspect

Pixel aspect ratio pixel_width / pixel_height.

Definition at line 160 of file camera.h.

◆ ppoint

float mve::CameraInfo::ppoint[2]

Principal point in x- and y-direction.

Definition at line 158 of file camera.h.

◆ rot

float mve::CameraInfo::rot[9]

Camera rotation which transforms from world to cam.

Definition at line 169 of file camera.h.

◆ trans

float mve::CameraInfo::trans[3]

Camera translation vector.

Camera position p = -ROT^T * trans.

Definition at line 167 of file camera.h.


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