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
7b0be9cf
Commit
7b0be9cf
authored
Aug 05, 2014
by
edgarriba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update code
parent
0d2bc9b0
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
57 additions
and
77 deletions
+57
-77
real_time_pose.rst
doc/tutorials/calib3d/real_time_pose/real_time_pose.rst
+1
-1
dls.cpp
modules/calib3d/src/dls.cpp
+1
-9
CMakeLists.txt
...ial_code/calib3d/real_time_pose_estimation/CMakeLists.txt
+4
-4
CsvReader.cpp
..._code/calib3d/real_time_pose_estimation/src/CsvReader.cpp
+51
-53
Model.cpp
...rial_code/calib3d/real_time_pose_estimation/src/Model.cpp
+0
-2
ModelRegistration.cpp
...lib3d/real_time_pose_estimation/src/ModelRegistration.cpp
+0
-3
PnPProblem.cpp
...code/calib3d/real_time_pose_estimation/src/PnPProblem.cpp
+0
-3
Utils.cpp
...rial_code/calib3d/real_time_pose_estimation/src/Utils.cpp
+0
-1
test_pnp.cpp
...l_code/calib3d/real_time_pose_estimation/src/test_pnp.cpp
+0
-1
No files found.
doc/tutorials/calib3d/real_time_pose/real_time_pose.rst
View file @
7b0be9cf
...
...
@@ -341,7 +341,7 @@ The following parameters work for this application:
.. code-block:: cpp
// RANSAC parameters
int iterationsCount = 500; // number of Ransac iterations.
float reprojectionError = 2.0; // maximum allowed distance to consider it an inlier.
float confidence = 0.95; // ransac successful confidence.
...
...
modules/calib3d/src/dls.cpp
View file @
7b0be9cf
...
...
@@ -417,7 +417,7 @@ cv::Mat dls::cayley_LS_M(const std::vector<double>& a, const std::vector<double>
{
// TODO: input matrix pointer
// TODO: shift coefficients one position to left
cv
::
Mat
M
=
cv
::
Mat
::
zeros
(
120
,
120
,
CV_64F
);
M
.
at
<
double
>
(
0
,
0
)
=
u
[
1
];
M
.
at
<
double
>
(
0
,
35
)
=
a
[
1
];
M
.
at
<
double
>
(
0
,
83
)
=
b
[
1
];
M
.
at
<
double
>
(
0
,
118
)
=
c
[
1
];
...
...
@@ -662,11 +662,3 @@ bool dls::positive_eigenvalues(const cv::Mat * eigenvalues)
cv
::
MatConstIterator_
<
double
>
it
=
eigenvalues
->
begin
<
double
>
();
return
*
(
it
)
>
0
&&
*
(
it
+
1
)
>
0
&&
*
(
it
+
2
)
>
0
;
}
samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/CMakeLists.txt
View file @
7b0be9cf
...
...
@@ -8,8 +8,8 @@ ADD_DEFINITIONS(
find_package
(
OpenCV REQUIRED
)
include_directories
(
${
OpenCV_INCLUDE_DIRS
}
include_directories
(
${
OpenCV_INCLUDE_DIRS
}
)
add_executable
(
...
...
@@ -39,9 +39,9 @@ pnp_verification
)
add_executable
(
pnp_detection
pnp_detection
src/main_detection.cpp
src/CsvReader.cpp
src/CsvReader.cpp
src/CsvWriter.cpp
src/ModelRegistration.cpp
src/Mesh.cpp
...
...
samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src/CsvReader.cpp
View file @
7b0be9cf
#include <string>
#include "CsvReader.h"
/** The default constructor of the CSV reader Class */
CsvReader
::
CsvReader
(
const
std
::
string
&
path
,
const
char
&
separator
){
_file
.
open
(
path
.
c_str
(),
ifstream
::
in
);
_separator
=
separator
;
_file
.
open
(
path
.
c_str
(),
ifstream
::
in
);
_separator
=
separator
;
}
/* Read a plane text file with .ply format */
void
CsvReader
::
readPLY
(
std
::
vector
<
cv
::
Point3f
>
&
list_vertex
,
std
::
vector
<
std
::
vector
<
int
>
>
&
list_triangles
)
{
std
::
string
line
,
tmp_str
,
n
;
int
num_vertex
,
num_triangles
;
int
count
=
0
;
bool
end_header
=
false
;
bool
end_vertex
=
false
;
std
::
string
line
,
tmp_str
,
n
;
int
num_vertex
,
num_triangles
;
int
count
=
0
;
bool
end_header
=
false
;
bool
end_vertex
=
false
;
// Read the whole *.ply file
while
(
getline
(
_file
,
line
))
{
// Read the whole *.ply file
while
(
getline
(
_file
,
line
))
{
stringstream
liness
(
line
);
// read header
if
(
!
end_header
)
{
getline
(
liness
,
tmp_str
,
_separator
);
if
(
tmp_str
==
"element"
)
{
getline
(
liness
,
tmp_str
,
_separator
);
getline
(
liness
,
n
);
if
(
tmp_str
==
"vertex"
)
num_vertex
=
std
::
stoi
(
n
);
if
(
tmp_str
==
"face"
)
num_triangles
=
std
::
stoi
(
n
);
}
if
(
tmp_str
==
"end_header"
)
end_header
=
true
;
getline
(
liness
,
tmp_str
,
_separator
);
if
(
tmp_str
==
"element"
)
{
getline
(
liness
,
tmp_str
,
_separator
);
getline
(
liness
,
n
);
if
(
tmp_str
==
"vertex"
)
num_vertex
=
StringToNumber
(
n
);
if
(
tmp_str
==
"face"
)
num_triangles
=
StringToNumber
(
n
);
}
if
(
tmp_str
==
"end_header"
)
end_header
=
true
;
}
// read file content
else
if
(
end_header
)
{
// read vertex and add into 'list_vertex'
if
(
!
end_vertex
&&
count
<
num_vertex
)
{
string
x
,
y
,
z
;
getline
(
liness
,
x
,
_separator
);
getline
(
liness
,
y
,
_separator
);
getline
(
liness
,
z
);
// read vertex and add into 'list_vertex'
if
(
!
end_vertex
&&
count
<
num_vertex
)
{
string
x
,
y
,
z
;
getline
(
liness
,
x
,
_separator
);
getline
(
liness
,
y
,
_separator
);
getline
(
liness
,
z
);
cv
::
Point3f
tmp_p
;
tmp_p
.
x
=
std
::
stof
(
x
);
tmp_p
.
y
=
std
::
stof
(
y
);
tmp_p
.
z
=
std
::
stof
(
z
);
list_vertex
.
push_back
(
tmp_p
);
cv
::
Point3f
tmp_p
;
tmp_p
.
x
=
StringToNumber
(
x
);
tmp_p
.
y
=
StringToNumber
(
y
);
tmp_p
.
z
=
StringToNumber
(
z
);
list_vertex
.
push_back
(
tmp_p
);
count
++
;
if
(
count
==
num_vertex
)
{
count
=
0
;
end_vertex
=
!
end_vertex
;
}
}
// read faces and add into 'list_triangles'
else
if
(
end_vertex
&&
count
<
num_triangles
)
{
std
::
string
num_pts_per_face
,
id0
,
id1
,
id2
;
getline
(
liness
,
num_pts_per_face
,
_separator
);
getline
(
liness
,
id0
,
_separator
);
getline
(
liness
,
id1
,
_separator
);
getline
(
liness
,
id2
);
count
++
;
if
(
count
==
num_vertex
)
{
count
=
0
;
end_vertex
=
!
end_vertex
;
}
}
// read faces and add into 'list_triangles'
else
if
(
end_vertex
&&
count
<
num_triangles
)
{
std
::
string
num_pts_per_face
,
id0
,
id1
,
id2
;
getline
(
liness
,
num_pts_per_face
,
_separator
);
getline
(
liness
,
id0
,
_separator
);
getline
(
liness
,
id1
,
_separator
);
getline
(
liness
,
id2
);
std
::
vector
<
int
>
tmp_triangle
(
3
);
tmp_triangle
[
0
]
=
std
::
stoi
(
id0
);
tmp_triangle
[
1
]
=
std
::
stoi
(
id1
);
tmp_triangle
[
2
]
=
std
::
stoi
(
id2
);
list_triangles
.
push_back
(
tmp_triangle
);
std
::
vector
<
int
>
tmp_triangle
(
3
);
tmp_triangle
[
0
]
=
StringToNumber
(
id0
);
tmp_triangle
[
1
]
=
StringToNumber
(
id1
);
tmp_triangle
[
2
]
=
StringToNumber
(
id2
);
list_triangles
.
push_back
(
tmp_triangle
);
count
++
;
count
++
;
}
}
}
}
samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src/Model.cpp
View file @
7b0be9cf
...
...
@@ -71,5 +71,3 @@ void Model::load(const std::string path)
storage
.
release
();
}
samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src/ModelRegistration.cpp
View file @
7b0be9cf
...
...
@@ -33,6 +33,3 @@ void ModelRegistration::reset()
list_points2d_
.
clear
();
list_points3d_
.
clear
();
}
samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src/PnPProblem.cpp
View file @
7b0be9cf
...
...
@@ -310,6 +310,3 @@ bool PnPProblem::intersect_MollerTrumbore(Ray &Ray, Triangle &Triangle, double *
// No hit, no win
return
false
;
}
samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src/Utils.cpp
View file @
7b0be9cf
...
...
@@ -273,4 +273,3 @@ cv::Mat euler2rot(const cv::Mat & euler)
return
rotationMatrix
;
}
samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src/test_pnp.cpp
View file @
7b0be9cf
...
...
@@ -141,4 +141,3 @@ int main(int argc, char *argv[])
data2file
(
"computation_time.txt"
,
comp_time
);
}
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