Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
8c4b8cc0
Commit
8c4b8cc0
authored
Aug 09, 2014
by
edgarriba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed warnings
parent
3f5d3b2d
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
20 additions
and
16 deletions
+20
-16
PnPProblem.cpp
...code/calib3d/real_time_pose_estimation/src/PnPProblem.cpp
+8
-2
PnPProblem.h
...l_code/calib3d/real_time_pose_estimation/src/PnPProblem.h
+5
-0
RobustMatcher.cpp
...e/calib3d/real_time_pose_estimation/src/RobustMatcher.cpp
+3
-3
Utils.cpp
...rial_code/calib3d/real_time_pose_estimation/src/Utils.cpp
+1
-6
main_detection.cpp
.../calib3d/real_time_pose_estimation/src/main_detection.cpp
+0
-0
main_registration.cpp
...lib3d/real_time_pose_estimation/src/main_registration.cpp
+3
-5
No files found.
samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src/PnPProblem.cpp
View file @
8c4b8cc0
...
...
@@ -13,9 +13,15 @@
#include <opencv2/calib3d/calib3d.hpp>
/* Functions headers */
cv
::
Point3f
CROSS
(
cv
::
Point3f
v1
,
cv
::
Point3f
v2
);
double
DOT
(
cv
::
Point3f
v1
,
cv
::
Point3f
v2
);
cv
::
Point3f
SUB
(
cv
::
Point3f
v1
,
cv
::
Point3f
v2
);
cv
::
Point3f
get_nearest_3D_point
(
std
::
vector
<
cv
::
Point3f
>
&
points_list
,
cv
::
Point3f
origin
);
/* Functions for Möller–Trumbore intersection algorithm */
/* Functions for Möller–Trumbore intersection algorithm
* */
cv
::
Point3f
CROSS
(
cv
::
Point3f
v1
,
cv
::
Point3f
v2
)
{
cv
::
Point3f
tmp_p
;
...
...
samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src/PnPProblem.h
View file @
8c4b8cc0
...
...
@@ -50,4 +50,9 @@ private:
cv
::
Mat
_P_matrix
;
};
// Functions for Möller–Trumbore intersection algorithm
cv
::
Point3f
CROSS
(
cv
::
Point3f
v1
,
cv
::
Point3f
v2
);
double
DOT
(
cv
::
Point3f
v1
,
cv
::
Point3f
v2
);
cv
::
Point3f
SUB
(
cv
::
Point3f
v1
,
cv
::
Point3f
v2
);
#endif
/* PNPPROBLEM_H_ */
samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src/RobustMatcher.cpp
View file @
8c4b8cc0
...
...
@@ -113,9 +113,9 @@ void RobustMatcher::robustMatch( const cv::Mat& frame, std::vector<cv::DMatch>&
// 3. Remove matches for which NN ratio is > than threshold
// clean image 1 -> image 2 matches
int
removed1
=
ratioTest
(
matches12
);
ratioTest
(
matches12
);
// clean image 2 -> image 1 matches
int
removed2
=
ratioTest
(
matches21
);
ratioTest
(
matches21
);
// 4. Remove non-symmetrical matches
symmetryTest
(
matches12
,
matches21
,
good_matches
);
...
...
@@ -140,7 +140,7 @@ void RobustMatcher::fastRobustMatch( const cv::Mat& frame, std::vector<cv::DMatc
matcher_
->
knnMatch
(
descriptors_frame
,
descriptors_model
,
matches
,
2
);
// 3. Remove matches for which NN ratio is > than threshold
int
removed
=
ratioTest
(
matches
);
ratioTest
(
matches
);
// 4. Fill good matches container
for
(
std
::
vector
<
std
::
vector
<
cv
::
DMatch
>
>::
iterator
...
...
samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src/Utils.cpp
View file @
8c4b8cc0
...
...
@@ -114,7 +114,7 @@ void drawArrow(cv::Mat image, cv::Point2i p, cv::Point2i q, cv::Scalar color, in
{
//Draw the principle line
cv
::
line
(
image
,
p
,
q
,
color
,
thickness
,
line_type
,
shift
);
const
double
PI
=
3.141592653
;
const
double
PI
=
CV_PI
;
//compute the angle alpha
double
angle
=
atan2
((
double
)
p
.
y
-
q
.
y
,
(
double
)
p
.
x
-
q
.
x
);
//compute the coordinates of the first segment
...
...
@@ -137,9 +137,6 @@ void draw3DCoordinateAxes(cv::Mat image, const std::vector<cv::Point2f> &list_po
cv
::
Scalar
blue
(
255
,
0
,
0
);
cv
::
Scalar
black
(
0
,
0
,
0
);
const
double
PI
=
3.141592653
;
int
length
=
50
;
cv
::
Point2i
origin
=
list_points2d
[
0
];
cv
::
Point2i
pointX
=
list_points2d
[
1
];
cv
::
Point2i
pointY
=
list_points2d
[
2
];
...
...
@@ -196,13 +193,11 @@ cv::Mat rot2euler(const cv::Mat & rotationMatrix)
cv
::
Mat
euler
(
3
,
1
,
CV_64F
);
double
m00
=
rotationMatrix
.
at
<
double
>
(
0
,
0
);
double
m01
=
rotationMatrix
.
at
<
double
>
(
0
,
1
);
double
m02
=
rotationMatrix
.
at
<
double
>
(
0
,
2
);
double
m10
=
rotationMatrix
.
at
<
double
>
(
1
,
0
);
double
m11
=
rotationMatrix
.
at
<
double
>
(
1
,
1
);
double
m12
=
rotationMatrix
.
at
<
double
>
(
1
,
2
);
double
m20
=
rotationMatrix
.
at
<
double
>
(
2
,
0
);
double
m21
=
rotationMatrix
.
at
<
double
>
(
2
,
1
);
double
m22
=
rotationMatrix
.
at
<
double
>
(
2
,
2
);
double
x
,
y
,
z
;
...
...
samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src/main_detection.cpp
View file @
8c4b8cc0
This diff is collapsed.
Click to expand it.
samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src/main_registration.cpp
View file @
8c4b8cc0
...
...
@@ -17,16 +17,14 @@
* Set up the images paths
*/
std
::
string
tutorial_path
=
"../../samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/"
;
// COOKIES BOX [718x480]
std
::
string
img_path
=
tutorial_path
+
"
Data/resized_IMG_3875.JPG"
;
// f 55
std
::
string
img_path
=
"../
Data/resized_IMG_3875.JPG"
;
// f 55
// COOKIES BOX MESH
std
::
string
ply_read_path
=
tutorial_path
+
"
Data/box.ply"
;
std
::
string
ply_read_path
=
"../
Data/box.ply"
;
// YAML writting path
std
::
string
write_path
=
tutorial_path
+
"
Data/cookies_ORB.yml"
;
std
::
string
write_path
=
"../
Data/cookies_ORB.yml"
;
void
help
()
{
...
...
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