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
2653d745
Commit
2653d745
authored
Aug 18, 2014
by
edgarriba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated sanity data
parent
6ea73a5b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
99 additions
and
4 deletions
+99
-4
perf_pnp.cpp
modules/calib3d/perf/perf_pnp.cpp
+1
-1
dls.cpp
modules/calib3d/src/dls.cpp
+15
-3
dls.h
modules/calib3d/src/dls.h
+83
-0
No files found.
modules/calib3d/perf/perf_pnp.cpp
View file @
2653d745
...
...
@@ -19,7 +19,7 @@ typedef perf::TestBaseWithParam<int> PointsNum;
PERF_TEST_P
(
PointsNum_Algo
,
solvePnP
,
testing
::
Combine
(
testing
::
Values
(
/*4,*/
3
*
9
,
7
*
13
),
//TODO: find why results on 4 points are too unstable
testing
::
Values
(
4
,
3
*
9
,
7
*
13
),
//TODO: find why results on 4 points are too unstable
testing
::
Values
((
int
)
SOLVEPNP_ITERATIVE
,
(
int
)
SOLVEPNP_EPNP
)
)
)
...
...
modules/calib3d/src/dls.cpp
View file @
2653d745
...
...
@@ -221,6 +221,12 @@ void dls::build_coeff_matrix(const cv::Mat& pp, cv::Mat& Mtilde, cv::Mat& D)
cv
::
Mat
H
=
cv
::
Mat
::
zeros
(
3
,
3
,
CV_64F
);
cv
::
Mat
A
=
cv
::
Mat
::
zeros
(
3
,
9
,
CV_64F
);
cv
::
Mat
pp_i
(
3
,
1
,
CV_64F
);
//Parallel_compute_A comp_A(&A, &pp, &z);
//cv::parallel_for_(cv::Range(0, N), comp_A);
//exit(-1);
cv
::
Mat
z_i
(
3
,
1
,
CV_64F
);
for
(
int
i
=
0
;
i
<
N
;
++
i
)
...
...
@@ -235,6 +241,9 @@ void dls::build_coeff_matrix(const cv::Mat& pp, cv::Mat& Mtilde, cv::Mat& D)
cv
::
solve
(
H
,
A
,
A
,
cv
::
DECOMP_NORMAL
);
H
.
release
();
//Parallel_compute_D comp_D(&D, &A, &pp, &z);
//cv::parallel_for_(cv::Range(0, N), comp_D);
cv
::
Mat
ppi_A
(
3
,
1
,
CV_64F
);
for
(
int
i
=
0
;
i
<
N
;
++
i
)
{
...
...
@@ -393,9 +402,6 @@ void dls::fill_coeff(const cv::Mat * D_mat)
cv
::
Mat
dls
::
LeftMultVec
(
const
cv
::
Mat
&
v
)
{
//cv::Mat mat, row1, row2, row3;
//cv::Mat zeros16 = cv::Mat::zeros(1, 6, CV_64F);
//cv::Mat zeros13 = cv::Mat::zeros(1, 3, CV_64F);
cv
::
Mat
mat_
=
cv
::
Mat
::
zeros
(
3
,
9
,
CV_64F
);
for
(
int
i
=
0
;
i
<
3
;
++
i
)
...
...
@@ -404,6 +410,12 @@ cv::Mat dls::LeftMultVec(const cv::Mat& v)
mat_
.
at
<
double
>
(
i
,
3
*
i
+
1
)
=
v
.
at
<
double
>
(
1
);
mat_
.
at
<
double
>
(
i
,
3
*
i
+
2
)
=
v
.
at
<
double
>
(
2
);
}
/*for (int i = 0; i < 3; ++i)
{
mat_.data[mat_.step[0]*i + mat_.step[1]* 3*i + 0] = v.at<double>(0);
mat_.data[mat_.step[0]*i + mat_.step[1]* 3*i + 1] = v.at<double>(1);
mat_.data[mat_.step[0]*i + mat_.step[1]* 3*i + 2] = v.at<double>(2);
}*/
return
mat_
;
}
...
...
modules/calib3d/src/dls.h
View file @
2653d745
...
...
@@ -3,6 +3,8 @@
#include "precomp.hpp"
#include <iostream>
using
namespace
std
;
using
namespace
cv
;
...
...
@@ -77,6 +79,87 @@ private:
double
cost__
;
// optimal found solution
};
class
Parallel_compute_A
:
public
cv
::
ParallelLoopBody
{
private
:
cv
::
Mat
eye
,
*
A
;
const
cv
::
Mat
*
pp
,
*
z
;
public
:
Parallel_compute_A
(
cv
::
Mat
*
_A
,
const
cv
::
Mat
*
_pp
,
const
cv
::
Mat
*
_z
)
:
A
(
_A
),
pp
(
_pp
),
z
(
_z
)
{
eye
=
cv
::
Mat
::
eye
(
3
,
3
,
CV_64F
);
}
cv
::
Mat
leftMultVec
(
const
cv
::
Mat
&
v
)
const
{
cv
::
Mat
mat_
(
3
,
9
,
CV_64F
,
0
.
0
);
for
(
int
i
=
0
;
i
<
3
;
++
i
)
{
mat_
.
at
<
double
>
(
i
,
3
*
i
+
0
)
=
v
.
at
<
double
>
(
0
);
mat_
.
at
<
double
>
(
i
,
3
*
i
+
1
)
=
v
.
at
<
double
>
(
1
);
mat_
.
at
<
double
>
(
i
,
3
*
i
+
2
)
=
v
.
at
<
double
>
(
2
);
}
return
mat_
;
}
virtual
void
operator
()(
const
cv
::
Range
&
r
)
const
{
for
(
int
i
=
r
.
start
;
i
!=
r
.
end
;
++
i
)
{
cv
::
Mat
z_i
(
3
,
1
,
CV_64F
);
cv
::
Mat
pp_i
(
3
,
1
,
CV_64F
);
int
index
=
i
;
z
->
col
(
index
).
copyTo
(
z_i
);
pp
->
col
(
index
).
copyTo
(
pp_i
);
*
A
+=
(
z_i
*
z_i
.
t
()
-
eye
)
*
leftMultVec
(
pp_i
);
}
}
};
class
Parallel_compute_D
:
public
cv
::
ParallelLoopBody
{
private
:
cv
::
Mat
eye
,
*
D
;
const
cv
::
Mat
*
pp
,
*
z
,
*
A
;
public
:
Parallel_compute_D
(
cv
::
Mat
*
_D
,
const
cv
::
Mat
*
_A
,
const
cv
::
Mat
*
_pp
,
const
cv
::
Mat
*
_z
)
:
D
(
_D
),
A
(
_A
),
pp
(
_pp
),
z
(
_z
)
{
eye
=
cv
::
Mat
::
eye
(
3
,
3
,
CV_64F
);
}
cv
::
Mat
leftMultVec
(
const
cv
::
Mat
&
v
)
const
{
cv
::
Mat
mat_
(
3
,
9
,
CV_64F
,
0
.
0
);
for
(
int
i
=
0
;
i
<
3
;
++
i
)
{
mat_
.
at
<
double
>
(
i
,
3
*
i
+
0
)
=
v
.
at
<
double
>
(
0
);
mat_
.
at
<
double
>
(
i
,
3
*
i
+
1
)
=
v
.
at
<
double
>
(
1
);
mat_
.
at
<
double
>
(
i
,
3
*
i
+
2
)
=
v
.
at
<
double
>
(
2
);
}
return
mat_
;
}
virtual
void
operator
()(
const
cv
::
Range
&
r
)
const
{
for
(
int
i
=
r
.
start
;
i
!=
r
.
end
;
++
i
)
{
cv
::
Mat
z_i
(
3
,
1
,
CV_64F
);
cv
::
Mat
pp_i
(
3
,
1
,
CV_64F
);
cv
::
Mat
ppi_A
(
3
,
9
,
CV_64F
);
int
index
=
i
;
z
->
col
(
index
).
copyTo
(
z_i
);
pp
->
col
(
index
).
copyTo
(
pp_i
);
cv
::
Mat
(
leftMultVec
(
pp_i
)
+
*
A
).
copyTo
(
ppi_A
);
*
D
+=
ppi_A
.
t
()
*
(
eye
-
z_i
*
z_i
.
t
()
)
*
ppi_A
;
}
}
};
class
EigenvalueDecomposition
{
private
:
...
...
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