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
03151c96
Commit
03151c96
authored
Nov 07, 2016
by
Patrik Huber
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add to_mat back to RenderingParameters, as its last usage is there
parent
3be8e145
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
2 deletions
+19
-2
include/eos/fitting/RenderingParameters.hpp
include/eos/fitting/RenderingParameters.hpp
+19
-2
No files found.
include/eos/fitting/RenderingParameters.hpp
View file @
03151c96
...
@@ -212,6 +212,23 @@ glm::vec4 get_opencv_viewport(int width, int height)
...
@@ -212,6 +212,23 @@ glm::vec4 get_opencv_viewport(int width, int height)
return
glm
::
vec4
(
0
,
height
,
width
,
-
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
* @brief Creates a 3x4 affine camera matrix from given fitting parameters. The
* matrix transforms points directly from model-space to screen-space.
* matrix transforms points directly from model-space to screen-space.
...
@@ -221,8 +238,8 @@ glm::vec4 get_opencv_viewport(int width, int height)
...
@@ -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
)
cv
::
Mat
get_3x4_affine_camera_matrix
(
fitting
::
RenderingParameters
params
,
int
width
,
int
height
)
{
{
auto
view_model
=
render
::
to_mat
(
params
.
get_modelview
());
auto
view_model
=
to_mat
(
params
.
get_modelview
());
auto
ortho_projection
=
render
::
to_mat
(
params
.
get_projection
());
auto
ortho_projection
=
to_mat
(
params
.
get_projection
());
cv
::
Mat
mvp
=
ortho_projection
*
view_model
;
cv
::
Mat
mvp
=
ortho_projection
*
view_model
;
glm
::
vec4
viewport
(
0
,
height
,
width
,
-
height
);
// flips y, origin top-left, like in OpenCV
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