Commit 3a39a178 authored by Patrik Huber's avatar Patrik Huber

Renamed CameraParameters to RenderingParameters, improved documentation

parent fb556283
...@@ -51,10 +51,12 @@ struct Frustum ...@@ -51,10 +51,12 @@ struct Frustum
* @brief Represents a set of estimated model parameters (rotation, translation) and * @brief Represents a set of estimated model parameters (rotation, translation) and
* camera parameters (viewing frustum). * camera parameters (viewing frustum).
* *
* Strictly speaking, the estimated rotation and translation are not camera parameters, they * The estimated rotation and translation transform the model from model-space to camera-space,
* are the values that transform the model from model-space to camera-space, so they are the * and, if one wishes to use OpenGL, can be used to build the model-view matrix.
* inverse of the camera position. * 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. *
* 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 * Together, these parameters fully describe the imaging process of a given model instance
* (under an orthographic projection). * (under an orthographic projection).
...@@ -62,11 +64,11 @@ struct Frustum ...@@ -62,11 +64,11 @@ struct Frustum
* The rotation values are given in radians and estimated using the RPY convention. * The rotation values are given in radians and estimated using the RPY convention.
* Yaw is applied first to the model, then pitch, then roll (R * P * Y * vertex). * Yaw is applied first to the model, then pitch, then roll (R * P * Y * vertex).
*/ */
struct CameraParameters struct RenderingParameters
{ {
float r_x; // pitch float r_x; // Pitch.
float r_y; // yaw. positive means subject is looking left (we see his/her right cheek). float r_y; // Yaw. Positive means subject is looking left (we see her right cheek).
float r_z; // roll float r_z; // Roll. Positive means the subject's right eye is further down than the other one (he tilts his head to the right).
float t_x; float t_x;
float t_y; float t_y;
Frustum frustum; Frustum frustum;
...@@ -97,7 +99,7 @@ struct CameraParameters ...@@ -97,7 +99,7 @@ struct CameraParameters
* @param[in] height Height of the image (or viewport). * @param[in] height Height of the image (or viewport).
* @return The estimated model and camera parameters. * @return The estimated model and camera parameters.
*/ */
CameraParameters estimate_orthographic_camera(std::vector<cv::Vec2f> image_points, std::vector<cv::Vec4f> model_points, int width, int height) RenderingParameters estimate_orthographic_camera(std::vector<cv::Vec2f> image_points, std::vector<cv::Vec4f> model_points, int width, int height)
{ {
using cv::Mat; using cv::Mat;
assert(image_points.size() == model_points.size()); assert(image_points.size() == model_points.size());
...@@ -121,7 +123,7 @@ CameraParameters estimate_orthographic_camera(std::vector<cv::Vec2f> image_point ...@@ -121,7 +123,7 @@ CameraParameters estimate_orthographic_camera(std::vector<cv::Vec2f> image_point
// 'parameters' contains the solution now. // 'parameters' contains the solution now.
Frustum camera_frustum{ -1.0f * aspect * parameters[5], 1.0f * aspect * parameters[5], -1.0f * parameters[5], 1.0f * parameters[5] }; Frustum camera_frustum{ -1.0f * aspect * parameters[5], 1.0f * aspect * parameters[5], -1.0f * parameters[5], 1.0f * parameters[5] };
return CameraParameters{ static_cast<float>(parameters[0]), static_cast<float>(parameters[1]), static_cast<float>(parameters[2]), static_cast<float>(parameters[3]), static_cast<float>(parameters[4]), camera_frustum }; return RenderingParameters{ static_cast<float>(parameters[0]), static_cast<float>(parameters[1]), static_cast<float>(parameters[2]), static_cast<float>(parameters[3]), static_cast<float>(parameters[4]), camera_frustum };
}; };
} /* namespace fitting */ } /* namespace fitting */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment