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
60e33921
Commit
60e33921
authored
Mar 01, 2011
by
Alexey Spizhevoy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added performance sample for solvePnpRansac + refactoring
parent
4ec5fb43
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
5 deletions
+52
-5
calib3d.cpp
modules/gpu/src/calib3d.cpp
+1
-0
test_calib3d.cpp
modules/gpu/test/test_calib3d.cpp
+1
-1
performance.h
samples/gpu/performance/performance.h
+1
-1
tests.cpp
samples/gpu/performance/tests.cpp
+49
-3
No files found.
modules/gpu/src/calib3d.cpp
View file @
60e33921
...
...
@@ -243,6 +243,7 @@ void cv::gpu::solvePnpRansac(const Mat& object, const Mat& image, const Mat& cam
CV_Assert
(
!
params
.
use_extrinsic_guess
);
// We don't support initial guess for now
const
int
num_points
=
object
.
cols
;
CV_Assert
(
num_points
>=
params
.
subset_size
);
// Unapply distortion and intrinsic camera transformations
Mat
eye_camera_mat
=
Mat
::
eye
(
3
,
3
,
CV_32F
);
...
...
modules/gpu/test/test_calib3d.cpp
View file @
60e33921
...
...
@@ -113,7 +113,7 @@ TEST(solvePnpRansac, accuracy)
const
int
num_points
=
5000
;
Mat
object
=
randomMat
(
rng
,
Size
(
num_points
,
1
),
CV_32FC3
,
0
,
100
,
false
);
Mat
camera_mat
=
randomMat
(
rng
,
Size
(
3
,
3
),
CV_32F
,
1
,
1
,
false
);
Mat
camera_mat
=
randomMat
(
rng
,
Size
(
3
,
3
),
CV_32F
,
0.5
,
1
,
false
);
camera_mat
.
at
<
float
>
(
0
,
1
)
=
0.
f
;
camera_mat
.
at
<
float
>
(
1
,
0
)
=
0.
f
;
camera_mat
.
at
<
float
>
(
2
,
0
)
=
0.
f
;
...
...
samples/gpu/performance/performance.h
View file @
60e33921
...
...
@@ -100,7 +100,7 @@ private:
};
#define INIT(name) \
#define
GLOBAL_
INIT(name) \
struct
name
##
_init
:
Runnable
{
\
name
##
_init
()
:
Runnable
(
#
name
)
{
\
TestSystem
::
instance
().
addInit
(
this
);
\
...
...
samples/gpu/performance/tests.cpp
View file @
60e33921
...
...
@@ -8,19 +8,19 @@
using
namespace
std
;
using
namespace
cv
;
INIT
(
matchTemplate
)
void
InitMatchTemplate
(
)
{
Mat
src
;
gen
(
src
,
500
,
500
,
CV_32F
,
0
,
1
);
Mat
templ
;
gen
(
templ
,
500
,
500
,
CV_32F
,
0
,
1
);
gpu
::
GpuMat
d_src
(
src
),
d_templ
(
templ
),
d_dst
;
gpu
::
matchTemplate
(
d_src
,
d_templ
,
d_dst
,
CV_TM_CCORR
);
}
TEST
(
matchTemplate
)
{
InitMatchTemplate
();
Mat
src
,
templ
,
dst
;
gen
(
src
,
3000
,
3000
,
CV_32F
,
0
,
1
);
...
...
@@ -780,3 +780,48 @@ TEST(projectPoints)
GPU_OFF
;
}
}
void
InitSolvePnpRansac
()
{
Mat
object
;
gen
(
object
,
1
,
4
,
CV_32FC3
,
Scalar
::
all
(
0
),
Scalar
::
all
(
100
));
Mat
image
;
gen
(
image
,
1
,
4
,
CV_32FC2
,
Scalar
::
all
(
0
),
Scalar
::
all
(
100
));
Mat
rvec
,
tvec
;
gpu
::
solvePnpRansac
(
object
,
image
,
Mat
::
eye
(
3
,
3
,
CV_32F
),
Mat
(),
rvec
,
tvec
,
gpu
::
SolvePnpRansacParams
());
}
// It's not very correct test as solvePnP and solvePnpRansac use different algorithms internally
// TODO add proper test after CPU solvePnpRansac being added
TEST
(
solvePnpRansac
)
{
InitSolvePnpRansac
();
int
num_points
=
1000000
;
Mat
object
;
gen
(
object
,
1
,
num_points
,
CV_32FC3
,
Scalar
::
all
(
0
),
Scalar
::
all
(
100
));
Mat
camera_mat
;
gen
(
camera_mat
,
3
,
3
,
CV_32F
,
0.5
,
1
);
camera_mat
.
at
<
float
>
(
0
,
1
)
=
0.
f
;
camera_mat
.
at
<
float
>
(
1
,
0
)
=
0.
f
;
camera_mat
.
at
<
float
>
(
2
,
0
)
=
0.
f
;
camera_mat
.
at
<
float
>
(
2
,
1
)
=
0.
f
;
Mat
rvec_gold
;
gen
(
rvec_gold
,
1
,
3
,
CV_32F
,
0
,
1
);
Mat
tvec_gold
;
gen
(
tvec_gold
,
1
,
3
,
CV_32F
,
0
,
1
);
vector
<
Point2f
>
image_vec
;
projectPoints
(
object
,
rvec_gold
,
tvec_gold
,
camera_mat
,
Mat
(),
image_vec
);
Mat
image
(
1
,
image_vec
.
size
(),
CV_32FC2
,
&
image_vec
[
0
]);
Mat
rvec
,
tvec
;
CPU_ON
;
solvePnP
(
object
,
image
,
camera_mat
,
Mat
(),
rvec
,
tvec
);
CPU_OFF
;
GPU_ON
;
gpu
::
SolvePnpRansacParams
params
;
gpu
::
solvePnpRansac
(
object
,
image
,
camera_mat
,
Mat
(),
rvec
,
tvec
,
params
);
GPU_OFF
;
}
\ No newline at end of file
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