Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv_contrib
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_contrib
Commits
2e2b6291
Commit
2e2b6291
authored
Sep 28, 2017
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
surf: fix OpenCL tests
should use UMat
parent
85a284c0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
15 deletions
+38
-15
test_features2d.cpp
modules/xfeatures2d/test/test_features2d.cpp
+26
-3
test_surf.ocl.cpp
modules/xfeatures2d/test/test_surf.ocl.cpp
+12
-12
No files found.
modules/xfeatures2d/test/test_features2d.cpp
View file @
2e2b6291
...
...
@@ -408,7 +408,18 @@ protected:
Mat
calcDescriptors
;
double
t
=
(
double
)
getTickCount
();
dextractor
->
compute
(
img
,
keypoints
,
calcDescriptors
);
#ifdef HAVE_OPENCL
if
(
ocl
::
useOpenCL
())
{
cv
::
UMat
uimg
;
img
.
copyTo
(
uimg
);
dextractor
->
compute
(
uimg
,
keypoints
,
calcDescriptors
);
}
else
#endif
{
dextractor
->
compute
(
img
,
keypoints
,
calcDescriptors
);
}
t
=
getTickCount
()
-
t
;
ts
->
printf
(
cvtest
::
TS
::
LOG
,
"
\n
Average time of computing one descriptor = %g ms.
\n
"
,
t
/
((
double
)
getTickFrequency
()
*
1000.
)
/
calcDescriptors
.
rows
);
...
...
@@ -1277,8 +1288,20 @@ protected:
}
vector
<
KeyPoint
>
kpt1
,
kpt2
;
Mat
d1
,
d2
;
f2d
->
detectAndCompute
(
img1
,
Mat
(),
kpt1
,
d1
);
f2d
->
detectAndCompute
(
img1
,
Mat
(),
kpt2
,
d2
);
#ifdef HAVE_OPENCL
if
(
ocl
::
useOpenCL
())
{
cv
::
UMat
uimg1
;
img1
.
copyTo
(
uimg1
);
f2d
->
detectAndCompute
(
uimg1
,
Mat
(),
kpt1
,
d1
);
f2d
->
detectAndCompute
(
uimg1
,
Mat
(),
kpt2
,
d2
);
}
else
#endif
{
f2d
->
detectAndCompute
(
img1
,
Mat
(),
kpt1
,
d1
);
f2d
->
detectAndCompute
(
img1
,
Mat
(),
kpt2
,
d2
);
}
for
(
size_t
i
=
0
;
i
<
kpt1
.
size
();
i
++
)
CV_Assert
(
kpt1
[
i
].
response
>
0
);
for
(
size_t
i
=
0
;
i
<
kpt2
.
size
();
i
++
)
...
...
modules/xfeatures2d/test/test_surf.ocl.cpp
View file @
2e2b6291
...
...
@@ -144,18 +144,18 @@ PARAM_TEST_CASE(SURF, HessianThreshold, Octaves, OctaveLayers, Extended, Upright
TEST_P
(
SURF
,
Detector
)
{
cv
::
UMat
image
;
cv
::
ocl
::
setUseOpenCL
(
true
);
cv
::
imread
(
string
(
cvtest
::
TS
::
ptr
()
->
get_data_path
())
+
"shared/fruits.png"
,
cv
::
IMREAD_GRAYSCALE
).
copyTo
(
image
);
cv
::
UMat
image
;
cv
::
ocl
::
setUseOpenCL
(
true
);
cv
::
imread
(
string
(
cvtest
::
TS
::
ptr
()
->
get_data_path
())
+
"shared/fruits.png"
,
cv
::
IMREAD_GRAYSCALE
).
copyTo
(
image
);
ASSERT_FALSE
(
image
.
empty
());
cv
::
Ptr
<
cv
::
xfeatures2d
::
SURF
>
surf
=
cv
::
xfeatures2d
::
SURF
::
create
(
hessianThreshold
,
nOctaves
,
nOctaveLayers
,
extended
,
upright
);
std
::
vector
<
cv
::
KeyPoint
>
keypoints
;
surf
->
detect
(
image
,
keypoints
,
cv
::
noArray
());
cv
::
ocl
::
setUseOpenCL
(
false
);
cv
::
ocl
::
setUseOpenCL
(
false
);
std
::
vector
<
cv
::
KeyPoint
>
keypoints_gold
;
surf
->
detect
(
image
,
keypoints_gold
,
cv
::
noArray
());
surf
->
detect
(
image
,
keypoints_gold
,
cv
::
noArray
());
ASSERT_EQ
(
keypoints_gold
.
size
(),
keypoints
.
size
());
int
matchedCount
=
getMatchedPointsCount
(
keypoints_gold
,
keypoints
);
...
...
@@ -166,23 +166,23 @@ TEST_P(SURF, Detector)
TEST_P
(
SURF
,
Descriptor
)
{
cv
::
UMat
image
;
cv
::
ocl
::
setUseOpenCL
(
true
);
cv
::
imread
(
string
(
cvtest
::
TS
::
ptr
()
->
get_data_path
())
+
"shared/fruits.png"
,
cv
::
IMREAD_GRAYSCALE
).
copyTo
(
image
);
cv
::
UMat
image
;
cv
::
ocl
::
setUseOpenCL
(
true
);
cv
::
imread
(
string
(
cvtest
::
TS
::
ptr
()
->
get_data_path
())
+
"shared/fruits.png"
,
cv
::
IMREAD_GRAYSCALE
).
copyTo
(
image
);
ASSERT_FALSE
(
image
.
empty
());
cv
::
Ptr
<
cv
::
xfeatures2d
::
SURF
>
surf
=
cv
::
xfeatures2d
::
SURF
::
create
(
hessianThreshold
,
nOctaves
,
nOctaveLayers
,
extended
,
upright
);
cv
::
Ptr
<
cv
::
xfeatures2d
::
SURF
>
surf
=
cv
::
xfeatures2d
::
SURF
::
create
(
hessianThreshold
,
nOctaves
,
nOctaveLayers
,
extended
,
upright
);
std
::
vector
<
cv
::
KeyPoint
>
keypoints
;
surf
->
detect
(
image
,
keypoints
,
cv
::
noArray
());
surf
->
detect
(
image
,
keypoints
,
cv
::
noArray
());
cv
::
UMat
descriptors
;
surf
->
detectAndCompute
(
image
,
cv
::
noArray
(),
keypoints
,
descriptors
,
true
);
cv
::
ocl
::
setUseOpenCL
(
false
);
cv
::
ocl
::
setUseOpenCL
(
false
);
cv
::
Mat
descriptors_gold
;
surf
->
detectAndCompute
(
image
,
cv
::
noArray
(),
keypoints
,
descriptors_gold
,
true
);
surf
->
detectAndCompute
(
image
,
cv
::
noArray
(),
keypoints
,
descriptors_gold
,
true
);
cv
::
BFMatcher
matcher
(
surf
->
defaultNorm
());
std
::
vector
<
cv
::
DMatch
>
matches
;
...
...
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