Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
eos
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Richard Torenvliet
eos
Commits
03151c96
Commit
03151c96
authored
8 years ago
by
Patrik Huber
Browse files
Options
Downloads
Patches
Plain Diff
Add to_mat back to RenderingParameters, as its last usage is there
parent
3be8e145
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
include/eos/fitting/RenderingParameters.hpp
+19
-2
19 additions, 2 deletions
include/eos/fitting/RenderingParameters.hpp
with
19 additions
and
2 deletions
include/eos/fitting/RenderingParameters.hpp
+
19
−
2
View file @
03151c96
...
...
@@ -212,6 +212,23 @@ glm::vec4 get_opencv_viewport(int width, int height)
return
glm
::
vec4
(
0
,
height
,
width
,
-
height
);
};
/**
* @brief Converts a glm::mat4x4 to a cv::Mat.
*
* Note: I think the last use of this function is below in
* get_3x4_affine_camera_matrix().
*/
cv
::
Mat
to_mat
(
const
glm
::
mat4x4
&
glm_matrix
)
{
// glm stores its matrices in col-major order in memory, OpenCV in row-major order.
// Hence we transpose the glm matrix to flip the memory layout, and then point OpenCV
// to that location.
auto
glm_matrix_t
=
glm
::
transpose
(
glm_matrix
);
cv
::
Mat
opencv_mat
(
4
,
4
,
CV_32FC1
,
&
glm_matrix_t
[
0
]);
// we need to clone because the underlying data of the original goes out of scope
return
opencv_mat
.
clone
();
};
/**
* @brief Creates a 3x4 affine camera matrix from given fitting parameters. The
* matrix transforms points directly from model-space to screen-space.
...
...
@@ -221,8 +238,8 @@ 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
(
params
.
get_projection
());
auto
view_model
=
to_mat
(
params
.
get_modelview
());
auto
ortho_projection
=
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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment