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
5421d741
Commit
5421d741
authored
Mar 24, 2014
by
Andrey Pavlenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
making OCL tests conform to the comon style
parent
22f42a63
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
80 additions
and
32 deletions
+80
-32
perf_main.cpp
modules/nonfree/perf/perf_main.cpp
+26
-1
perf_precomp.hpp
modules/nonfree/perf/perf_precomp.hpp
+2
-0
perf_surf.cpp
modules/nonfree/perf/perf_surf.cpp
+52
-31
No files found.
modules/nonfree/perf/perf_main.cpp
View file @
5421d741
...
@@ -11,4 +11,29 @@ static const char * impls[] = {
...
@@ -11,4 +11,29 @@ static const char * impls[] = {
"plain"
"plain"
};
};
CV_PERF_TEST_MAIN_WITH_IMPLS
(
nonfree
,
impls
,
perf
::
printCudaInfo
())
#ifdef HAVE_OPENCL
#define DUMP_PROPERTY_XML(propertyName, propertyValue) \
do { \
std::stringstream ssName, ssValue;\
ssName << propertyName;\
ssValue << propertyValue; \
::testing::Test::RecordProperty(ssName.str(), ssValue.str()); \
} while (false)
#define DUMP_MESSAGE_STDOUT(msg) \
do { \
std::cout << msg << std::endl; \
} while (false)
#include "opencv2/ocl/private/opencl_dumpinfo.hpp"
#endif
int
main
(
int
argc
,
char
**
argv
)
{
::
perf
::
TestBase
::
setPerformanceStrategy
(
::
perf
::
PERF_STRATEGY_SIMPLE
);
#if defined(HAVE_CUDA)
CV_PERF_TEST_MAIN_INTERNALS
(
nonfree
,
impls
,
perf
::
printCudaInfo
());
#else if defined(HAVE_OPENCL)
CV_PERF_TEST_MAIN_INTERNALS
(
nonfree
,
impls
,
dumpOpenCLDevice
());
#endif
}
modules/nonfree/perf/perf_precomp.hpp
View file @
5421d741
...
@@ -9,6 +9,8 @@
...
@@ -9,6 +9,8 @@
#ifndef __OPENCV_PERF_PRECOMP_HPP__
#ifndef __OPENCV_PERF_PRECOMP_HPP__
#define __OPENCV_PERF_PRECOMP_HPP__
#define __OPENCV_PERF_PRECOMP_HPP__
#include "cvconfig.h"
#include "opencv2/ts/ts.hpp"
#include "opencv2/ts/ts.hpp"
#include "opencv2/nonfree/nonfree.hpp"
#include "opencv2/nonfree/nonfree.hpp"
...
...
modules/nonfree/perf/perf_surf.cpp
View file @
5421d741
...
@@ -13,36 +13,34 @@ typedef perf::TestBaseWithParam<std::string> surf;
...
@@ -13,36 +13,34 @@ typedef perf::TestBaseWithParam<std::string> surf;
"stitching/a3.png"
"stitching/a3.png"
#ifdef HAVE_OPENCV_OCL
#ifdef HAVE_OPENCV_OCL
static
Ptr
<
Feature2D
>
getSURF
()
#define OCL_TEST_CYCLE() for( ; startTimer(), next(); cv::ocl::finish(), stopTimer())
{
ocl
::
PlatformsInfo
p
;
if
(
ocl
::
getOpenCLPlatforms
(
p
)
>
0
)
return
new
ocl
::
SURF_OCL
;
else
return
new
SURF
;
}
#else
static
Ptr
<
Feature2D
>
getSURF
()
{
return
new
SURF
;
}
#endif
#endif
PERF_TEST_P
(
surf
,
detect
,
testing
::
Values
(
SURF_IMAGES
))
PERF_TEST_P
(
surf
,
detect
,
testing
::
Values
(
SURF_IMAGES
))
{
{
String
filename
=
getDataPath
(
GetParam
());
String
filename
=
getDataPath
(
GetParam
());
Mat
frame
=
imread
(
filename
,
IMREAD_GRAYSCALE
);
Mat
frame
=
imread
(
filename
,
IMREAD_GRAYSCALE
);
ASSERT_FALSE
(
frame
.
empty
())
<<
"Unable to load source image "
<<
filename
;
if
(
frame
.
empty
())
declare
.
in
(
frame
);
FAIL
()
<<
"Unable to load source image "
<<
filename
;
Mat
mask
;
Mat
mask
;
declare
.
in
(
frame
).
time
(
90
);
Ptr
<
Feature2D
>
detector
=
getSURF
();
vector
<
KeyPoint
>
points
;
vector
<
KeyPoint
>
points
;
Ptr
<
Feature2D
>
detector
;
TEST_CYCLE
()
detector
->
operator
()(
frame
,
mask
,
points
,
noArray
());
if
(
getSelectedImpl
()
==
"plain"
)
{
detector
=
new
SURF
;
TEST_CYCLE
()
detector
->
operator
()(
frame
,
mask
,
points
,
noArray
());
}
#ifdef HAVE_OPENCV_OCL
else
if
(
getSelectedImpl
()
==
"ocl"
)
{
detector
=
new
ocl
::
SURF_OCL
;
OCL_TEST_CYCLE
()
detector
->
operator
()(
frame
,
mask
,
points
,
noArray
());
}
#endif
else
CV_TEST_FAIL_NO_IMPL
();
SANITY_CHECK_KEYPOINTS
(
points
,
1e-3
);
SANITY_CHECK_KEYPOINTS
(
points
,
1e-3
);
}
}
...
@@ -51,19 +49,30 @@ PERF_TEST_P(surf, extract, testing::Values(SURF_IMAGES))
...
@@ -51,19 +49,30 @@ PERF_TEST_P(surf, extract, testing::Values(SURF_IMAGES))
{
{
String
filename
=
getDataPath
(
GetParam
());
String
filename
=
getDataPath
(
GetParam
());
Mat
frame
=
imread
(
filename
,
IMREAD_GRAYSCALE
);
Mat
frame
=
imread
(
filename
,
IMREAD_GRAYSCALE
);
ASSERT_FALSE
(
frame
.
empty
())
<<
"Unable to load source image "
<<
filename
;
if
(
frame
.
empty
())
declare
.
in
(
frame
);
FAIL
()
<<
"Unable to load source image "
<<
filename
;
Mat
mask
;
Mat
mask
;
declare
.
in
(
frame
).
time
(
90
);
Ptr
<
Feature2D
>
detector
;
Ptr
<
Feature2D
>
detector
=
getSURF
();
vector
<
KeyPoint
>
points
;
vector
<
KeyPoint
>
points
;
vector
<
float
>
descriptors
;
vector
<
float
>
descriptors
;
detector
->
operator
()(
frame
,
mask
,
points
,
noArray
());
TEST_CYCLE
()
detector
->
operator
()(
frame
,
mask
,
points
,
descriptors
,
true
);
if
(
getSelectedImpl
()
==
"plain"
)
{
detector
=
new
SURF
;
detector
->
operator
()(
frame
,
mask
,
points
,
noArray
());
TEST_CYCLE
()
detector
->
operator
()(
frame
,
mask
,
points
,
descriptors
,
true
);
}
#ifdef HAVE_OPENCV_OCL
else
if
(
getSelectedImpl
()
==
"ocl"
)
{
detector
=
new
ocl
::
SURF_OCL
;
detector
->
operator
()(
frame
,
mask
,
points
,
noArray
());
OCL_TEST_CYCLE
()
detector
->
operator
()(
frame
,
mask
,
points
,
descriptors
,
true
);
}
#endif
else
CV_TEST_FAIL_NO_IMPL
();
SANITY_CHECK
(
descriptors
,
1e-4
);
SANITY_CHECK
(
descriptors
,
1e-4
);
}
}
...
@@ -72,17 +81,29 @@ PERF_TEST_P(surf, full, testing::Values(SURF_IMAGES))
...
@@ -72,17 +81,29 @@ PERF_TEST_P(surf, full, testing::Values(SURF_IMAGES))
{
{
String
filename
=
getDataPath
(
GetParam
());
String
filename
=
getDataPath
(
GetParam
());
Mat
frame
=
imread
(
filename
,
IMREAD_GRAYSCALE
);
Mat
frame
=
imread
(
filename
,
IMREAD_GRAYSCALE
);
ASSERT_FALSE
(
frame
.
empty
())
<<
"Unable to load source image "
<<
filename
;
if
(
frame
.
empty
())
declare
.
in
(
frame
).
time
(
90
);
FAIL
()
<<
"Unable to load source image "
<<
filename
;
Mat
mask
;
Mat
mask
;
declare
.
in
(
frame
).
time
(
90
);
Ptr
<
Feature2D
>
detector
;
Ptr
<
Feature2D
>
detector
=
getSURF
();
vector
<
KeyPoint
>
points
;
vector
<
KeyPoint
>
points
;
vector
<
float
>
descriptors
;
vector
<
float
>
descriptors
;
TEST_CYCLE
()
detector
->
operator
()(
frame
,
mask
,
points
,
descriptors
,
false
);
if
(
getSelectedImpl
()
==
"plain"
)
{
detector
=
new
SURF
;
TEST_CYCLE
()
detector
->
operator
()(
frame
,
mask
,
points
,
descriptors
,
false
);
}
#ifdef HAVE_OPENCV_OCL
else
if
(
getSelectedImpl
()
==
"ocl"
)
{
detector
=
new
ocl
::
SURF_OCL
;
detector
->
operator
()(
frame
,
mask
,
points
,
noArray
());
OCL_TEST_CYCLE
()
detector
->
operator
()(
frame
,
mask
,
points
,
descriptors
,
false
);
}
#endif
else
CV_TEST_FAIL_NO_IMPL
();
SANITY_CHECK_KEYPOINTS
(
points
,
1e-3
);
SANITY_CHECK_KEYPOINTS
(
points
,
1e-3
);
SANITY_CHECK
(
descriptors
,
1e-4
);
SANITY_CHECK
(
descriptors
,
1e-4
);
...
...
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