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
b6313951
Commit
b6313951
authored
May 08, 2013
by
yao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use clean EXPECT_MAT_NEAR (no string output)
parent
35c6860f
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
108 additions
and
339 deletions
+108
-339
test_arithm.cpp
modules/ocl/test/test_arithm.cpp
+66
-220
test_blend.cpp
modules/ocl/test/test_blend.cpp
+1
-1
test_calib3d.cpp
modules/ocl/test/test_calib3d.cpp
+1
-1
test_color.cpp
modules/ocl/test/test_color.cpp
+3
-3
test_filters.cpp
modules/ocl/test/test_filters.cpp
+1
-1
test_hog.cpp
modules/ocl/test/test_hog.cpp
+1
-2
test_imgproc.cpp
modules/ocl/test/test_imgproc.cpp
+31
-107
utility.hpp
modules/ocl/test/utility.hpp
+4
-4
No files found.
modules/ocl/test/test_arithm.cpp
View file @
b6313951
...
@@ -172,14 +172,26 @@ PARAM_TEST_CASE(ArithmTestBase, MatType, bool)
...
@@ -172,14 +172,26 @@ PARAM_TEST_CASE(ArithmTestBase, MatType, bool)
gmask
=
mask_roi
;
//end
gmask
=
mask_roi
;
//end
}
}
void
Near
(
double
threshold
=
0.
)
{
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
threshold
);
}
void
Near1
(
double
threshold
=
0.
)
{
cv
::
Mat
cpu_dst1
;
gdst1_whole
.
download
(
cpu_dst1
);
EXPECT_MAT_NEAR
(
dst1
,
cpu_dst1
,
threshold
);
}
};
};
////////////////////////////////lut/////////////////////////////////////////////////
////////////////////////////////lut/////////////////////////////////////////////////
struct
Lut
:
ArithmTestBase
{};
struct
Lut
:
ArithmTestBase
{};
#define VARNAME(A) string(#A);
#define VARNAME(A) string(#A);
TEST_P
(
Lut
,
Mat
)
TEST_P
(
Lut
,
Mat
)
{
{
...
@@ -200,10 +212,7 @@ TEST_P(Lut, Mat)
...
@@ -200,10 +212,7 @@ TEST_P(Lut, Mat)
cv
::
LUT
(
mat1_roi
,
mat2_roi
,
dst_roi
);
cv
::
LUT
(
mat1_roi
,
mat2_roi
,
dst_roi
);
cv
::
ocl
::
LUT
(
gmat1
,
gmat2
,
gdst
);
cv
::
ocl
::
LUT
(
gmat1
,
gmat2
,
gdst
);
Near
(
0
);
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
0
,
""
);
}
}
}
}
...
@@ -219,12 +228,7 @@ TEST_P(Exp, Mat)
...
@@ -219,12 +228,7 @@ TEST_P(Exp, Mat)
cv
::
exp
(
mat1_roi
,
dst_roi
);
cv
::
exp
(
mat1_roi
,
dst_roi
);
cv
::
ocl
::
exp
(
gmat1
,
gdst
);
cv
::
ocl
::
exp
(
gmat1
,
gdst
);
Near
(
2
);
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
2
,
""
);
}
}
}
}
...
@@ -240,10 +244,7 @@ TEST_P(Log, Mat)
...
@@ -240,10 +244,7 @@ TEST_P(Log, Mat)
cv
::
log
(
mat1_roi
,
dst_roi
);
cv
::
log
(
mat1_roi
,
dst_roi
);
cv
::
ocl
::
log
(
gmat1
,
gdst
);
cv
::
ocl
::
log
(
gmat1
,
gdst
);
Near
(
1
);
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
1
,
""
);
}
}
}
}
...
@@ -259,10 +260,7 @@ TEST_P(Add, Mat)
...
@@ -259,10 +260,7 @@ TEST_P(Add, Mat)
cv
::
add
(
mat1_roi
,
mat2_roi
,
dst_roi
);
cv
::
add
(
mat1_roi
,
mat2_roi
,
dst_roi
);
cv
::
ocl
::
add
(
gmat1
,
gmat2
,
gdst
);
cv
::
ocl
::
add
(
gmat1
,
gmat2
,
gdst
);
Near
(
0
);
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
0.0
,
""
);
}
}
}
}
...
@@ -274,12 +272,10 @@ TEST_P(Add, Mat_Mask)
...
@@ -274,12 +272,10 @@ TEST_P(Add, Mat_Mask)
cv
::
add
(
mat1_roi
,
mat2_roi
,
dst_roi
,
mask_roi
);
cv
::
add
(
mat1_roi
,
mat2_roi
,
dst_roi
,
mask_roi
);
cv
::
ocl
::
add
(
gmat1
,
gmat2
,
gdst
,
gmask
);
cv
::
ocl
::
add
(
gmat1
,
gmat2
,
gdst
,
gmask
);
Near
(
0
);
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
0.0
,
""
);
}
}
}
}
TEST_P
(
Add
,
Scalar
)
TEST_P
(
Add
,
Scalar
)
{
{
for
(
int
j
=
0
;
j
<
LOOP_TIMES
;
j
++
)
for
(
int
j
=
0
;
j
<
LOOP_TIMES
;
j
++
)
...
@@ -288,10 +284,7 @@ TEST_P(Add, Scalar)
...
@@ -288,10 +284,7 @@ TEST_P(Add, Scalar)
cv
::
add
(
mat1_roi
,
val
,
dst_roi
);
cv
::
add
(
mat1_roi
,
val
,
dst_roi
);
cv
::
ocl
::
add
(
gmat1
,
val
,
gdst
);
cv
::
ocl
::
add
(
gmat1
,
val
,
gdst
);
Near
(
1e-5
);
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
1e-5
,
""
);
}
}
}
}
...
@@ -303,10 +296,7 @@ TEST_P(Add, Scalar_Mask)
...
@@ -303,10 +296,7 @@ TEST_P(Add, Scalar_Mask)
cv
::
add
(
mat1_roi
,
val
,
dst_roi
,
mask_roi
);
cv
::
add
(
mat1_roi
,
val
,
dst_roi
,
mask_roi
);
cv
::
ocl
::
add
(
gmat1
,
val
,
gdst
,
gmask
);
cv
::
ocl
::
add
(
gmat1
,
val
,
gdst
,
gmask
);
Near
(
1e-5
);
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
1e-5
,
""
);
}
}
}
}
...
@@ -323,10 +313,7 @@ TEST_P(Sub, Mat)
...
@@ -323,10 +313,7 @@ TEST_P(Sub, Mat)
cv
::
subtract
(
mat1_roi
,
mat2_roi
,
dst_roi
);
cv
::
subtract
(
mat1_roi
,
mat2_roi
,
dst_roi
);
cv
::
ocl
::
subtract
(
gmat1
,
gmat2
,
gdst
);
cv
::
ocl
::
subtract
(
gmat1
,
gmat2
,
gdst
);
Near
(
0
);
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
0.0
,
""
);
}
}
}
}
...
@@ -338,10 +325,7 @@ TEST_P(Sub, Mat_Mask)
...
@@ -338,10 +325,7 @@ TEST_P(Sub, Mat_Mask)
cv
::
subtract
(
mat1_roi
,
mat2_roi
,
dst_roi
,
mask_roi
);
cv
::
subtract
(
mat1_roi
,
mat2_roi
,
dst_roi
,
mask_roi
);
cv
::
ocl
::
subtract
(
gmat1
,
gmat2
,
gdst
,
gmask
);
cv
::
ocl
::
subtract
(
gmat1
,
gmat2
,
gdst
,
gmask
);
Near
(
0
);
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
0.0
,
""
);
}
}
}
}
...
@@ -353,10 +337,7 @@ TEST_P(Sub, Scalar)
...
@@ -353,10 +337,7 @@ TEST_P(Sub, Scalar)
cv
::
subtract
(
mat1_roi
,
val
,
dst_roi
);
cv
::
subtract
(
mat1_roi
,
val
,
dst_roi
);
cv
::
ocl
::
subtract
(
gmat1
,
val
,
gdst
);
cv
::
ocl
::
subtract
(
gmat1
,
val
,
gdst
);
Near
(
1e-5
);
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
1e-5
,
""
);
}
}
}
}
...
@@ -368,10 +349,7 @@ TEST_P(Sub, Scalar_Mask)
...
@@ -368,10 +349,7 @@ TEST_P(Sub, Scalar_Mask)
cv
::
subtract
(
mat1_roi
,
val
,
dst_roi
,
mask_roi
);
cv
::
subtract
(
mat1_roi
,
val
,
dst_roi
,
mask_roi
);
cv
::
ocl
::
subtract
(
gmat1
,
val
,
gdst
,
gmask
);
cv
::
ocl
::
subtract
(
gmat1
,
val
,
gdst
,
gmask
);
Near
(
1e-5
);
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
1e-5
,
""
);
}
}
}
}
...
@@ -388,10 +366,7 @@ TEST_P(Mul, Mat)
...
@@ -388,10 +366,7 @@ TEST_P(Mul, Mat)
cv
::
multiply
(
mat1_roi
,
mat2_roi
,
dst_roi
);
cv
::
multiply
(
mat1_roi
,
mat2_roi
,
dst_roi
);
cv
::
ocl
::
multiply
(
gmat1
,
gmat2
,
gdst
);
cv
::
ocl
::
multiply
(
gmat1
,
gmat2
,
gdst
);
Near
(
0
);
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
0.0
,
""
);
}
}
}
}
...
@@ -406,10 +381,7 @@ TEST_P(Mul, Mat_Scalar)
...
@@ -406,10 +381,7 @@ TEST_P(Mul, Mat_Scalar)
cv
::
multiply
(
mat1_roi
,
mat2_roi
,
dst_roi
,
s
);
cv
::
multiply
(
mat1_roi
,
mat2_roi
,
dst_roi
,
s
);
cv
::
ocl
::
multiply
(
gmat1
,
gmat2
,
gdst
,
s
);
cv
::
ocl
::
multiply
(
gmat1
,
gmat2
,
gdst
,
s
);
Near
(
.001
);
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
0.001
,
""
);
}
}
}
}
...
@@ -425,10 +397,7 @@ TEST_P(Div, Mat)
...
@@ -425,10 +397,7 @@ TEST_P(Div, Mat)
cv
::
divide
(
mat1_roi
,
mat2_roi
,
dst_roi
);
cv
::
divide
(
mat1_roi
,
mat2_roi
,
dst_roi
);
cv
::
ocl
::
divide
(
gmat1
,
gmat2
,
gdst
);
cv
::
ocl
::
divide
(
gmat1
,
gmat2
,
gdst
);
Near
(
1
);
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
1
,
""
);
}
}
}
}
...
@@ -443,10 +412,7 @@ TEST_P(Div, Mat_Scalar)
...
@@ -443,10 +412,7 @@ TEST_P(Div, Mat_Scalar)
cv
::
divide
(
mat1_roi
,
mat2_roi
,
dst_roi
,
s
);
cv
::
divide
(
mat1_roi
,
mat2_roi
,
dst_roi
,
s
);
cv
::
ocl
::
divide
(
gmat1
,
gmat2
,
gdst
,
s
);
cv
::
ocl
::
divide
(
gmat1
,
gmat2
,
gdst
,
s
);
Near
(
.001
);
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
0.001
,
""
);
}
}
}
}
...
@@ -461,10 +427,7 @@ TEST_P(Absdiff, Mat)
...
@@ -461,10 +427,7 @@ TEST_P(Absdiff, Mat)
cv
::
absdiff
(
mat1_roi
,
mat2_roi
,
dst_roi
);
cv
::
absdiff
(
mat1_roi
,
mat2_roi
,
dst_roi
);
cv
::
ocl
::
absdiff
(
gmat1
,
gmat2
,
gdst
);
cv
::
ocl
::
absdiff
(
gmat1
,
gmat2
,
gdst
);
Near
(
0
);
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
0
,
""
);
}
}
}
}
...
@@ -476,10 +439,7 @@ TEST_P(Absdiff, Mat_Scalar)
...
@@ -476,10 +439,7 @@ TEST_P(Absdiff, Mat_Scalar)
cv
::
absdiff
(
mat1_roi
,
val
,
dst_roi
);
cv
::
absdiff
(
mat1_roi
,
val
,
dst_roi
);
cv
::
ocl
::
absdiff
(
gmat1
,
val
,
gdst
);
cv
::
ocl
::
absdiff
(
gmat1
,
val
,
gdst
);
Near
(
1e-5
);
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
1e-5
,
""
);
}
}
}
}
...
@@ -495,14 +455,8 @@ TEST_P(CartToPolar, angleInDegree)
...
@@ -495,14 +455,8 @@ TEST_P(CartToPolar, angleInDegree)
cv
::
cartToPolar
(
mat1_roi
,
mat2_roi
,
dst_roi
,
dst1_roi
,
1
);
cv
::
cartToPolar
(
mat1_roi
,
mat2_roi
,
dst_roi
,
dst1_roi
,
1
);
cv
::
ocl
::
cartToPolar
(
gmat1
,
gmat2
,
gdst
,
gdst1
,
1
);
cv
::
ocl
::
cartToPolar
(
gmat1
,
gmat2
,
gdst
,
gdst1
,
1
);
Near
(
.5
);
cv
::
Mat
cpu_dst
;
Near1
(
.5
);
gdst_whole
.
download
(
cpu_dst
);
cv
::
Mat
cpu_dst1
;
gdst1_whole
.
download
(
cpu_dst1
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
0.5
,
""
);
EXPECT_MAT_NEAR
(
dst1
,
cpu_dst1
,
0.5
,
""
);
}
}
}
}
...
@@ -514,14 +468,8 @@ TEST_P(CartToPolar, angleInRadians)
...
@@ -514,14 +468,8 @@ TEST_P(CartToPolar, angleInRadians)
cv
::
cartToPolar
(
mat1_roi
,
mat2_roi
,
dst_roi
,
dst1_roi
,
0
);
cv
::
cartToPolar
(
mat1_roi
,
mat2_roi
,
dst_roi
,
dst1_roi
,
0
);
cv
::
ocl
::
cartToPolar
(
gmat1
,
gmat2
,
gdst
,
gdst1
,
0
);
cv
::
ocl
::
cartToPolar
(
gmat1
,
gmat2
,
gdst
,
gdst1
,
0
);
Near
(
.5
);
cv
::
Mat
cpu_dst
;
Near1
(
.5
);
gdst_whole
.
download
(
cpu_dst
);
cv
::
Mat
cpu_dst1
;
gdst1_whole
.
download
(
cpu_dst1
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
0.5
,
""
);
EXPECT_MAT_NEAR
(
dst1
,
cpu_dst1
,
0.5
,
""
);
}
}
}
}
...
@@ -536,15 +484,8 @@ TEST_P(PolarToCart, angleInDegree)
...
@@ -536,15 +484,8 @@ TEST_P(PolarToCart, angleInDegree)
cv
::
polarToCart
(
mat1_roi
,
mat2_roi
,
dst_roi
,
dst1_roi
,
1
);
cv
::
polarToCart
(
mat1_roi
,
mat2_roi
,
dst_roi
,
dst1_roi
,
1
);
cv
::
ocl
::
polarToCart
(
gmat1
,
gmat2
,
gdst
,
gdst1
,
1
);
cv
::
ocl
::
polarToCart
(
gmat1
,
gmat2
,
gdst
,
gdst1
,
1
);
Near
(
.5
);
cv
::
Mat
cpu_dst
;
Near1
(
.5
);
gdst_whole
.
download
(
cpu_dst
);
cv
::
Mat
cpu_dst1
;
gdst1_whole
.
download
(
cpu_dst1
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
0.5
,
""
);
EXPECT_MAT_NEAR
(
dst1
,
cpu_dst1
,
0.5
,
""
);
}
}
}
}
...
@@ -556,15 +497,8 @@ TEST_P(PolarToCart, angleInRadians)
...
@@ -556,15 +497,8 @@ TEST_P(PolarToCart, angleInRadians)
cv
::
polarToCart
(
mat1_roi
,
mat2_roi
,
dst_roi
,
dst1_roi
,
0
);
cv
::
polarToCart
(
mat1_roi
,
mat2_roi
,
dst_roi
,
dst1_roi
,
0
);
cv
::
ocl
::
polarToCart
(
gmat1
,
gmat2
,
gdst
,
gdst1
,
0
);
cv
::
ocl
::
polarToCart
(
gmat1
,
gmat2
,
gdst
,
gdst1
,
0
);
Near
(
.5
);
cv
::
Mat
cpu_dst
;
Near1
(
.5
);
gdst_whole
.
download
(
cpu_dst
);
cv
::
Mat
cpu_dst1
;
gdst1_whole
.
download
(
cpu_dst1
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
0.5
,
""
);
EXPECT_MAT_NEAR
(
dst1
,
cpu_dst1
,
0.5
,
""
);
}
}
}
}
...
@@ -581,11 +515,7 @@ TEST_P(Magnitude, Mat)
...
@@ -581,11 +515,7 @@ TEST_P(Magnitude, Mat)
cv
::
magnitude
(
mat1_roi
,
mat2_roi
,
dst_roi
);
cv
::
magnitude
(
mat1_roi
,
mat2_roi
,
dst_roi
);
cv
::
ocl
::
magnitude
(
gmat1
,
gmat2
,
gdst
);
cv
::
ocl
::
magnitude
(
gmat1
,
gmat2
,
gdst
);
Near
(
1e-5
);
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
1e-5
,
""
);
}
}
}
}
...
@@ -600,16 +530,11 @@ TEST_P(Transpose, Mat)
...
@@ -600,16 +530,11 @@ TEST_P(Transpose, Mat)
cv
::
transpose
(
mat1_roi
,
dst_roi
);
cv
::
transpose
(
mat1_roi
,
dst_roi
);
cv
::
ocl
::
transpose
(
gmat1
,
gdst
);
cv
::
ocl
::
transpose
(
gmat1
,
gdst
);
Near
(
1e-5
);
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
1e-5
,
""
);
}
}
}
}
struct
Flip
:
ArithmTestBase
{};
struct
Flip
:
ArithmTestBase
{};
TEST_P
(
Flip
,
X
)
TEST_P
(
Flip
,
X
)
...
@@ -620,11 +545,7 @@ TEST_P(Flip, X)
...
@@ -620,11 +545,7 @@ TEST_P(Flip, X)
cv
::
flip
(
mat1_roi
,
dst_roi
,
0
);
cv
::
flip
(
mat1_roi
,
dst_roi
,
0
);
cv
::
ocl
::
flip
(
gmat1
,
gdst
,
0
);
cv
::
ocl
::
flip
(
gmat1
,
gdst
,
0
);
Near
(
1e-5
);
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
1e-5
,
""
);
}
}
}
}
...
@@ -636,11 +557,7 @@ TEST_P(Flip, Y)
...
@@ -636,11 +557,7 @@ TEST_P(Flip, Y)
cv
::
flip
(
mat1_roi
,
dst_roi
,
1
);
cv
::
flip
(
mat1_roi
,
dst_roi
,
1
);
cv
::
ocl
::
flip
(
gmat1
,
gdst
,
1
);
cv
::
ocl
::
flip
(
gmat1
,
gdst
,
1
);
Near
(
1e-5
);
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
1e-5
,
""
);
}
}
}
}
...
@@ -652,11 +569,7 @@ TEST_P(Flip, BOTH)
...
@@ -652,11 +569,7 @@ TEST_P(Flip, BOTH)
cv
::
flip
(
mat1_roi
,
dst_roi
,
-
1
);
cv
::
flip
(
mat1_roi
,
dst_roi
,
-
1
);
cv
::
ocl
::
flip
(
gmat1
,
gdst
,
-
1
);
cv
::
ocl
::
flip
(
gmat1
,
gdst
,
-
1
);
Near
(
1e-5
);
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
1e-5
,
""
);
}
}
}
}
...
@@ -1016,11 +929,7 @@ TEST_P(Phase, Mat)
...
@@ -1016,11 +929,7 @@ TEST_P(Phase, Mat)
random_roi
();
random_roi
();
cv
::
phase
(
mat1_roi
,
mat2_roi
,
dst_roi
,
angelInDegrees
?
true
:
false
);
cv
::
phase
(
mat1_roi
,
mat2_roi
,
dst_roi
,
angelInDegrees
?
true
:
false
);
cv
::
ocl
::
phase
(
gmat1
,
gmat2
,
gdst
,
angelInDegrees
?
true
:
false
);
cv
::
ocl
::
phase
(
gmat1
,
gmat2
,
gdst
,
angelInDegrees
?
true
:
false
);
Near
(
1e-2
);
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
1e-2
,
""
);
}
}
}
}
}
}
...
@@ -1037,11 +946,7 @@ TEST_P(Bitwise_and, Mat)
...
@@ -1037,11 +946,7 @@ TEST_P(Bitwise_and, Mat)
cv
::
bitwise_and
(
mat1_roi
,
mat2_roi
,
dst_roi
);
cv
::
bitwise_and
(
mat1_roi
,
mat2_roi
,
dst_roi
);
cv
::
ocl
::
bitwise_and
(
gmat1
,
gmat2
,
gdst
);
cv
::
ocl
::
bitwise_and
(
gmat1
,
gmat2
,
gdst
);
Near
(
0
);
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
0.0
,
""
);
}
}
}
}
...
@@ -1053,13 +958,10 @@ TEST_P(Bitwise_and, Mat_Mask)
...
@@ -1053,13 +958,10 @@ TEST_P(Bitwise_and, Mat_Mask)
cv
::
bitwise_and
(
mat1_roi
,
mat2_roi
,
dst_roi
,
mask_roi
);
cv
::
bitwise_and
(
mat1_roi
,
mat2_roi
,
dst_roi
,
mask_roi
);
cv
::
ocl
::
bitwise_and
(
gmat1
,
gmat2
,
gdst
,
gmask
);
cv
::
ocl
::
bitwise_and
(
gmat1
,
gmat2
,
gdst
,
gmask
);
Near
(
0
);
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
0.0
,
""
);
}
}
}
}
TEST_P
(
Bitwise_and
,
Scalar
)
TEST_P
(
Bitwise_and
,
Scalar
)
{
{
for
(
int
j
=
0
;
j
<
LOOP_TIMES
;
j
++
)
for
(
int
j
=
0
;
j
<
LOOP_TIMES
;
j
++
)
...
@@ -1068,12 +970,7 @@ TEST_P(Bitwise_and, Scalar)
...
@@ -1068,12 +970,7 @@ TEST_P(Bitwise_and, Scalar)
cv
::
bitwise_and
(
mat1_roi
,
val
,
dst_roi
);
cv
::
bitwise_and
(
mat1_roi
,
val
,
dst_roi
);
cv
::
ocl
::
bitwise_and
(
gmat1
,
val
,
gdst
);
cv
::
ocl
::
bitwise_and
(
gmat1
,
val
,
gdst
);
Near
(
1e-5
);
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
1e-5
,
""
);
}
}
}
}
...
@@ -1085,11 +982,7 @@ TEST_P(Bitwise_and, Scalar_Mask)
...
@@ -1085,11 +982,7 @@ TEST_P(Bitwise_and, Scalar_Mask)
cv
::
bitwise_and
(
mat1_roi
,
val
,
dst_roi
,
mask_roi
);
cv
::
bitwise_and
(
mat1_roi
,
val
,
dst_roi
,
mask_roi
);
cv
::
ocl
::
bitwise_and
(
gmat1
,
val
,
gdst
,
gmask
);
cv
::
ocl
::
bitwise_and
(
gmat1
,
val
,
gdst
,
gmask
);
Near
(
1e-5
);
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
1e-5
,
""
);
}
}
}
}
...
@@ -1107,11 +1000,7 @@ TEST_P(Bitwise_or, Mat)
...
@@ -1107,11 +1000,7 @@ TEST_P(Bitwise_or, Mat)
cv
::
bitwise_or
(
mat1_roi
,
mat2_roi
,
dst_roi
);
cv
::
bitwise_or
(
mat1_roi
,
mat2_roi
,
dst_roi
);
cv
::
ocl
::
bitwise_or
(
gmat1
,
gmat2
,
gdst
);
cv
::
ocl
::
bitwise_or
(
gmat1
,
gmat2
,
gdst
);
Near
(
0
);
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
0.0
,
""
);
}
}
}
}
...
@@ -1123,13 +1012,10 @@ TEST_P(Bitwise_or, Mat_Mask)
...
@@ -1123,13 +1012,10 @@ TEST_P(Bitwise_or, Mat_Mask)
cv
::
bitwise_or
(
mat1_roi
,
mat2_roi
,
dst_roi
,
mask_roi
);
cv
::
bitwise_or
(
mat1_roi
,
mat2_roi
,
dst_roi
,
mask_roi
);
cv
::
ocl
::
bitwise_or
(
gmat1
,
gmat2
,
gdst
,
gmask
);
cv
::
ocl
::
bitwise_or
(
gmat1
,
gmat2
,
gdst
,
gmask
);
Near
(
0
);
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
0.0
,
""
);
}
}
}
}
TEST_P
(
Bitwise_or
,
Scalar
)
TEST_P
(
Bitwise_or
,
Scalar
)
{
{
for
(
int
j
=
0
;
j
<
LOOP_TIMES
;
j
++
)
for
(
int
j
=
0
;
j
<
LOOP_TIMES
;
j
++
)
...
@@ -1138,11 +1024,7 @@ TEST_P(Bitwise_or, Scalar)
...
@@ -1138,11 +1024,7 @@ TEST_P(Bitwise_or, Scalar)
cv
::
bitwise_or
(
mat1_roi
,
val
,
dst_roi
);
cv
::
bitwise_or
(
mat1_roi
,
val
,
dst_roi
);
cv
::
ocl
::
bitwise_or
(
gmat1
,
val
,
gdst
);
cv
::
ocl
::
bitwise_or
(
gmat1
,
val
,
gdst
);
Near
(
1e-5
);
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
1e-5
,
""
);
}
}
}
}
...
@@ -1154,11 +1036,7 @@ TEST_P(Bitwise_or, Scalar_Mask)
...
@@ -1154,11 +1036,7 @@ TEST_P(Bitwise_or, Scalar_Mask)
cv
::
bitwise_or
(
mat1_roi
,
val
,
dst_roi
,
mask_roi
);
cv
::
bitwise_or
(
mat1_roi
,
val
,
dst_roi
,
mask_roi
);
cv
::
ocl
::
bitwise_or
(
gmat1
,
val
,
gdst
,
gmask
);
cv
::
ocl
::
bitwise_or
(
gmat1
,
val
,
gdst
,
gmask
);
Near
(
1e-5
);
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
1e-5
,
""
);
}
}
}
}
...
@@ -1176,11 +1054,7 @@ TEST_P(Bitwise_xor, Mat)
...
@@ -1176,11 +1054,7 @@ TEST_P(Bitwise_xor, Mat)
cv
::
bitwise_xor
(
mat1_roi
,
mat2_roi
,
dst_roi
);
cv
::
bitwise_xor
(
mat1_roi
,
mat2_roi
,
dst_roi
);
cv
::
ocl
::
bitwise_xor
(
gmat1
,
gmat2
,
gdst
);
cv
::
ocl
::
bitwise_xor
(
gmat1
,
gmat2
,
gdst
);
Near
(
0
);
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
0.0
,
""
);
}
}
}
}
...
@@ -1192,13 +1066,10 @@ TEST_P(Bitwise_xor, Mat_Mask)
...
@@ -1192,13 +1066,10 @@ TEST_P(Bitwise_xor, Mat_Mask)
cv
::
bitwise_xor
(
mat1_roi
,
mat2_roi
,
dst_roi
,
mask_roi
);
cv
::
bitwise_xor
(
mat1_roi
,
mat2_roi
,
dst_roi
,
mask_roi
);
cv
::
ocl
::
bitwise_xor
(
gmat1
,
gmat2
,
gdst
,
gmask
);
cv
::
ocl
::
bitwise_xor
(
gmat1
,
gmat2
,
gdst
,
gmask
);
Near
(
0
);
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
0.0
,
""
);
}
}
}
}
TEST_P
(
Bitwise_xor
,
Scalar
)
TEST_P
(
Bitwise_xor
,
Scalar
)
{
{
for
(
int
j
=
0
;
j
<
LOOP_TIMES
;
j
++
)
for
(
int
j
=
0
;
j
<
LOOP_TIMES
;
j
++
)
...
@@ -1207,11 +1078,7 @@ TEST_P(Bitwise_xor, Scalar)
...
@@ -1207,11 +1078,7 @@ TEST_P(Bitwise_xor, Scalar)
cv
::
bitwise_xor
(
mat1_roi
,
val
,
dst_roi
);
cv
::
bitwise_xor
(
mat1_roi
,
val
,
dst_roi
);
cv
::
ocl
::
bitwise_xor
(
gmat1
,
val
,
gdst
);
cv
::
ocl
::
bitwise_xor
(
gmat1
,
val
,
gdst
);
Near
(
1e-5
);
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
1e-5
,
""
);
}
}
}
}
...
@@ -1223,11 +1090,7 @@ TEST_P(Bitwise_xor, Scalar_Mask)
...
@@ -1223,11 +1090,7 @@ TEST_P(Bitwise_xor, Scalar_Mask)
cv
::
bitwise_xor
(
mat1_roi
,
val
,
dst_roi
,
mask_roi
);
cv
::
bitwise_xor
(
mat1_roi
,
val
,
dst_roi
,
mask_roi
);
cv
::
ocl
::
bitwise_xor
(
gmat1
,
val
,
gdst
,
gmask
);
cv
::
ocl
::
bitwise_xor
(
gmat1
,
val
,
gdst
,
gmask
);
Near
(
1e-5
);
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
1e-5
,
""
);
}
}
}
}
...
@@ -1244,11 +1107,7 @@ TEST_P(Bitwise_not, Mat)
...
@@ -1244,11 +1107,7 @@ TEST_P(Bitwise_not, Mat)
cv
::
bitwise_not
(
mat1_roi
,
dst_roi
);
cv
::
bitwise_not
(
mat1_roi
,
dst_roi
);
cv
::
ocl
::
bitwise_not
(
gmat1
,
gdst
);
cv
::
ocl
::
bitwise_not
(
gmat1
,
gdst
);
Near
(
0
);
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
0.0
,
""
);
}
}
}
}
...
@@ -1277,11 +1136,7 @@ TEST_P(Compare, Mat)
...
@@ -1277,11 +1136,7 @@ TEST_P(Compare, Mat)
cv
::
compare
(
mat1_roi
,
mat2_roi
,
dst_roi
,
cmp_codes
[
i
]);
cv
::
compare
(
mat1_roi
,
mat2_roi
,
dst_roi
,
cmp_codes
[
i
]);
cv
::
ocl
::
compare
(
gmat1
,
gmat2
,
gdst
,
cmp_codes
[
i
]);
cv
::
ocl
::
compare
(
gmat1
,
gmat2
,
gdst
,
cmp_codes
[
i
]);
Near
(
0
);
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
0.0
,
""
);
}
}
}
}
...
@@ -1303,11 +1158,7 @@ TEST_P(Pow, Mat)
...
@@ -1303,11 +1158,7 @@ TEST_P(Pow, Mat)
double
p
=
4.5
;
double
p
=
4.5
;
cv
::
pow
(
mat1_roi
,
p
,
dst_roi
);
cv
::
pow
(
mat1_roi
,
p
,
dst_roi
);
cv
::
ocl
::
pow
(
gmat1
,
p
,
gdst
);
cv
::
ocl
::
pow
(
gmat1
,
p
,
gdst
);
Near
(
1
);
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
1
,
""
);
}
}
}
}
...
@@ -1344,7 +1195,7 @@ TEST_P(MagnitudeSqr, Mat)
...
@@ -1344,7 +1195,7 @@ TEST_P(MagnitudeSqr, Mat)
cv
::
Mat
cpu_dst
;
cv
::
Mat
cpu_dst
;
cldst
.
download
(
cpu_dst
);
cldst
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
1
,
""
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
1
);
}
}
}
}
...
@@ -1365,18 +1216,13 @@ TEST_P(AddWeighted, Mat)
...
@@ -1365,18 +1216,13 @@ TEST_P(AddWeighted, Mat)
cv
::
ocl
::
addWeighted
(
gmat1
,
alpha
,
gmat2
,
beta
,
gama
,
gdst
);
cv
::
ocl
::
addWeighted
(
gmat1
,
alpha
,
gmat2
,
beta
,
gama
,
gdst
);
Near
(
1e-5
);
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
1e-5
,
""
);
}
}
}
}
//********test****************
//********test****************
INSTANTIATE_TEST_CASE_P
(
Arithm
,
Lut
,
Combine
(
INSTANTIATE_TEST_CASE_P
(
Arithm
,
Lut
,
Combine
(
...
...
modules/ocl/test/test_blend.cpp
View file @
b6313951
...
@@ -109,7 +109,7 @@ TEST_P(Blend, Accuracy)
...
@@ -109,7 +109,7 @@ TEST_P(Blend, Accuracy)
else
else
blendLinearGold
<
float
>
(
img1
,
img2
,
weights1
,
weights2
,
result_gold
);
blendLinearGold
<
float
>
(
img1
,
img2
,
weights1
,
weights2
,
result_gold
);
EXPECT_MAT_NEAR
(
result_gold
,
result
,
CV_MAT_DEPTH
(
type
)
==
CV_8U
?
1.
f
:
1e-5
f
,
0
);
EXPECT_MAT_NEAR
(
result_gold
,
result
,
CV_MAT_DEPTH
(
type
)
==
CV_8U
?
1.
f
:
1e-5
f
);
}
}
INSTANTIATE_TEST_CASE_P
(
GPU_ImgProc
,
Blend
,
Combine
(
INSTANTIATE_TEST_CASE_P
(
GPU_ImgProc
,
Blend
,
Combine
(
...
...
modules/ocl/test/test_calib3d.cpp
View file @
b6313951
...
@@ -129,7 +129,7 @@ TEST_P(StereoMatchBP, Regression)
...
@@ -129,7 +129,7 @@ TEST_P(StereoMatchBP, Regression)
bp
(
d_left
,
d_right
,
d_disp
);
bp
(
d_left
,
d_right
,
d_disp
);
d_disp
.
download
(
disp
);
d_disp
.
download
(
disp
);
disp
.
convertTo
(
disp
,
disp_gold
.
depth
());
disp
.
convertTo
(
disp
,
disp_gold
.
depth
());
EXPECT_MAT_NEAR
(
disp_gold
,
disp
,
0.0
,
""
);
EXPECT_MAT_NEAR
(
disp_gold
,
disp
,
0.0
);
}
}
INSTANTIATE_TEST_CASE_P
(
OCL_Calib3D
,
StereoMatchBP
,
testing
::
Combine
(
testing
::
Values
(
64
),
INSTANTIATE_TEST_CASE_P
(
OCL_Calib3D
,
StereoMatchBP
,
testing
::
Combine
(
testing
::
Values
(
64
),
testing
::
Values
(
8
),
testing
::
Values
(
2
),
testing
::
Values
(
25.0
f
),
testing
::
Values
(
8
),
testing
::
Values
(
2
),
testing
::
Values
(
25.0
f
),
...
...
modules/ocl/test/test_color.cpp
View file @
b6313951
...
@@ -100,7 +100,7 @@ PARAM_TEST_CASE(CvtColor, cv::Size, MatDepth)
...
@@ -100,7 +100,7 @@ PARAM_TEST_CASE(CvtColor, cv::Size, MatDepth)
cv::cvtColor(src, dst_gold, CVTCODE(name));\
cv::cvtColor(src, dst_gold, CVTCODE(name));\
cv::Mat dst_mat;\
cv::Mat dst_mat;\
dst.download(dst_mat);\
dst.download(dst_mat);\
EXPECT_MAT_NEAR(dst_gold, dst_mat, 1e-5
, ""
);\
EXPECT_MAT_NEAR(dst_gold, dst_mat, 1e-5);\
}
}
//add new ones here using macro
//add new ones here using macro
...
@@ -141,7 +141,7 @@ TEST_P(CvtColor_Gray2RGB, Accuracy)
...
@@ -141,7 +141,7 @@ TEST_P(CvtColor_Gray2RGB, Accuracy)
cv
::
cvtColor
(
src
,
dst_gold
,
code
);
cv
::
cvtColor
(
src
,
dst_gold
,
code
);
cv
::
Mat
dst_mat
;
cv
::
Mat
dst_mat
;
dst
.
download
(
dst_mat
);
dst
.
download
(
dst_mat
);
EXPECT_MAT_NEAR
(
dst_gold
,
dst_mat
,
1e-5
,
""
);
EXPECT_MAT_NEAR
(
dst_gold
,
dst_mat
,
1e-5
);
}
}
...
@@ -171,7 +171,7 @@ TEST_P(CvtColor_YUV420, Accuracy)
...
@@ -171,7 +171,7 @@ TEST_P(CvtColor_YUV420, Accuracy)
cv
::
Mat
dst_mat
;
cv
::
Mat
dst_mat
;
dst
.
download
(
dst_mat
);
dst
.
download
(
dst_mat
);
MAT_DIFF
(
dst_mat
,
dst_gold
);
MAT_DIFF
(
dst_mat
,
dst_gold
);
EXPECT_MAT_NEAR
(
dst_gold
,
dst_mat
,
1e-5
,
""
);
EXPECT_MAT_NEAR
(
dst_gold
,
dst_mat
,
1e-5
);
}
}
INSTANTIATE_TEST_CASE_P
(
OCL_ImgProc
,
CvtColor
,
testing
::
Combine
(
INSTANTIATE_TEST_CASE_P
(
OCL_ImgProc
,
CvtColor
,
testing
::
Combine
(
...
...
modules/ocl/test/test_filters.cpp
View file @
b6313951
...
@@ -127,7 +127,7 @@ PARAM_TEST_CASE(FilterTestBase,
...
@@ -127,7 +127,7 @@ PARAM_TEST_CASE(FilterTestBase,
{
{
cv
::
Mat
cpu_dst
;
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
threshold
,
""
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
threshold
);
}
}
};
};
...
...
modules/ocl/test/test_hog.cpp
View file @
b6313951
...
@@ -240,8 +240,7 @@ TEST_P(HOG, Detect)
...
@@ -240,8 +240,7 @@ TEST_P(HOG, Detect)
}
}
}
}
char
s
[
100
]
=
{
0
};
EXPECT_MAT_NEAR
(
cv
::
Mat
(
d_comp
),
cv
::
Mat
(
comp
),
3
);
EXPECT_MAT_NEAR
(
cv
::
Mat
(
d_comp
),
cv
::
Mat
(
comp
),
3
,
s
);
}
}
...
...
modules/ocl/test/test_imgproc.cpp
View file @
b6313951
...
@@ -442,6 +442,13 @@ PARAM_TEST_CASE(ImgprocTestBase, MatType, MatType, MatType, MatType, MatType, bo
...
@@ -442,6 +442,13 @@ PARAM_TEST_CASE(ImgprocTestBase, MatType, MatType, MatType, MatType, MatType, bo
clmask_roi
=
clmask
(
Rect
(
maskx
,
masky
,
roicols
,
roirows
));
clmask_roi
=
clmask
(
Rect
(
maskx
,
masky
,
roicols
,
roirows
));
}
}
}
}
void
Near
(
double
threshold
)
{
cv
::
Mat
cpu_cldst
;
cldst
.
download
(
cpu_cldst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_cldst
,
threshold
);
}
};
};
////////////////////////////////equalizeHist//////////////////////////////////////////
////////////////////////////////equalizeHist//////////////////////////////////////////
...
@@ -461,11 +468,7 @@ TEST_P(equalizeHist, Mat)
...
@@ -461,11 +468,7 @@ TEST_P(equalizeHist, Mat)
random_roi
();
random_roi
();
cv
::
equalizeHist
(
mat1_roi
,
dst_roi
);
cv
::
equalizeHist
(
mat1_roi
,
dst_roi
);
cv
::
ocl
::
equalizeHist
(
clmat1_roi
,
cldst_roi
);
cv
::
ocl
::
equalizeHist
(
clmat1_roi
,
cldst_roi
);
cv
::
Mat
cpu_cldst
;
Near
(
1.1
);
cldst
.
download
(
cpu_cldst
);
char
sss
[
1024
];
sprintf
(
sss
,
"roicols=%d,roirows=%d,src1x=%d,src1y=%d,dstx=%d,dsty=%d,dst1x=%d,dst1y=%d,maskx=%d,masky=%d,src2x=%d,src2y=%d"
,
roicols
,
roirows
,
src1x
,
src1y
,
dstx
,
dsty
,
dst1x
,
dst1y
,
maskx
,
masky
,
src2x
,
src2y
);
EXPECT_MAT_NEAR
(
dst
,
cpu_cldst
,
1.1
,
sss
);
}
}
}
}
}
}
...
@@ -485,7 +488,7 @@ TEST_P(bilateralFilter, Mat)
...
@@ -485,7 +488,7 @@ TEST_P(bilateralFilter, Mat)
int
d
=
2
*
radius
+
1
;
int
d
=
2
*
radius
+
1
;
double
sigmaspace
=
20.0
;
double
sigmaspace
=
20.0
;
int
bordertype
[]
=
{
cv
::
BORDER_CONSTANT
,
cv
::
BORDER_REPLICATE
,
cv
::
BORDER_REFLECT
,
cv
::
BORDER_WRAP
,
cv
::
BORDER_REFLECT_101
};
int
bordertype
[]
=
{
cv
::
BORDER_CONSTANT
,
cv
::
BORDER_REPLICATE
,
cv
::
BORDER_REFLECT
,
cv
::
BORDER_WRAP
,
cv
::
BORDER_REFLECT_101
};
const
char
*
borderstr
[]
=
{
"BORDER_CONSTANT"
,
"BORDER_REPLICATE"
,
"BORDER_REFLECT"
,
"BORDER_WRAP"
,
"BORDER_REFLECT_101"
};
//
const char *borderstr[] = {"BORDER_CONSTANT", "BORDER_REPLICATE", "BORDER_REFLECT", "BORDER_WRAP", "BORDER_REFLECT_101"};
if
(
mat1
.
depth
()
!=
CV_8U
||
mat1
.
type
()
!=
dst
.
type
())
if
(
mat1
.
depth
()
!=
CV_8U
||
mat1
.
type
()
!=
dst
.
type
())
{
{
...
@@ -514,25 +517,7 @@ TEST_P(bilateralFilter, Mat)
...
@@ -514,25 +517,7 @@ TEST_P(bilateralFilter, Mat)
cv
::
bilateralFilter
(
mat1_roi
,
dst_roi
,
d
,
sigmacolor
,
sigmaspace
,
bordertype
[
i
]
|
cv
::
BORDER_ISOLATED
);
cv
::
bilateralFilter
(
mat1_roi
,
dst_roi
,
d
,
sigmacolor
,
sigmaspace
,
bordertype
[
i
]
|
cv
::
BORDER_ISOLATED
);
cv
::
ocl
::
bilateralFilter
(
clmat1_roi
,
cldst_roi
,
d
,
sigmacolor
,
sigmaspace
,
bordertype
[
i
]
|
cv
::
BORDER_ISOLATED
);
cv
::
ocl
::
bilateralFilter
(
clmat1_roi
,
cldst_roi
,
d
,
sigmacolor
,
sigmaspace
,
bordertype
[
i
]
|
cv
::
BORDER_ISOLATED
);
Near
(
1.
);
cv
::
Mat
cpu_cldst
;
cldst
.
download
(
cpu_cldst
);
char
sss
[
1024
];
sprintf
(
sss
,
"roicols=%d,roirows=%d,src1x=%d,src1y=%d,dstx=%d,dsty=%d,radius=%d,boredertype=%s"
,
roicols
,
roirows
,
src1x
,
src1y
,
dstx
,
dsty
,
radius
,
borderstr
[
i
]);
//for(int i=0;i<dst.rows;i++)
//{
// for(int j=0;j<dst.cols*dst.channels();j++)
// {
// if(dst.at<uchar>(i,j)!=cpu_cldst.at<uchar>(i,j))
// cout<< i <<" "<< j <<" "<< (int)dst.at<uchar>(i,j)<<" "<< (int)cpu_cldst.at<uchar>(i,j)<<" ";
// }
// cout<<endl;
//}
EXPECT_MAT_NEAR
(
dst
,
cpu_cldst
,
1.0
,
sss
);
}
}
}
}
}
}
...
@@ -546,7 +531,7 @@ struct CopyMakeBorder : ImgprocTestBase {};
...
@@ -546,7 +531,7 @@ struct CopyMakeBorder : ImgprocTestBase {};
TEST_P
(
CopyMakeBorder
,
Mat
)
TEST_P
(
CopyMakeBorder
,
Mat
)
{
{
int
bordertype
[]
=
{
cv
::
BORDER_CONSTANT
,
cv
::
BORDER_REPLICATE
,
cv
::
BORDER_REFLECT
,
cv
::
BORDER_WRAP
,
cv
::
BORDER_REFLECT_101
};
int
bordertype
[]
=
{
cv
::
BORDER_CONSTANT
,
cv
::
BORDER_REPLICATE
,
cv
::
BORDER_REFLECT
,
cv
::
BORDER_WRAP
,
cv
::
BORDER_REFLECT_101
};
const
char
*
borderstr
[]
=
{
"BORDER_CONSTANT"
,
"BORDER_REPLICATE"
,
"BORDER_REFLECT"
,
"BORDER_WRAP"
,
"BORDER_REFLECT_101"
};
//
const char *borderstr[] = {"BORDER_CONSTANT", "BORDER_REPLICATE", "BORDER_REFLECT", "BORDER_WRAP", "BORDER_REFLECT_101"};
cv
::
RNG
&
rng
=
TS
::
ptr
()
->
get_rng
();
cv
::
RNG
&
rng
=
TS
::
ptr
()
->
get_rng
();
int
top
=
rng
.
uniform
(
0
,
10
);
int
top
=
rng
.
uniform
(
0
,
10
);
int
bottom
=
rng
.
uniform
(
0
,
10
);
int
bottom
=
rng
.
uniform
(
0
,
10
);
...
@@ -584,24 +569,12 @@ TEST_P(CopyMakeBorder, Mat)
...
@@ -584,24 +569,12 @@ TEST_P(CopyMakeBorder, Mat)
cv
::
Mat
cpu_cldst
;
cv
::
Mat
cpu_cldst
;
#ifndef RANDOMROI
#ifndef RANDOMROI
cldst_roi
.
download
(
cpu_cldst
);
cldst_roi
.
download
(
cpu_cldst
);
EXPECT_MAT_NEAR
(
dst_roi
,
cpu_cldst
,
0.0
);
#else
#else
cldst
.
download
(
cpu_cldst
);
cldst
.
download
(
cpu_cldst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_cldst
,
0.0
);
#endif
#endif
char
sss
[
1024
];
sprintf
(
sss
,
"roicols=%d,roirows=%d,src1x=%d,src1y=%d,dstx=%d,dsty=%d,dst1x=%d,dst1y=%d,top=%d,bottom=%d,left=%d,right=%d, bordertype=%s"
,
roicols
,
roirows
,
src1x
,
src1y
,
dstx
,
dsty
,
dst1x
,
dst1y
,
top
,
bottom
,
left
,
right
,
borderstr
[
i
]);
#ifndef RANDOMROI
EXPECT_MAT_NEAR
(
dst_roi
,
cpu_cldst
,
0.0
,
sss
);
#else
//for(int i=0;i<dst.rows;i++)
//{
//for(int j=0;j<dst.cols;j++)
//{
// cout<< (int)dst.at<uchar>(i,j)<<" ";
//}
//cout<<endl;
//}
EXPECT_MAT_NEAR
(
dst
,
cpu_cldst
,
0.0
,
sss
);
#endif
}
}
}
}
}
}
...
@@ -624,14 +597,7 @@ TEST_P(cornerMinEigenVal, Mat)
...
@@ -624,14 +597,7 @@ TEST_P(cornerMinEigenVal, Mat)
int
borderType
=
cv
::
BORDER_REFLECT
;
int
borderType
=
cv
::
BORDER_REFLECT
;
cv
::
cornerMinEigenVal
(
mat1_roi
,
dst_roi
,
blockSize
,
apertureSize
,
borderType
);
cv
::
cornerMinEigenVal
(
mat1_roi
,
dst_roi
,
blockSize
,
apertureSize
,
borderType
);
cv
::
ocl
::
cornerMinEigenVal
(
clmat1_roi
,
cldst_roi
,
blockSize
,
apertureSize
,
borderType
);
cv
::
ocl
::
cornerMinEigenVal
(
clmat1_roi
,
cldst_roi
,
blockSize
,
apertureSize
,
borderType
);
Near
(
1.
);
cv
::
Mat
cpu_cldst
;
cldst
.
download
(
cpu_cldst
);
char
sss
[
1024
];
sprintf
(
sss
,
"roicols=%d,roirows=%d,src1x=%d,src1y=%d,dstx=%d,dsty=%d,dst1x=%d,dst1y=%d,maskx=%d,masky=%d,src2x=%d,src2y=%d"
,
roicols
,
roirows
,
src1x
,
src1y
,
dstx
,
dsty
,
dst1x
,
dst1y
,
maskx
,
masky
,
src2x
,
src2y
);
EXPECT_MAT_NEAR
(
dst
,
cpu_cldst
,
1
,
sss
);
}
}
}
}
...
@@ -654,13 +620,7 @@ TEST_P(cornerHarris, Mat)
...
@@ -654,13 +620,7 @@ TEST_P(cornerHarris, Mat)
int
borderType
=
cv
::
BORDER_REFLECT
;
int
borderType
=
cv
::
BORDER_REFLECT
;
cv
::
cornerHarris
(
mat1_roi
,
dst_roi
,
blockSize
,
apertureSize
,
k
,
borderType
);
cv
::
cornerHarris
(
mat1_roi
,
dst_roi
,
blockSize
,
apertureSize
,
k
,
borderType
);
cv
::
ocl
::
cornerHarris
(
clmat1_roi
,
cldst_roi
,
blockSize
,
apertureSize
,
k
,
borderType
);
cv
::
ocl
::
cornerHarris
(
clmat1_roi
,
cldst_roi
,
blockSize
,
apertureSize
,
k
,
borderType
);
cv
::
Mat
cpu_cldst
;
Near
(
1.
);
cldst
.
download
(
cpu_cldst
);
char
sss
[
1024
];
sprintf
(
sss
,
"roicols=%d,roirows=%d,src1x=%d,src1y=%d,dstx=%d,dsty=%d,dst1x=%d,dst1y=%d,maskx=%d,masky=%d,src2x=%d,src2y=%d"
,
roicols
,
roirows
,
src1x
,
src1y
,
dstx
,
dsty
,
dst1x
,
dst1y
,
maskx
,
masky
,
src2x
,
src2y
);
EXPECT_MAT_NEAR
(
dst
,
cpu_cldst
,
1
,
sss
);
}
}
}
}
...
@@ -677,15 +637,11 @@ TEST_P(integral, Mat)
...
@@ -677,15 +637,11 @@ TEST_P(integral, Mat)
cv
::
ocl
::
integral
(
clmat1_roi
,
cldst_roi
,
cldst1_roi
);
cv
::
ocl
::
integral
(
clmat1_roi
,
cldst_roi
,
cldst1_roi
);
cv
::
integral
(
mat1_roi
,
dst_roi
,
dst1_roi
);
cv
::
integral
(
mat1_roi
,
dst_roi
,
dst1_roi
);
Near
(
0
);
cv
::
Mat
cpu_cldst
,
cpu_cldst1
;
cv
::
Mat
cpu_cldst1
;
cldst
.
download
(
cpu_cldst
);
cldst1
.
download
(
cpu_cldst1
);
cldst1
.
download
(
cpu_cldst1
);
char
sss
[
1024
];
EXPECT_MAT_NEAR
(
dst1
,
cpu_cldst1
,
0.0
);
sprintf
(
sss
,
"roicols=%d,roirows=%d,src1x=%d,src1y=%d,dstx=%d,dsty=%d,dst1x=%d,dst1y=%d,maskx=%d,masky=%d,src2x=%d,src2y=%d"
,
roicols
,
roirows
,
src1x
,
src1y
,
dstx
,
dsty
,
dst1x
,
dst1y
,
maskx
,
masky
,
src2x
,
src2y
);
EXPECT_MAT_NEAR
(
dst
,
cpu_cldst
,
0.0
,
sss
);
EXPECT_MAT_NEAR
(
dst1
,
cpu_cldst1
,
0.0
,
sss
);
}
}
}
}
...
@@ -798,10 +754,7 @@ TEST_P(WarpAffine, Mat)
...
@@ -798,10 +754,7 @@ TEST_P(WarpAffine, Mat)
cv
::
Mat
cpu_dst
;
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
gdst_whole
.
download
(
cpu_dst
);
char
sss
[
1024
];
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
1.0
);
sprintf
(
sss
,
"src_roicols=%d,src_roirows=%d,dst_roicols=%d,dst_roirows=%d,src1x =%d,src1y=%d,dstx=%d,dsty=%d"
,
src_roicols
,
src_roirows
,
dst_roicols
,
dst_roirows
,
src1x
,
src1y
,
dstx
,
dsty
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
1.0
,
sss
);
}
}
}
}
...
@@ -830,10 +783,7 @@ TEST_P(WarpPerspective, Mat)
...
@@ -830,10 +783,7 @@ TEST_P(WarpPerspective, Mat)
cv
::
Mat
cpu_dst
;
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
gdst_whole
.
download
(
cpu_dst
);
char
sss
[
1024
];
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
1.0
);
sprintf
(
sss
,
"src_roicols=%d,src_roirows=%d,dst_roicols=%d,dst_roirows=%d,src1x =%d,src1y=%d,dstx=%d,dsty=%d"
,
src_roicols
,
src_roirows
,
dst_roicols
,
dst_roirows
,
src1x
,
src1y
,
dstx
,
dsty
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
1.0
,
sss
);
}
}
}
}
...
@@ -994,7 +944,7 @@ TEST_P(Remap, Mat)
...
@@ -994,7 +944,7 @@ TEST_P(Remap, Mat)
return
;
return
;
}
}
int
bordertype
[]
=
{
cv
::
BORDER_CONSTANT
,
cv
::
BORDER_REPLICATE
/*,BORDER_REFLECT,BORDER_WRAP,BORDER_REFLECT_101*/
};
int
bordertype
[]
=
{
cv
::
BORDER_CONSTANT
,
cv
::
BORDER_REPLICATE
/*,BORDER_REFLECT,BORDER_WRAP,BORDER_REFLECT_101*/
};
const
char
*
borderstr
[]
=
{
"BORDER_CONSTANT"
,
"BORDER_REPLICATE"
/*, "BORDER_REFLECT","BORDER_WRAP","BORDER_REFLECT_101"*/
};
//
const char *borderstr[] = {"BORDER_CONSTANT", "BORDER_REPLICATE"/*, "BORDER_REFLECT","BORDER_WRAP","BORDER_REFLECT_101"*/};
// for(int i = 0; i < sizeof(bordertype)/sizeof(int); i++)
// for(int i = 0; i < sizeof(bordertype)/sizeof(int); i++)
for
(
int
j
=
0
;
j
<
LOOP_TIMES
;
j
++
)
for
(
int
j
=
0
;
j
<
LOOP_TIMES
;
j
++
)
{
{
...
@@ -1004,13 +954,9 @@ TEST_P(Remap, Mat)
...
@@ -1004,13 +954,9 @@ TEST_P(Remap, Mat)
cv
::
Mat
cpu_dst
;
cv
::
Mat
cpu_dst
;
gdst
.
download
(
cpu_dst
);
gdst
.
download
(
cpu_dst
);
char
sss
[
1024
];
sprintf
(
sss
,
"src_roicols=%d,src_roirows=%d,dst_roicols=%d,dst_roirows=%d,src1x =%d,src1y=%d,dstx=%d,dsty=%d bordertype=%s"
,
src_roicols
,
src_roirows
,
dst_roicols
,
dst_roirows
,
srcx
,
srcy
,
dstx
,
dsty
,
borderstr
[
0
]);
if
(
interpolation
==
0
)
if
(
interpolation
==
0
)
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
1.0
,
sss
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
1.0
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
2.0
,
sss
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
2.0
);
}
}
}
}
...
@@ -1134,10 +1080,7 @@ TEST_P(Resize, Mat)
...
@@ -1134,10 +1080,7 @@ TEST_P(Resize, Mat)
cv
::
Mat
cpu_dst
;
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
gdst_whole
.
download
(
cpu_dst
);
char
sss
[
1024
];
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
1.0
);
sprintf
(
sss
,
"src_roicols=%d,src_roirows=%d,dst_roicols=%d,dst_roirows=%d,src1x =%d,src1y=%d,dstx=%d,dsty=%d"
,
src_roicols
,
src_roirows
,
dst_roicols
,
dst_roirows
,
src1x
,
src1y
,
dstx
,
dsty
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
1.0
,
sss
);
}
}
}
}
...
@@ -1231,12 +1174,7 @@ TEST_P(Threshold, Mat)
...
@@ -1231,12 +1174,7 @@ TEST_P(Threshold, Mat)
cv
::
Mat
cpu_dst
;
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
1
);
//EXPECT_MAT_NEAR(dst, cpu_dst, 1e-5)
char
sss
[
1024
];
sprintf
(
sss
,
"roicols=%d,roirows=%d,src1x =%d,src1y=%d,dstx=%d,dsty=%d"
,
roicols
,
roirows
,
src1x
,
src1y
,
dstx
,
dsty
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
1
,
sss
);
}
}
}
}
...
@@ -1342,11 +1280,7 @@ TEST_P(meanShiftFiltering, Mat)
...
@@ -1342,11 +1280,7 @@ TEST_P(meanShiftFiltering, Mat)
cv
::
ocl
::
meanShiftFiltering
(
gsrc_roi
,
gdst_roi
,
sp
,
sr
,
crit
);
cv
::
ocl
::
meanShiftFiltering
(
gsrc_roi
,
gdst_roi
,
sp
,
sr
,
crit
);
gdst
.
download
(
cpu_gdst
);
gdst
.
download
(
cpu_gdst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_gdst
,
0.0
);
char
sss
[
1024
];
sprintf
(
sss
,
"roicols=%d,roirows=%d,srcx=%d,srcy=%d,dstx=%d,dsty=%d
\n
"
,
roicols
,
roirows
,
srcx
,
srcy
,
dstx
,
dsty
);
EXPECT_MAT_NEAR
(
dst
,
cpu_gdst
,
0.0
,
sss
);
}
}
}
}
...
@@ -1368,11 +1302,8 @@ TEST_P(meanShiftProc, Mat)
...
@@ -1368,11 +1302,8 @@ TEST_P(meanShiftProc, Mat)
gdst
.
download
(
cpu_gdst
);
gdst
.
download
(
cpu_gdst
);
gdstCoor
.
download
(
cpu_gdstCoor
);
gdstCoor
.
download
(
cpu_gdstCoor
);
EXPECT_MAT_NEAR
(
dst
,
cpu_gdst
,
0.0
);
char
sss
[
1024
];
EXPECT_MAT_NEAR
(
dstCoor
,
cpu_gdstCoor
,
0.0
);
sprintf
(
sss
,
"roicols=%d,roirows=%d,srcx=%d,srcy=%d,dstx=%d,dsty=%d
\n
"
,
roicols
,
roirows
,
srcx
,
srcy
,
dstx
,
dsty
);
EXPECT_MAT_NEAR
(
dst
,
cpu_gdst
,
0.0
,
sss
);
EXPECT_MAT_NEAR
(
dstCoor
,
cpu_gdstCoor
,
0.0
,
sss
);
}
}
}
}
...
@@ -1459,10 +1390,7 @@ TEST_P(calcHist, Mat)
...
@@ -1459,10 +1390,7 @@ TEST_P(calcHist, Mat)
cv
::
ocl
::
calcHist
(
gsrc_roi
,
gdst_hist
);
cv
::
ocl
::
calcHist
(
gsrc_roi
,
gdst_hist
);
gdst_hist
.
download
(
cpu_hist
);
gdst_hist
.
download
(
cpu_hist
);
EXPECT_MAT_NEAR
(
dst_hist
,
cpu_hist
,
0.0
);
char
sss
[
1024
];
sprintf
(
sss
,
"roicols=%d,roirows=%d,srcx=%d,srcy=%d
\n
"
,
roicols
,
roirows
,
srcx
,
srcy
);
EXPECT_MAT_NEAR
(
dst_hist
,
cpu_hist
,
0.0
,
sss
);
}
}
}
}
...
@@ -1599,11 +1527,7 @@ TEST_P(Convolve, Mat)
...
@@ -1599,11 +1527,7 @@ TEST_P(Convolve, Mat)
cv
::
Mat
cpu_dst
;
cv
::
Mat
cpu_dst
;
gdst_whole
.
download
(
cpu_dst
);
gdst_whole
.
download
(
cpu_dst
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
.1
);
char
sss
[
1024
];
sprintf
(
sss
,
"roicols=%d,roirows=%d,src1x=%d,src1y=%d,dstx=%d,dsty=%d,src2x=%d,src2y=%d"
,
roicols
,
roirows
,
src1x
,
src1y
,
dstx
,
dsty
,
src2x
,
src2y
);
EXPECT_MAT_NEAR
(
dst
,
cpu_dst
,
1e-1
,
sss
);
}
}
}
}
...
...
modules/ocl/test/utility.hpp
View file @
b6313951
...
@@ -76,20 +76,20 @@ double checkSimilarity(const cv::Mat &m1, const cv::Mat &m2);
...
@@ -76,20 +76,20 @@ double checkSimilarity(const cv::Mat &m1, const cv::Mat &m2);
EXPECT_LE(checkNorm(cv::Mat(mat)), eps) \
EXPECT_LE(checkNorm(cv::Mat(mat)), eps) \
}
}
/*
#define EXPECT_MAT_NEAR(mat1, mat2, eps) \
#define EXPECT_MAT_NEAR(mat1, mat2, eps) \
{ \
{ \
ASSERT_EQ(mat1.type(), mat2.type()); \
ASSERT_EQ(mat1.type(), mat2.type()); \
ASSERT_EQ(mat1.size(), mat2.size()); \
ASSERT_EQ(mat1.size(), mat2.size()); \
EXPECT_LE(checkNorm(cv::Mat(mat1), cv::Mat(mat2)), eps); \
EXPECT_LE(checkNorm(cv::Mat(mat1), cv::Mat(mat2)), eps); \
}
*/
}
/*
#define EXPECT_MAT_NEAR(mat1, mat2, eps,s) \
#define EXPECT_MAT_NEAR(mat1, mat2, eps,s) \
{ \
{ \
ASSERT_EQ(mat1.type(), mat2.type()); \
ASSERT_EQ(mat1.type(), mat2.type()); \
ASSERT_EQ(mat1.size(), mat2.size()); \
ASSERT_EQ(mat1.size(), mat2.size()); \
EXPECT_LE(checkNorm(cv::Mat(mat1), cv::Mat(mat2)), eps)<<s; \
EXPECT_LE(checkNorm(cv::Mat(mat1), cv::Mat(mat2)), eps)<<s; \
}
}
*/
#define EXPECT_MAT_SIMILAR(mat1, mat2, eps) \
#define EXPECT_MAT_SIMILAR(mat1, mat2, eps) \
{ \
{ \
ASSERT_EQ(mat1.type(), mat2.type()); \
ASSERT_EQ(mat1.type(), mat2.type()); \
...
...
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