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
8b6c5ade
Commit
8b6c5ade
authored
Feb 13, 2014
by
Alexander Alekhin
Committed by
Andrey Pavlenko
Apr 11, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TAPI: added perf test for stitching
parent
6bfbcf02
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
169 additions
and
0 deletions
+169
-0
perf_stitch.cpp
modules/stitching/perf/opencl/perf_stitch.cpp
+144
-0
ocl_test.hpp
modules/ts/include/opencv2/ts/ocl_test.hpp
+25
-0
No files found.
modules/stitching/perf/opencl/perf_stitch.cpp
0 → 100644
View file @
8b6c5ade
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
//
// Copyright (C) 2014, Itseez, Inc, all rights reserved.
#include "perf_precomp.hpp"
#include "opencv2/ts/ocl_perf.hpp"
using
namespace
cv
;
using
namespace
perf
;
using
namespace
cvtest
::
ocl
;
using
namespace
std
;
using
namespace
std
::
tr1
;
#define SURF_MATCH_CONFIDENCE 0.65f
#define ORB_MATCH_CONFIDENCE 0.3f
#define WORK_MEGAPIX 0.6
typedef
TestBaseWithParam
<
string
>
stitch
;
#ifdef HAVE_OPENCV_NONFREE_TODO_FIND_WHY_SURF_IS_NOT_ABLE_TO_STITCH_PANOS
#define TEST_DETECTORS testing::Values("surf", "orb")
#else
#define TEST_DETECTORS testing::Values<string>("orb")
#endif
OCL_PERF_TEST_P
(
stitch
,
a123
,
TEST_DETECTORS
)
{
UMat
pano
;
vector
<
Mat
>
_imgs
;
_imgs
.
push_back
(
imread
(
getDataPath
(
"stitching/a1.png"
)
)
);
_imgs
.
push_back
(
imread
(
getDataPath
(
"stitching/a2.png"
)
)
);
_imgs
.
push_back
(
imread
(
getDataPath
(
"stitching/a3.png"
)
)
);
vector
<
UMat
>
imgs
=
ToUMat
(
_imgs
);
Ptr
<
detail
::
FeaturesFinder
>
featuresFinder
=
GetParam
()
==
"orb"
?
Ptr
<
detail
::
FeaturesFinder
>
(
new
detail
::
OrbFeaturesFinder
())
:
Ptr
<
detail
::
FeaturesFinder
>
(
new
detail
::
SurfFeaturesFinder
());
Ptr
<
detail
::
FeaturesMatcher
>
featuresMatcher
=
GetParam
()
==
"orb"
?
makePtr
<
detail
::
BestOf2NearestMatcher
>
(
false
,
ORB_MATCH_CONFIDENCE
)
:
makePtr
<
detail
::
BestOf2NearestMatcher
>
(
false
,
SURF_MATCH_CONFIDENCE
);
declare
.
iterations
(
20
);
while
(
next
())
{
Stitcher
stitcher
=
Stitcher
::
createDefault
();
stitcher
.
setFeaturesFinder
(
featuresFinder
);
stitcher
.
setFeaturesMatcher
(
featuresMatcher
);
stitcher
.
setWarper
(
makePtr
<
SphericalWarper
>
());
stitcher
.
setRegistrationResol
(
WORK_MEGAPIX
);
startTimer
();
stitcher
.
stitch
(
imgs
,
pano
);
stopTimer
();
}
EXPECT_NEAR
(
pano
.
size
().
width
,
1182
,
50
);
EXPECT_NEAR
(
pano
.
size
().
height
,
682
,
30
);
SANITY_CHECK_NOTHING
();
}
OCL_PERF_TEST_P
(
stitch
,
b12
,
TEST_DETECTORS
)
{
UMat
pano
;
vector
<
Mat
>
imgs
;
imgs
.
push_back
(
imread
(
getDataPath
(
"stitching/b1.png"
)
)
);
imgs
.
push_back
(
imread
(
getDataPath
(
"stitching/b2.png"
)
)
);
Ptr
<
detail
::
FeaturesFinder
>
featuresFinder
=
GetParam
()
==
"orb"
?
Ptr
<
detail
::
FeaturesFinder
>
(
new
detail
::
OrbFeaturesFinder
())
:
Ptr
<
detail
::
FeaturesFinder
>
(
new
detail
::
SurfFeaturesFinder
());
Ptr
<
detail
::
FeaturesMatcher
>
featuresMatcher
=
GetParam
()
==
"orb"
?
makePtr
<
detail
::
BestOf2NearestMatcher
>
(
false
,
ORB_MATCH_CONFIDENCE
)
:
makePtr
<
detail
::
BestOf2NearestMatcher
>
(
false
,
SURF_MATCH_CONFIDENCE
);
declare
.
iterations
(
20
);
while
(
next
())
{
Stitcher
stitcher
=
Stitcher
::
createDefault
();
stitcher
.
setFeaturesFinder
(
featuresFinder
);
stitcher
.
setFeaturesMatcher
(
featuresMatcher
);
stitcher
.
setWarper
(
makePtr
<
SphericalWarper
>
());
stitcher
.
setRegistrationResol
(
WORK_MEGAPIX
);
startTimer
();
stitcher
.
stitch
(
imgs
,
pano
);
stopTimer
();
}
EXPECT_NEAR
(
pano
.
size
().
width
,
1124
,
50
);
EXPECT_NEAR
(
pano
.
size
().
height
,
644
,
30
);
SANITY_CHECK_NOTHING
();
}
OCL_PERF_TEST_P
(
stitch
,
boat
,
TEST_DETECTORS
)
{
UMat
pano
;
vector
<
Mat
>
_imgs
;
_imgs
.
push_back
(
imread
(
getDataPath
(
"stitching/boat1.jpg"
)
)
);
_imgs
.
push_back
(
imread
(
getDataPath
(
"stitching/boat2.jpg"
)
)
);
_imgs
.
push_back
(
imread
(
getDataPath
(
"stitching/boat3.jpg"
)
)
);
_imgs
.
push_back
(
imread
(
getDataPath
(
"stitching/boat4.jpg"
)
)
);
_imgs
.
push_back
(
imread
(
getDataPath
(
"stitching/boat5.jpg"
)
)
);
_imgs
.
push_back
(
imread
(
getDataPath
(
"stitching/boat6.jpg"
)
)
);
vector
<
UMat
>
imgs
=
ToUMat
(
_imgs
);
Ptr
<
detail
::
FeaturesFinder
>
featuresFinder
=
GetParam
()
==
"orb"
?
Ptr
<
detail
::
FeaturesFinder
>
(
new
detail
::
OrbFeaturesFinder
())
:
Ptr
<
detail
::
FeaturesFinder
>
(
new
detail
::
SurfFeaturesFinder
());
Ptr
<
detail
::
FeaturesMatcher
>
featuresMatcher
=
GetParam
()
==
"orb"
?
makePtr
<
detail
::
BestOf2NearestMatcher
>
(
false
,
ORB_MATCH_CONFIDENCE
)
:
makePtr
<
detail
::
BestOf2NearestMatcher
>
(
false
,
SURF_MATCH_CONFIDENCE
);
declare
.
iterations
(
20
);
while
(
next
())
{
Stitcher
stitcher
=
Stitcher
::
createDefault
();
stitcher
.
setFeaturesFinder
(
featuresFinder
);
stitcher
.
setFeaturesMatcher
(
featuresMatcher
);
stitcher
.
setWarper
(
makePtr
<
SphericalWarper
>
());
stitcher
.
setRegistrationResol
(
WORK_MEGAPIX
);
startTimer
();
stitcher
.
stitch
(
imgs
,
pano
);
stopTimer
();
}
EXPECT_NEAR
(
pano
.
size
().
width
,
10789
,
200
);
EXPECT_NEAR
(
pano
.
size
().
height
,
2663
,
100
);
SANITY_CHECK_NOTHING
();
}
modules/ts/include/opencv2/ts/ocl_test.hpp
View file @
8b6c5ade
...
...
@@ -57,6 +57,31 @@ namespace ocl {
using
namespace
cv
;
using
namespace
testing
;
inline
std
::
vector
<
UMat
>
ToUMat
(
const
std
::
vector
<
Mat
>&
src
)
{
std
::
vector
<
UMat
>
dst
;
dst
.
resize
(
src
.
size
());
for
(
size_t
i
=
0
;
i
<
src
.
size
();
++
i
)
{
src
[
i
].
copyTo
(
dst
[
i
]);
}
return
dst
;
}
inline
UMat
ToUMat
(
const
Mat
&
src
)
{
UMat
dst
;
src
.
copyTo
(
dst
);
return
dst
;
}
inline
UMat
ToUMat
(
InputArray
src
)
{
UMat
dst
;
src
.
getMat
().
copyTo
(
dst
);
return
dst
;
}
extern
int
test_loop_times
;
#define MAX_VALUE 357
...
...
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