cgv
Loading...
Searching...
No Matches
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
 

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

Definition at line 38 of file vr_camera.h.

Constructor & Destructor Documentation

◆ vr_camera()

vr::vr_camera::vr_camera ( )
protected

construct camera object

Definition at line 8 of file vr_camera.cxx.

Member Function Documentation

◆ get_frame()

bool vr::vr_camera::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

Definition at line 60 of file vr_camera.cxx.

References last_error.

Referenced by vr_test::init_frame().

◆ get_frame_format()

CameraFrameFormat vr::vr_camera::get_frame_format ( ) const

query pixel format

Definition at line 84 of file vr_camera.cxx.

◆ get_frame_split()

CameraFrameSplit vr::vr_camera::get_frame_split ( ) const

query stereo frame layout

Definition at line 89 of file vr_camera.cxx.

Referenced by vr::configure_seethrough_shader_program(), and vr_test::init_frame().

◆ get_gl_texture_id()

bool vr::vr_camera::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

Definition at line 72 of file vr_camera.cxx.

References last_error.

Referenced by vr_test::init_frame().

◆ 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

Definition at line 13 of file vr_camera.cxx.

References last_error.

Referenced by vr_test::init_frame().

◆ get_nr_cameras()

uint8_t vr::vr_camera::get_nr_cameras ( ) const

return number of cameras in the headset (1 for mono and 2 for stereo)

Definition at line 99 of file vr_camera.cxx.

Referenced by vr::configure_seethrough_shader_program().

◆ get_state()

CameraState vr::vr_camera::get_state ( ) const

return the camera state

Definition at line 94 of file vr_camera.cxx.

Referenced by vr_test::init_frame().

◆ has_error()

bool vr::vr_camera::has_error ( ) const
inline

check for error

Definition at line 71 of file vr_camera.h.

Referenced by vr_test::init_frame().

◆ initialize()

bool vr::vr_camera::initialize ( )
protected

initialization is typically called the c

Definition at line 18 of file vr_camera.cxx.

References last_error.

Referenced by vr::vr_driver::register_vr_kit().

◆ is_frame_flipped()

bool vr::vr_camera::is_frame_flipped ( ) const

query whether frame row order is from top to bottom

Definition at line 104 of file vr_camera.cxx.

◆ start()

bool vr::vr_camera::start ( )

start streaming of frames

Definition at line 31 of file vr_camera.cxx.

References last_error.

◆ stop()

bool vr::vr_camera::stop ( )

stop streaming of frames

Definition at line 47 of file vr_camera.cxx.

References last_error.

Referenced by vr::vr_kit::~vr_kit().

Friends And Related Symbol Documentation

◆ vr_driver

friend class vr_driver
friend

give vr driver access to camera initialization and destruction

Definition at line 46 of file vr_camera.h.

◆ vr_kit

friend class vr_kit
friend

give vr kit access to camera constructor

Definition at line 42 of file vr_camera.h.

Member Data Documentation

◆ frame_flipped

bool vr::vr_camera::frame_flipped
protected

Definition at line 93 of file vr_camera.h.

◆ frame_format

CameraFrameFormat vr::vr_camera::frame_format
protected

Definition at line 91 of file vr_camera.h.

◆ frame_split

CameraFrameSplit vr::vr_camera::frame_split
protected

Definition at line 92 of file vr_camera.h.

◆ last_error

std::string vr::vr_camera::last_error
mutableprotected

store last error as a string to be as flexible as possible

Definition at line 52 of file vr_camera.h.

Referenced by get_frame(), get_gl_texture_id(), get_last_error(), initialize(), start(), and stop().

◆ num_cameras

uint8_t vr::vr_camera::num_cameras
protected

Definition at line 90 of file vr_camera.h.

◆ state

CameraState vr::vr_camera::state
protected

Definition at line 94 of file vr_camera.h.


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