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
3e2a57ff
Commit
3e2a57ff
authored
Aug 01, 2014
by
edgarriba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update for non Eigen users
parent
56704b5e
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
16 deletions
+9
-16
dls.cpp
modules/calib3d/src/dls.cpp
+8
-9
dls.h
modules/calib3d/src/dls.h
+0
-0
solvepnp.cpp
modules/calib3d/src/solvepnp.cpp
+1
-7
No files found.
modules/calib3d/src/dls.cpp
View file @
3e2a57ff
...
...
@@ -12,15 +12,12 @@
# include "opencv2/core/eigen.hpp"
#endif
//#include <Eigen/Eigenvalues>
//#include <Eigen/Core>
using
namespace
std
;
dls
::
dls
(
const
cv
::
Mat
&
opoints
,
const
cv
::
Mat
&
ipoints
)
{
N
=
std
::
max
(
opoints
.
checkVector
(
3
,
CV_32F
),
opoints
.
checkVector
(
3
,
CV_64F
));
p
=
cv
::
Mat
(
3
,
N
,
CV_64F
);
z
=
cv
::
Mat
(
3
,
N
,
CV_64F
);
...
...
@@ -136,8 +133,6 @@ void dls::run_kernel(const cv::Mat& pp)
int
count
=
0
;
for
(
int
k
=
0
;
k
<
27
;
++
k
)
{
// TODO: solve implementation for complex numbers
// V(:,k) = V(:,k)/V(1,k);
cv
::
Mat
V_kA
=
eigenvec_r
.
col
(
k
);
// 27x1
cv
::
Mat
V_kB
=
cv
::
Mat
(
1
,
1
,
z
.
depth
(),
V_kA
.
at
<
double
>
(
0
));
// 1x1
...
...
@@ -145,9 +140,11 @@ void dls::run_kernel(const cv::Mat& pp)
cv
::
Mat
(
V_k
.
t
()).
copyTo
(
eigenvec_r
.
col
(
k
)
);
//if (imag(V(2,k)) == 0)
#ifdef HAVE_EIGEN
const
double
epsilon
=
1e-4
;
if
(
eigenval_i
.
at
<
double
>
(
k
,
0
)
>=
-
epsilon
&&
eigenval_i
.
at
<
double
>
(
k
,
0
)
<=
epsilon
)
{
// it should work without checking imaginari part
#endif
{
double
stmp
[
3
];
stmp
[
0
]
=
eigenvec_r
.
at
<
double
>
(
9
,
k
);
...
...
@@ -282,8 +279,6 @@ void dls::build_coeff_matrix(const cv::Mat& pp, cv::Mat& Mtilde, cv::Mat& D)
void
dls
::
compute_eigenvec
(
const
cv
::
Mat
&
Mtilde
,
cv
::
Mat
&
eigenval_real
,
cv
::
Mat
&
eigenval_imag
,
cv
::
Mat
&
eigenvec_real
,
cv
::
Mat
&
eigenvec_imag
)
{
// EIGENVALUES AND EIGENVECTORS
#ifdef HAVE_EIGEN
Eigen
::
MatrixXd
Mtilde_eig
,
zeros_eig
;
cv
::
cv2eigen
(
Mtilde
,
Mtilde_eig
);
...
...
@@ -305,6 +300,10 @@ void dls::compute_eigenvec(const cv::Mat& Mtilde, cv::Mat& eigenval_real, cv::Ma
cv
::
eigen2cv
(
eigval_imag
,
eigenval_imag
);
cv
::
eigen2cv
(
eigvec_real
,
eigenvec_real
);
cv
::
eigen2cv
(
eigvec_imag
,
eigenvec_imag
);
#else
EigenvalueDecomposition
es
(
Mtilde
);
eigenval_real
=
es
.
eigenvalues
();
eigenvec_real
=
es
.
eigenvectors
();
#endif
}
...
...
modules/calib3d/src/dls.h
View file @
3e2a57ff
This diff is collapsed.
Click to expand it.
modules/calib3d/src/solvepnp.cpp
View file @
3e2a57ff
...
...
@@ -96,21 +96,15 @@ bool cv::solvePnP( InputArray _opoints, InputArray _ipoints,
}
else
if
(
flags
==
DLS
)
{
bool
result
=
false
;
#ifdef HAVE_EIGEN
cv
::
Mat
undistortedPoints
;
cv
::
undistortPoints
(
ipoints
,
undistortedPoints
,
cameraMatrix
,
distCoeffs
);
dls
PnP
(
opoints
,
undistortedPoints
);
cv
::
Mat
R
,
rvec
=
_rvec
.
getMat
(),
tvec
=
_tvec
.
getMat
();
result
=
PnP
.
compute_pose
(
R
,
tvec
);
bool
result
=
PnP
.
compute_pose
(
R
,
tvec
);
if
(
result
)
cv
::
Rodrigues
(
R
,
rvec
);
#else
std
::
cout
<<
"EIGEN library needed for DLS"
<<
std
::
endl
;
#endif
return
result
;
}
else
...
...
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