eos 1.4.0
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
eos::fitting::RenderingParameters Class Reference

Represents a set of estimated model parameters (rotation, translation) and camera parameters (viewing frustum). More...

#include <RenderingParameters.hpp>

Public Member Functions

 RenderingParameters (CameraType camera_type, Frustum camera_frustum, float r_x, float r_y, float r_z, float tx, float ty, int screen_width, int screen_height)
 Create a RenderingParameters object from the parameters of estimate_orthographic_camera().
 
 RenderingParameters (ScaledOrthoProjectionParameters ortho_params, int screen_width, int screen_height)
 
 RenderingParameters (Eigen::Quaternionf rotation, Eigen::Vector3f translation, float fov_y, int image_width, int image_height)
 
auto get_camera_type () const
 
Eigen::Quaternionf get_rotation () const
 
void set_rotation (Eigen::Quaternionf rotation_quaternion)
 
Eigen::Vector3f get_yaw_pitch_roll ()
 Returns the intrinsic rotation angles, also called Tait-Bryan angles, in degrees. The returned Vector3f contains [yaw, pitch, roll].
 
void set_translation (float t_x, float t_y, cpp17::optional< float > t_z=cpp17::nullopt)
 
Eigen::Vector3f get_translation () const
 
cpp17::optional< float > get_fov_y () const
 
Eigen::Matrix4f get_modelview () const
 Construct a model-view matrix from the RenderingParameters' rotation and translation, and return it.
 
Eigen::Matrix4f get_projection () const
 Construct an orthographic or perspective projection matrix from the RenderingParameters' frustum (orthographic) or fov_y and aspect ration (perspective), and return it.
 
Frustum get_frustum () const
 
void set_frustum (Frustum frustum)
 
int get_screen_width () const
 
void set_screen_width (int screen_width)
 
int get_screen_height () const
 
void set_screen_height (int screen_height)
 

Friends

class cereal::access
 

Detailed Description

Represents a set of estimated model parameters (rotation, translation) and camera parameters (viewing frustum).

The estimated rotation and translation transform the model from model-space to camera-space, and, if one wishes to use OpenGL, can be used to build the model-view matrix, i.e. the parameter representation is OpenGL compliant.

The parameters are the inverse of the camera position in 3D space.

The camera frustum describes the size of the viewing plane of the camera, and can be used to build an OpenGL-conformant orthographic projection matrix.

Together, these parameters fully describe the imaging process of a given model instance.

The rotation is represented using a quaternion. However, the quaternion can be converted to a rotation matrix, and subsequently Euler angles can be extracted. In our coordinate system, the x axis points to the right, y points upwards, and z into/out of the screen. When extracting Euler angles (or Tait-Bryan angles, to be more precise), we assume rotation around the y axis first (yaw), then around x axis (pitch), then around z (roll).

Constructor & Destructor Documentation

◆ RenderingParameters()

eos::fitting::RenderingParameters::RenderingParameters ( CameraType  camera_type,
Frustum  camera_frustum,
float  r_x,
float  r_y,
float  r_z,
float  tx,
float  ty,
int  screen_width,
int  screen_height 
)
inline

Create a RenderingParameters object from the parameters of estimate_orthographic_camera().

estimate_orthographic_camera() uses Eigen::LevenbergMarquardt to estimate pose, using Euler angles. Here, we create a quaternion from these Euler angles, using the same convention / order as they're used during that optimisation, i.e. P_2d = R * P * Y * P_3d. This creates the correct rotation quaternion in the case the angles were estimated/given by R*P*Y*v. The angles should be given in radians.

(Old note, which may be obsolete now - to be checked: If you subsequently use RP::get_rotation() and glm::eulerAngles() on it, the angles you get out will be slightly different from the ones you put in here. But they will describe the same rotation! Just in a different order. (i.e. the rotation matrix or quaternion for both of these two sets of angles is identical.))

Member Function Documentation

◆ get_yaw_pitch_roll()

Eigen::Vector3f eos::fitting::RenderingParameters::get_yaw_pitch_roll ( )
inline

Returns the intrinsic rotation angles, also called Tait-Bryan angles, in degrees. The returned Vector3f contains [yaw, pitch, roll].

The order of rotations is yaw, pitch, roll (in our coordinate system, y, x, z).

  • Positive pitch means the head is looking down
  • Positive yaw means the head is looking to the left (from the subject's perspective, i.e. we see their right cheek)
  • Positive roll means the head's right eye is further down than the other one (the head is tilted to the right, from the subject's perspective).

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