cgv
vr::vr_camera Class Referenceabstract

interface for mono or stereo cameras in VR headsets More...

#include <vr_camera.h>

Public Member Functions

camera inspection and control
uint8_t get_nr_cameras () const
 return number of cameras in the headset (1 for mono and 2 for stereo)
 
virtual bool put_camera_to_head_matrix (int camera_index, float *pose_matrix) const =0
 access to 3x4 matrix in column major format for transformation from camera (0 .. left, 1 .. right) to head coordinates
 
virtual bool put_projection_matrix (int camera_index, bool undistorted, float z_near, float z_far, float *projection_matrix) const =0
 access to 4x4 matrix in column major format for perspective transformation of camera (0..left, 1..right)
 
virtual bool put_camera_intrinsics (int camera_index, bool undistorted, float *focal_length_2d_ptr, float *center_2d_ptr) const =0
 write the focal lengths in x- and y-direction to access to focal_length_2d_ptr[0|1] and the texture center to center_2d_ptr[0|1]
 
bool start ()
 start streaming of frames
 
bool stop ()
 stop streaming of frames
 
CameraState get_state () const
 return the camera state
 
bool has_error () const
 check for error
 
const std::string & get_last_error () const
 return last error, if no error has occured, the function returns an empty string More...
 

Protected Member Functions

 vr_camera ()
 construct camera object
 
bool initialize ()
 initialization is typically called the c
 
virtual ~vr_camera ()=default
 destruct camera
 

Protected Attributes

std::string last_error
 store last error as a string to be as flexible as possible
 

Friends

class vr_kit
 give vr kit access to camera constructor
 
class vr_driver
 give vr driver access to camera initialization and destruction
 

access to frames

uint8_t num_cameras
 
CameraFrameFormat frame_format
 
CameraFrameSplit frame_split
 
bool frame_flipped
 
CameraState state
 
CameraFrameFormat get_frame_format () const
 query pixel format
 
CameraFrameSplit get_frame_split () const
 query stereo frame layout
 
bool is_frame_flipped () const
 query whether frame row order is from top to bottom
 
bool get_frame (std::vector< uint8_t > &frame_data, uint32_t &width, uint32_t &height, bool undistorted, bool maximum_valid_rectangle)
 check for a new frame, return false if not available. Otherwise copy frame to provided buffer that is resized if necessary
 
bool get_gl_texture_id (uint32_t &tex_id, uint32_t &width, uint32_t &height, bool undistorted, float max_valid_texcoord_range[4])
 query id of shared opengl texture id
 

Detailed Description

interface for mono or stereo cameras in VR headsets

Member Function Documentation

◆ get_last_error()

const std::string & vr::vr_camera::get_last_error ( ) const

return last error, if no error has occured, the function returns an empty string

return last error


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