Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gnss
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
mobile_robotics
wolf_projects
wolf_lib
plugins
gnss
Commits
782f686e
Commit
782f686e
authored
7 years ago
by
Angel Santamaria-Navarro
Browse files
Options
Downloads
Patches
Plain Diff
test_projection_points now using vision_utils
parent
39c9ab8a
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/CMakeLists.txt
+1
-1
1 addition, 1 deletion
src/CMakeLists.txt
src/examples/test_projection_points.cpp
+27
-41
27 additions, 41 deletions
src/examples/test_projection_points.cpp
with
28 additions
and
42 deletions
src/CMakeLists.txt
+
1
−
1
View file @
782f686e
...
@@ -59,7 +59,7 @@ ENDIF(raw_gps_utils_FOUND)
...
@@ -59,7 +59,7 @@ ENDIF(raw_gps_utils_FOUND)
FIND_PACKAGE
(
vision_utils QUIET
)
FIND_PACKAGE
(
vision_utils QUIET
)
IF
(
vision_utils_FOUND
)
IF
(
vision_utils_FOUND
)
MESSAGE
(
"vision_utils Library FOUND: vision related sources will be built."
)
MESSAGE
(
"vision_utils Library FOUND: vision related sources will be built."
)
SET
(
PRINT_INFO_VU false
)
# REMOVE OpenCV
# REMOVE OpenCV
FIND_PACKAGE
(
OpenCV QUIET
)
FIND_PACKAGE
(
OpenCV QUIET
)
...
...
This diff is collapsed.
Click to expand it.
src/examples/test_projection_points.cpp
+
27
−
41
View file @
782f686e
// Vision utils
// Vision utils
#include
<vision_utils.h>
#include
<vision_utils.h>
// REMOVE
//#include "opencv2/calib3d/calib3d.hpp"
//#include "opencv2/features2d/features2d.hpp"
//#include <opencv2/core/core.hpp>
//#include <opencv2/highgui/highgui.hpp>
//std includes
//std includes
#include
<iostream>
#include
<iostream>
...
@@ -13,48 +8,39 @@
...
@@ -13,48 +8,39 @@
//wolf includes
//wolf includes
#include
"pinholeTools.h"
#include
"pinholeTools.h"
int
main
(
int
argc
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
{
using
namespace
wolf
;
using
namespace
wolf
;
std
::
cout
<<
std
::
endl
<<
" ========= ProjectPoints test ==========="
<<
std
::
endl
<<
std
::
endl
;
std
::
cout
<<
std
::
endl
<<
" ========= ProjectPoints test ==========="
<<
std
::
endl
<<
std
::
endl
;
cv
::
Point3f
points3D
;
Eigen
::
MatrixXf
points3D
(
2
,
3
);
points3D
.
x
=
2.0
;
Eigen
::
Vector3f
point3D
;
points3D
.
y
=
5.0
;
point3D
[
0
]
=
2.0
;
points3D
.
z
=
6.0
;
point3D
[
1
]
=
5.0
;
std
::
vector
<
cv
::
Point3f
>
point_in_3D
;
point3D
[
2
]
=
6.0
;
point_in_3D
.
push_back
(
points3D
);
points3D
.
row
(
0
)
=
point3D
;
points3D
.
x
=
4.0
;
point3D
[
0
]
=
4.0
;
points3D
.
y
=
2.0
;
point3D
[
1
]
=
2.0
;
points3D
.
z
=
1.0
;
point3D
[
2
]
=
1.0
;
point_in_3D
.
push_back
(
points3D
);
points3D
.
row
(
1
)
=
point3D
;
std
::
vector
<
float
>
rot_mat
=
{
0
,
0
,
0
};
Eigen
::
Vector3f
cam_ext_rot_mat
=
Eigen
::
Vector3f
::
Zero
();
std
::
vector
<
float
>
trans_mat
=
{
1
,
1
,
1
};
Eigen
::
Vector3f
cam_ext_trans_mat
=
Eigen
::
Vector3f
::
Ones
();
cv
::
Mat
cam_mat
(
3
,
3
,
CV_32F
);
Eigen
::
Matrix3f
cam_intr_mat
;
cam_mat
.
row
(
0
).
col
(
0
).
setTo
(
1
);
cam_intr_mat
=
Eigen
::
Matrix3f
::
Identity
();
cam_mat
.
row
(
0
).
col
(
1
).
setTo
(
0
);
cam_intr_mat
(
0
,
2
)
=
2
;
cam_mat
.
row
(
0
).
col
(
2
).
setTo
(
2
);
cam_intr_mat
(
1
,
2
)
=
2
;
cam_mat
.
row
(
1
).
col
(
0
).
setTo
(
0
);
cam_mat
.
row
(
1
).
col
(
1
).
setTo
(
1
);
Eigen
::
VectorXf
dist_coef
(
5
);
cam_mat
.
row
(
1
).
col
(
2
).
setTo
(
2
);
dist_coef
<<
0
,
0
,
0
,
0
,
0
;
cam_mat
.
row
(
2
).
col
(
0
).
setTo
(
0
);
cam_mat
.
row
(
2
).
col
(
1
).
setTo
(
0
);
Eigen
::
MatrixXf
points2D
=
vision_utils
::
projectPoints
(
points3D
,
cam_ext_rot_mat
,
cam_ext_trans_mat
,
cam_intr_mat
,
dist_coef
);
cam_mat
.
row
(
2
).
col
(
2
).
setTo
(
1
);
for
(
int
ii
=
0
;
ii
<
points3D
.
rows
();
++
ii
)
std
::
cout
<<
"cam_mat[1,2]: "
<<
cam_mat
.
row
(
1
).
col
(
0
)
<<
std
::
endl
;
std
::
cout
<<
"points2D- X: "
<<
points2D
(
ii
,
0
)
<<
"; Y: "
<<
points2D
(
ii
,
1
)
<<
std
::
endl
;
std
::
vector
<
float
>
dist_coef
=
{
0
,
0
,
0
,
0
,
0
};
std
::
vector
<
cv
::
Point2f
>
points2D
;
cv
::
projectPoints
(
point_in_3D
,
rot_mat
,
trans_mat
,
cam_mat
,
dist_coef
,
points2D
);
for
(
auto
it
:
points2D
)
{
std
::
cout
<<
"points2D- X: "
<<
it
.
x
<<
"; Y: "
<<
it
.
y
<<
std
::
endl
;
}
std
::
cout
<<
std
::
endl
<<
" ========= PinholeTools DUALITY TEST ==========="
<<
std
::
endl
<<
std
::
endl
;
std
::
cout
<<
std
::
endl
<<
" ========= PinholeTools DUALITY TEST ==========="
<<
std
::
endl
<<
std
::
endl
;
...
...
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