Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
eos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Richard Torenvliet
eos
Commits
f40904f0
Commit
f40904f0
authored
Nov 07, 2016
by
Patrik Huber
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made RenderingParameters members private, updated doc
parent
c6f37932
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
8 deletions
+12
-8
include/eos/fitting/RenderingParameters.hpp
include/eos/fitting/RenderingParameters.hpp
+12
-8
No files found.
include/eos/fitting/RenderingParameters.hpp
View file @
f40904f0
...
...
@@ -95,11 +95,19 @@ enum class CameraType
*
* 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).
* In general, the convention is as follows:
* r_x = Pitch
* r_y = Yaw. Positive means subject is looking left (we see her right cheek).
* r_z = Roll. Positive means the subject's right eye is further down than the other one (he tilts his head to the right).
* However, we're using a quaternion now to represent the rotation, and glm::eulerAngles() will give
* slightly different angles (according to a different (undocumented)) convention. However, the
* rotation is exactly the same! (i.e. they are represented by the same quaternion / rotation matrix).
*
* This should always represent all parameters necessary to render the model to an image, and be completely OpenGL compliant.
*/
struct
RenderingParameters
class
RenderingParameters
{
public:
// Creates with default frustum...
RenderingParameters
()
{};
...
...
@@ -134,7 +142,6 @@ struct RenderingParameters
};
glm
::
mat4x4
get_modelview
()
const
{
// rot from quat, add transl., return 4x4.
glm
::
mat4x4
modelview
=
glm
::
mat4_cast
(
rotation
);
modelview
[
3
][
0
]
=
t_x
;
modelview
[
3
][
1
]
=
t_y
;
...
...
@@ -151,13 +158,10 @@ struct RenderingParameters
}
};
private:
CameraType
camera_type
=
CameraType
::
Orthographic
;
Frustum
frustum
;
// Can construct a glm::ortho or glm::perspective matrix from this.
// Todo: Get rid of the Euler angles and just use the quaternion.
//float r_x; // Pitch.
//float r_y; // Yaw. Positive means subject is looking left (we see her right cheek).
//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).
glm
::
quat
rotation
;
float
t_x
;
...
...
@@ -218,7 +222,7 @@ glm::vec4 get_opencv_viewport(int width, int height)
cv
::
Mat
get_3x4_affine_camera_matrix
(
fitting
::
RenderingParameters
params
,
int
width
,
int
height
)
{
auto
view_model
=
render
::
to_mat
(
params
.
get_modelview
());
auto
ortho_projection
=
render
::
to_mat
(
glm
::
ortho
(
params
.
frustum
.
l
,
params
.
frustum
.
r
,
params
.
frustum
.
b
,
params
.
frustum
.
t
));
auto
ortho_projection
=
render
::
to_mat
(
params
.
get_projection
(
));
cv
::
Mat
mvp
=
ortho_projection
*
view_model
;
glm
::
vec4
viewport
(
0
,
height
,
width
,
-
height
);
// flips y, origin top-left, like in OpenCV
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment