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
1b4afcca
Commit
1b4afcca
authored
Mar 18, 2013
by
Andrey Kamaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move OpenCl SURF perf tests to nonfree and fix build of samples
parent
77ad07ad
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
52 additions
and
45 deletions
+52
-45
perf_precomp.hpp
modules/nonfree/perf/perf_precomp.hpp
+5
-4
perf_surf.ocl.cpp
modules/nonfree/perf/perf_surf.ocl.cpp
+45
-37
CMakeLists.txt
samples/ocl/CMakeLists.txt
+0
-4
performance.cpp
samples/ocl/performance.cpp
+1
-0
surf_matcher.cpp
samples/ocl/surf_matcher.cpp
+1
-0
No files found.
modules/nonfree/perf/perf_precomp.hpp
View file @
1b4afcca
...
...
@@ -9,14 +9,15 @@
#ifndef __OPENCV_PERF_PRECOMP_HPP__
#define __OPENCV_PERF_PRECOMP_HPP__
#include "cvconfig.h"
#include "opencv2/opencv_modules.hpp"
#include "opencv2/ts/ts.hpp"
#include "opencv2/ts/gpu_perf.hpp"
#include "opencv2/nonfree/nonfree.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/opencv_modules.hpp"
#ifdef HAVE_OPENCV_OCL
# include "opencv2/nonfree/ocl.hpp"
#endif
#if defined(HAVE_OPENCV_GPU) && defined(HAVE_CUDA)
#include "opencv2/nonfree/gpu.hpp"
#endif
...
...
modules/
ocl/perf/perf_surf
.cpp
→
modules/
nonfree/perf/perf_surf.ocl
.cpp
View file @
1b4afcca
...
...
@@ -43,61 +43,69 @@
//
//M*/
#include "precomp.hpp"
#include <iomanip>
#include "perf_precomp.hpp"
#ifdef HAVE_OPENCL
#ifdef HAVE_OPENC
V_OC
L
using
namespace
cv
;
using
namespace
cv
::
ocl
;
using
namespace
cvtest
;
using
namespace
testing
;
using
namespace
std
;
#define FILTER_IMAGE "../../../samples/gpu/road.png"
typedef
perf
::
TestBaseWithParam
<
std
::
string
>
OCL_SURF
;
TEST
(
SURF
,
Performance
)
#define SURF_IMAGES \
"cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png",\
"stitching/a3.png"
PERF_TEST_P
(
OCL_SURF
,
DISABLED_with_data_transfer
,
testing
::
Values
(
SURF_IMAGES
))
{
cv
::
Mat
img
=
readImage
(
FILTER_IMAGE
,
cv
::
IMREAD_GRAYSCALE
);
string
filename
=
getDataPath
(
GetParam
());
Mat
img
=
imread
(
filename
,
IMREAD_GRAYSCALE
);
ASSERT_FALSE
(
img
.
empty
());
ocl
::
SURF_OCL
d_surf
;
ocl
::
oclMat
d_keypoints
;
ocl
::
oclMat
d_descriptors
;
SURF_OCL
d_surf
;
oclMat
d_keypoints
;
oclMat
d_descriptors
;
Mat
cpu_kp
;
Mat
cpu_dp
;
double
totalgputick
=
0
;
double
totalgputick_kernel
=
0
;
declare
.
time
(
60
);
double
t1
=
0
;
double
t2
=
0
;
for
(
int
j
=
0
;
j
<
LOOP_TIMES
+
1
;
j
++
)
TEST_CYCLE
()
{
t1
=
(
double
)
cvGetTickCount
();
//gpu start1
ocl
::
oclMat
d_src
(
img
);
//upload
t2
=
(
double
)
cvGetTickCount
();
//kernel
d_surf
(
d_src
,
ocl
::
oclMat
(),
d_keypoints
,
d_descriptors
);
t2
=
(
double
)
cvGetTickCount
()
-
t2
;
//kernel
oclMat
d_src
(
img
);
cv
::
Mat
cpu_kp
,
cpu_dp
;
d_keypoints
.
download
(
cpu_kp
);
//download
d_descriptors
.
download
(
cpu_dp
);
//download
d_surf
(
d_src
,
oclMat
(),
d_keypoints
,
d_descriptors
);
t1
=
(
double
)
cvGetTickCount
()
-
t1
;
//gpu end1
if
(
j
==
0
)
continue
;
d_keypoints
.
download
(
cpu_kp
);
d_descriptors
.
download
(
cpu_dp
);
}
totalgputick
=
t1
+
totalgputick
;
SANITY_CHECK
(
cpu_kp
,
1
);
SANITY_CHECK
(
cpu_dp
,
1
);
}
totalgputick_kernel
=
t2
+
totalgputick_kernel
;
PERF_TEST_P
(
OCL_SURF
,
DISABLED_without_data_transfer
,
testing
::
Values
(
SURF_IMAGES
))
{
string
filename
=
getDataPath
(
GetParam
());
Mat
img
=
imread
(
filename
,
IMREAD_GRAYSCALE
);
ASSERT_FALSE
(
img
.
empty
());
}
SURF_OCL
d_surf
;
oclMat
d_keypoints
;
oclMat
d_descriptors
;
oclMat
d_src
(
img
);
cout
<<
"average gpu runtime is "
<<
totalgputick
/
((
double
)
cvGetTickFrequency
()
*
LOOP_TIMES
*
1000.
)
<<
"ms"
<<
endl
;
cout
<<
"average gpu runtime without data transfer is "
<<
totalgputick_kernel
/
((
double
)
cvGetTickFrequency
()
*
LOOP_TIMES
*
1000.
)
<<
"ms"
<<
endl
;
declare
.
time
(
60
);
TEST_CYCLE
()
d_surf
(
d_src
,
oclMat
(),
d_keypoints
,
d_descriptors
);
Mat
cpu_kp
;
Mat
cpu_dp
;
d_keypoints
.
download
(
cpu_kp
);
d_descriptors
.
download
(
cpu_dp
);
SANITY_CHECK
(
cpu_kp
,
1
);
SANITY_CHECK
(
cpu_dp
,
1
);
}
#endif //Have opencl
\ No newline at end of file
#endif // HAVE_OPENCV_OCL
\ No newline at end of file
samples/ocl/CMakeLists.txt
View file @
1b4afcca
...
...
@@ -17,10 +17,6 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND)
ocv_include_directories
(
${
OPENCL_INCLUDE_DIR
}
)
endif
()
if
(
CMAKE_COMPILER_IS_GNUCXX AND NOT ENABLE_NOISY_WARNINGS
)
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
-Wno-unused-function"
)
endif
()
# ---------------------------------------------
# Define executable targets
# ---------------------------------------------
...
...
samples/ocl/performance.cpp
View file @
1b4afcca
...
...
@@ -16,6 +16,7 @@
#define USE_OPENCL
#ifdef USE_OPENCL
#include "opencv2/ocl/ocl.hpp"
#include "opencv2/nonfree/ocl.hpp"
#endif
#define TAB " "
...
...
samples/ocl/surf_matcher.cpp
View file @
1b4afcca
...
...
@@ -50,6 +50,7 @@
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/ocl/ocl.hpp"
#include "opencv2/nonfree/nonfree.hpp"
#include "opencv2/nonfree/ocl.hpp"
#include "opencv2/calib3d/calib3d.hpp"
using
namespace
std
;
...
...
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