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
e37b9469
Commit
e37b9469
authored
Aug 10, 2012
by
Daniil Osokin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added perf tests
parent
c3ae08a1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
134 additions
and
134 deletions
+134
-134
perf_cvt_color.cpp
modules/imgproc/perf/perf_cvt_color.cpp
+0
-0
perf_warp.cpp
modules/imgproc/perf/perf_warp.cpp
+0
-0
perf_stich.cpp
modules/stitching/perf/perf_stich.cpp
+134
-134
ts_perf.cpp
modules/ts/src/ts_perf.cpp
+0
-0
No files found.
modules/imgproc/perf/perf_cvt_color.cpp
View file @
e37b9469
This diff is collapsed.
Click to expand it.
modules/imgproc/perf/perf_warp.cpp
View file @
e37b9469
This diff is collapsed.
Click to expand it.
modules/stitching/perf/perf_stich.cpp
View file @
e37b9469
#include "perf_precomp.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/core/internal.hpp"
#include "opencv2/flann/flann.hpp"
#include "opencv2/opencv_modules.hpp"
using
namespace
std
;
using
namespace
cv
;
using
namespace
perf
;
using
std
::
tr1
::
make_tuple
;
using
std
::
tr1
::
get
;
#define SURF_MATCH_CONFIDENCE 0.65f
#define ORB_MATCH_CONFIDENCE 0.3f
#define WORK_MEGAPIX 0.6
typedef
TestBaseWithParam
<
String
>
stitch
;
typedef
TestBaseWithParam
<
String
>
match
;
#ifdef HAVE_OPENCV_NONFREE
#define TEST_DETECTORS testing::Values("surf", "orb")
#else
#define TEST_DETECTORS testing::Values<String>("orb")
#endif
PERF_TEST_P
(
stitch
,
a123
,
TEST_DETECTORS
)
{
Mat
pano
;
vector
<
Mat
>
imgs
;
imgs
.
push_back
(
imread
(
getDataPath
(
"stitching/a1.jpg"
)
)
);
imgs
.
push_back
(
imread
(
getDataPath
(
"stitching/a2.jpg"
)
)
);
imgs
.
push_back
(
imread
(
getDataPath
(
"stitching/a3.jpg"
)
)
);
Ptr
<
detail
::
FeaturesFinder
>
featuresFinder
=
GetParam
()
==
"orb"
?
(
detail
::
FeaturesFinder
*
)
new
detail
::
OrbFeaturesFinder
()
:
(
detail
::
FeaturesFinder
*
)
new
detail
::
SurfFeaturesFinder
();
Ptr
<
detail
::
FeaturesMatcher
>
featuresMatcher
=
GetParam
()
==
"orb"
?
new
detail
::
BestOf2NearestMatcher
(
false
,
ORB_MATCH_CONFIDENCE
)
:
new
detail
::
BestOf2NearestMatcher
(
false
,
SURF_MATCH_CONFIDENCE
);
declare
.
time
(
30
*
20
).
iterations
(
20
);
while
(
next
())
{
Stitcher
stitcher
=
Stitcher
::
createDefault
();
stitcher
.
setFeaturesFinder
(
featuresFinder
);
stitcher
.
setFeaturesMatcher
(
featuresMatcher
);
stitcher
.
setWarper
(
new
SphericalWarper
());
stitcher
.
setRegistrationResol
(
WORK_MEGAPIX
);
startTimer
();
stitcher
.
stitch
(
imgs
,
pano
);
stopTimer
();
}
}
PERF_TEST_P
(
stitch
,
b12
,
TEST_DETECTORS
)
{
Mat
pano
;
vector
<
Mat
>
imgs
;
imgs
.
push_back
(
imread
(
getDataPath
(
"stitching/b1.jpg"
)
)
);
imgs
.
push_back
(
imread
(
getDataPath
(
"stitching/b2.jpg"
)
)
);
Ptr
<
detail
::
FeaturesFinder
>
featuresFinder
=
GetParam
()
==
"orb"
?
(
detail
::
FeaturesFinder
*
)
new
detail
::
OrbFeaturesFinder
()
:
(
detail
::
FeaturesFinder
*
)
new
detail
::
SurfFeaturesFinder
();
Ptr
<
detail
::
FeaturesMatcher
>
featuresMatcher
=
GetParam
()
==
"orb"
?
new
detail
::
BestOf2NearestMatcher
(
false
,
ORB_MATCH_CONFIDENCE
)
:
new
detail
::
BestOf2NearestMatcher
(
false
,
SURF_MATCH_CONFIDENCE
);
declare
.
time
(
30
*
20
).
iterations
(
20
);
while
(
next
())
{
Stitcher
stitcher
=
Stitcher
::
createDefault
();
stitcher
.
setFeaturesFinder
(
featuresFinder
);
stitcher
.
setFeaturesMatcher
(
featuresMatcher
);
stitcher
.
setWarper
(
new
SphericalWarper
());
stitcher
.
setRegistrationResol
(
WORK_MEGAPIX
);
startTimer
();
stitcher
.
stitch
(
imgs
,
pano
);
stopTimer
();
}
}
PERF_TEST_P
(
match
,
bestOf2Nearest
,
TEST_DETECTORS
)
{
Mat
img1
,
img1_full
=
imread
(
getDataPath
(
"stitching/b1.jpg"
)
);
Mat
img2
,
img2_full
=
imread
(
getDataPath
(
"stitching/b2.jpg"
)
);
float
scale1
=
(
float
)
std
::
min
(
1.0
,
sqrt
(
WORK_MEGAPIX
*
1e6
/
img1_full
.
total
()));
float
scale2
=
(
float
)
std
::
min
(
1.0
,
sqrt
(
WORK_MEGAPIX
*
1e6
/
img2_full
.
total
()));
resize
(
img1_full
,
img1
,
Size
(),
scale1
,
scale1
);
resize
(
img2_full
,
img2
,
Size
(),
scale2
,
scale2
);
Ptr
<
detail
::
FeaturesFinder
>
finder
;
Ptr
<
detail
::
FeaturesMatcher
>
matcher
;
if
(
GetParam
()
==
"surf"
)
{
finder
=
new
detail
::
SurfFeaturesFinder
();
matcher
=
new
detail
::
BestOf2NearestMatcher
(
false
,
SURF_MATCH_CONFIDENCE
);
}
else
if
(
GetParam
()
==
"orb"
)
{
finder
=
new
detail
::
OrbFeaturesFinder
();
matcher
=
new
detail
::
BestOf2NearestMatcher
(
false
,
ORB_MATCH_CONFIDENCE
);
}
else
{
FAIL
()
<<
"Unknown 2D features type: "
<<
GetParam
();
}
detail
::
ImageFeatures
features1
,
features2
;
(
*
finder
)(
img1
,
features1
);
(
*
finder
)(
img2
,
features2
);
detail
::
MatchesInfo
pairwise_matches
;
declare
.
in
(
features1
.
descriptors
,
features2
.
descriptors
)
.
iterations
(
100
);
while
(
next
())
{
cvflann
::
seed_random
(
42
);
//for predictive FlannBasedMatcher
startTimer
();
(
*
matcher
)(
features1
,
features2
,
pairwise_matches
);
stopTimer
();
matcher
->
collectGarbage
();
}
}
#include "perf_precomp.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/core/internal.hpp"
#include "opencv2/flann/flann.hpp"
#include "opencv2/opencv_modules.hpp"
using
namespace
std
;
using
namespace
cv
;
using
namespace
perf
;
using
std
::
tr1
::
make_tuple
;
using
std
::
tr1
::
get
;
#define SURF_MATCH_CONFIDENCE 0.65f
#define ORB_MATCH_CONFIDENCE 0.3f
#define WORK_MEGAPIX 0.6
typedef
TestBaseWithParam
<
String
>
stitch
;
typedef
TestBaseWithParam
<
String
>
match
;
#ifdef HAVE_OPENCV_NONFREE
#define TEST_DETECTORS testing::Values("surf", "orb")
#else
#define TEST_DETECTORS testing::Values<String>("orb")
#endif
PERF_TEST_P
(
stitch
,
a123
,
TEST_DETECTORS
)
{
Mat
pano
;
vector
<
Mat
>
imgs
;
imgs
.
push_back
(
imread
(
getDataPath
(
"stitching/a1.jpg"
)
)
);
imgs
.
push_back
(
imread
(
getDataPath
(
"stitching/a2.jpg"
)
)
);
imgs
.
push_back
(
imread
(
getDataPath
(
"stitching/a3.jpg"
)
)
);
Ptr
<
detail
::
FeaturesFinder
>
featuresFinder
=
GetParam
()
==
"orb"
?
(
detail
::
FeaturesFinder
*
)
new
detail
::
OrbFeaturesFinder
()
:
(
detail
::
FeaturesFinder
*
)
new
detail
::
SurfFeaturesFinder
();
Ptr
<
detail
::
FeaturesMatcher
>
featuresMatcher
=
GetParam
()
==
"orb"
?
new
detail
::
BestOf2NearestMatcher
(
false
,
ORB_MATCH_CONFIDENCE
)
:
new
detail
::
BestOf2NearestMatcher
(
false
,
SURF_MATCH_CONFIDENCE
);
declare
.
time
(
30
*
20
).
iterations
(
20
);
while
(
next
())
{
Stitcher
stitcher
=
Stitcher
::
createDefault
();
stitcher
.
setFeaturesFinder
(
featuresFinder
);
stitcher
.
setFeaturesMatcher
(
featuresMatcher
);
stitcher
.
setWarper
(
new
SphericalWarper
());
stitcher
.
setRegistrationResol
(
WORK_MEGAPIX
);
startTimer
();
stitcher
.
stitch
(
imgs
,
pano
);
stopTimer
();
}
}
PERF_TEST_P
(
stitch
,
b12
,
TEST_DETECTORS
)
{
Mat
pano
;
vector
<
Mat
>
imgs
;
imgs
.
push_back
(
imread
(
getDataPath
(
"stitching/b1.jpg"
)
)
);
imgs
.
push_back
(
imread
(
getDataPath
(
"stitching/b2.jpg"
)
)
);
Ptr
<
detail
::
FeaturesFinder
>
featuresFinder
=
GetParam
()
==
"orb"
?
(
detail
::
FeaturesFinder
*
)
new
detail
::
OrbFeaturesFinder
()
:
(
detail
::
FeaturesFinder
*
)
new
detail
::
SurfFeaturesFinder
();
Ptr
<
detail
::
FeaturesMatcher
>
featuresMatcher
=
GetParam
()
==
"orb"
?
new
detail
::
BestOf2NearestMatcher
(
false
,
ORB_MATCH_CONFIDENCE
)
:
new
detail
::
BestOf2NearestMatcher
(
false
,
SURF_MATCH_CONFIDENCE
);
declare
.
time
(
30
*
20
).
iterations
(
20
);
while
(
next
())
{
Stitcher
stitcher
=
Stitcher
::
createDefault
();
stitcher
.
setFeaturesFinder
(
featuresFinder
);
stitcher
.
setFeaturesMatcher
(
featuresMatcher
);
stitcher
.
setWarper
(
new
SphericalWarper
());
stitcher
.
setRegistrationResol
(
WORK_MEGAPIX
);
startTimer
();
stitcher
.
stitch
(
imgs
,
pano
);
stopTimer
();
}
}
PERF_TEST_P
(
match
,
bestOf2Nearest
,
TEST_DETECTORS
)
{
Mat
img1
,
img1_full
=
imread
(
getDataPath
(
"stitching/b1.jpg"
)
);
Mat
img2
,
img2_full
=
imread
(
getDataPath
(
"stitching/b2.jpg"
)
);
float
scale1
=
(
float
)
std
::
min
(
1.0
,
sqrt
(
WORK_MEGAPIX
*
1e6
/
img1_full
.
total
()));
float
scale2
=
(
float
)
std
::
min
(
1.0
,
sqrt
(
WORK_MEGAPIX
*
1e6
/
img2_full
.
total
()));
resize
(
img1_full
,
img1
,
Size
(),
scale1
,
scale1
);
resize
(
img2_full
,
img2
,
Size
(),
scale2
,
scale2
);
Ptr
<
detail
::
FeaturesFinder
>
finder
;
Ptr
<
detail
::
FeaturesMatcher
>
matcher
;
if
(
GetParam
()
==
"surf"
)
{
finder
=
new
detail
::
SurfFeaturesFinder
();
matcher
=
new
detail
::
BestOf2NearestMatcher
(
false
,
SURF_MATCH_CONFIDENCE
);
}
else
if
(
GetParam
()
==
"orb"
)
{
finder
=
new
detail
::
OrbFeaturesFinder
();
matcher
=
new
detail
::
BestOf2NearestMatcher
(
false
,
ORB_MATCH_CONFIDENCE
);
}
else
{
FAIL
()
<<
"Unknown 2D features type: "
<<
GetParam
();
}
detail
::
ImageFeatures
features1
,
features2
;
(
*
finder
)(
img1
,
features1
);
(
*
finder
)(
img2
,
features2
);
detail
::
MatchesInfo
pairwise_matches
;
declare
.
in
(
features1
.
descriptors
,
features2
.
descriptors
)
.
iterations
(
100
);
while
(
next
())
{
cvflann
::
seed_random
(
42
);
//for predictive FlannBasedMatcher
startTimer
();
(
*
matcher
)(
features1
,
features2
,
pairwise_matches
);
stopTimer
();
matcher
->
collectGarbage
();
}
}
modules/ts/src/ts_perf.cpp
View file @
e37b9469
This diff is collapsed.
Click to expand it.
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