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
5566d314
Commit
5566d314
authored
Dec 10, 2013
by
Ilya Lavrenov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more strict checks outside ROI
parent
9d87f9c9
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
43 additions
and
44 deletions
+43
-44
convert.cpp
modules/core/src/convert.cpp
+6
-4
test_arithm.cpp
modules/core/test/ocl/test_arithm.cpp
+4
-8
test_split_merge.cpp
modules/core/test/ocl/test_split_merge.cpp
+1
-2
test_color.cpp
modules/imgproc/test/ocl/test_color.cpp
+1
-2
test_imgproc.cpp
modules/imgproc/test/ocl/test_imgproc.cpp
+7
-21
test_warp.cpp
modules/imgproc/test/ocl/test_warp.cpp
+3
-6
ocl_test.hpp
modules/ts/include/opencv2/ts/ocl_test.hpp
+21
-1
No files found.
modules/core/src/convert.cpp
View file @
5566d314
...
...
@@ -1306,9 +1306,10 @@ namespace cv {
static
bool
ocl_LUT
(
InputArray
_src
,
InputArray
_lut
,
OutputArray
_dst
)
{
int
dcn
=
_dst
.
channels
(),
lcn
=
_lut
.
channels
(),
dtype
=
_dst
.
type
();
int
dtype
=
_dst
.
type
(),
lcn
=
_lut
.
channels
(),
dcn
=
CV_MAT_CN
(
dtype
),
ddepth
=
CV_MAT_DEPTH
(
dtype
);
bool
doubleSupport
=
ocl
::
Device
::
getDefault
().
doubleFPConfig
()
>
0
;
if
(
_src
.
dims
()
>
2
)
if
(
_src
.
dims
()
>
2
||
(
!
doubleSupport
&&
ddepth
==
CV_64F
)
)
return
false
;
UMat
src
=
_src
.
getUMat
(),
lut
=
_lut
.
getUMat
();
...
...
@@ -1316,8 +1317,9 @@ static bool ocl_LUT(InputArray _src, InputArray _lut, OutputArray _dst)
UMat
dst
=
_dst
.
getUMat
();
ocl
::
Kernel
k
(
"LUT"
,
ocl
::
core
::
lut_oclsrc
,
format
(
"-D dcn=%d -D lcn=%d -D srcT=%s -D dstT=%s"
,
dcn
,
lcn
,
ocl
::
typeToStr
(
src
.
depth
()),
ocl
::
typeToStr
(
dst
.
depth
())));
format
(
"-D dcn=%d -D lcn=%d -D srcT=%s -D dstT=%s%s"
,
dcn
,
lcn
,
ocl
::
typeToStr
(
src
.
depth
()),
ocl
::
typeToStr
(
ddepth
),
doubleSupport
?
" -D DOUBLE_SUPPORT"
:
""
));
k
.
args
(
ocl
::
KernelArg
::
ReadOnlyNoSize
(
src
),
ocl
::
KernelArg
::
ReadOnlyNoSize
(
lut
),
ocl
::
KernelArg
::
WriteOnly
(
dst
));
...
...
modules/core/test/ocl/test_arithm.cpp
View file @
5566d314
...
...
@@ -92,8 +92,7 @@ PARAM_TEST_CASE(Lut, MatDepth, MatDepth, Channels, bool, bool)
void
Near
(
double
threshold
=
0.
)
{
EXPECT_MAT_NEAR
(
dst
,
udst
,
threshold
);
EXPECT_MAT_NEAR
(
dst_roi
,
udst_roi
,
threshold
);
OCL_EXPECT_MATS_NEAR
(
dst
,
threshold
)
}
};
...
...
@@ -165,14 +164,12 @@ PARAM_TEST_CASE(ArithmTestBase, MatDepth, Channels, bool)
void
Near
(
double
threshold
=
0.
)
{
EXPECT_MAT_NEAR
(
dst1
,
udst1
,
threshold
);
EXPECT_MAT_NEAR
(
dst1_roi
,
udst1_roi
,
threshold
);
OCL_EXPECT_MATS_NEAR
(
dst1
,
threshold
)
}
void
Near1
(
double
threshold
=
0.
)
{
EXPECT_MAT_NEAR
(
dst2
,
udst2
,
threshold
);
EXPECT_MAT_NEAR
(
dst2_roi
,
udst2_roi
,
threshold
);
OCL_EXPECT_MATS_NEAR
(
dst2
,
threshold
)
}
};
...
...
@@ -532,8 +529,7 @@ OCL_TEST_P(Transpose, SquareInplace)
OCL_OFF
(
cv
::
transpose
(
src1_roi
,
src1_roi
));
OCL_ON
(
cv
::
transpose
(
usrc1_roi
,
usrc1_roi
));
EXPECT_MAT_NEAR
(
src1
,
usrc1
,
0.0
);
EXPECT_MAT_NEAR
(
src1_roi
,
usrc1_roi
,
0.0
);
OCL_EXPECT_MATS_NEAR
(
src1
,
0
)
}
}
...
...
modules/core/test/ocl/test_split_merge.cpp
View file @
5566d314
...
...
@@ -113,8 +113,7 @@ PARAM_TEST_CASE(MergeTestBase, MatDepth, Channels, bool)
void
Near
(
double
threshold
=
0.
)
{
EXPECT_MAT_NEAR
(
dst
,
udst
,
threshold
);
EXPECT_MAT_NEAR
(
dst_roi
,
udst_roi
,
threshold
);
OCL_EXPECT_MATS_NEAR
(
dst
,
threshold
);
}
};
...
...
modules/imgproc/test/ocl/test_color.cpp
View file @
5566d314
...
...
@@ -86,8 +86,7 @@ PARAM_TEST_CASE(CvtColor, MatDepth, bool)
void
Near
(
double
threshold
)
{
EXPECT_MAT_NEAR
(
dst_roi
,
udst_roi
,
threshold
);
EXPECT_MAT_NEAR
(
dst
,
udst
,
threshold
);
OCL_EXPECT_MATS_NEAR
(
dst
,
threshold
)
}
void
performTest
(
int
channelsIn
,
int
channelsOut
,
int
code
,
double
threshold
=
1e-3
)
...
...
modules/imgproc/test/ocl/test_imgproc.cpp
View file @
5566d314
...
...
@@ -97,15 +97,9 @@ PARAM_TEST_CASE(ImgprocTestBase, MatType,
void
Near
(
double
threshold
=
0.0
,
bool
relative
=
false
)
{
if
(
relative
)
{
EXPECT_MAT_NEAR_RELATIVE
(
dst
,
udst
,
threshold
);
EXPECT_MAT_NEAR_RELATIVE
(
dst_roi
,
udst_roi
,
threshold
);
}
OCL_EXPECT_MATS_NEAR_RELATIVE
(
dst
,
threshold
)
else
{
EXPECT_MAT_NEAR
(
dst
,
udst
,
threshold
);
EXPECT_MAT_NEAR
(
dst_roi
,
udst_roi
,
threshold
);
}
OCL_EXPECT_MATS_NEAR
(
dst
,
threshold
)
}
};
...
...
@@ -158,10 +152,9 @@ PARAM_TEST_CASE(CopyMakeBorder, MatDepth, // depth
UMAT_UPLOAD_OUTPUT_PARAMETER
(
dst
)
}
void
Near
(
double
threshold
=
0.0
)
void
Near
()
{
EXPECT_MAT_NEAR
(
dst
,
udst
,
threshold
);
EXPECT_MAT_NEAR
(
dst_roi
,
udst_roi
,
threshold
);
OCL_EXPECT_MATS_NEAR
(
dst
,
0
)
}
};
...
...
@@ -305,15 +298,9 @@ struct Integral :
void
Near2
(
double
threshold
=
0.0
,
bool
relative
=
false
)
{
if
(
relative
)
{
EXPECT_MAT_NEAR_RELATIVE
(
dst2
,
udst2
,
threshold
);
EXPECT_MAT_NEAR_RELATIVE
(
dst2_roi
,
udst2_roi
,
threshold
);
}
OCL_EXPECT_MATS_NEAR_RELATIVE
(
dst2
,
threshold
)
else
{
EXPECT_MAT_NEAR
(
dst2
,
udst2
,
threshold
);
EXPECT_MAT_NEAR
(
dst2_roi
,
udst2_roi
,
threshold
);
}
OCL_EXPECT_MATS_NEAR
(
dst2
,
threshold
)
}
};
...
...
@@ -412,8 +399,7 @@ PARAM_TEST_CASE(CLAHETest, Size, double, bool)
void
Near
(
double
threshold
=
0.0
)
{
EXPECT_MAT_NEAR
(
dst
,
udst
,
threshold
);
EXPECT_MAT_NEAR
(
dst_roi
,
udst_roi
,
threshold
);
OCL_EXPECT_MATS_NEAR
(
dst
,
threshold
)
}
};
...
...
modules/imgproc/test/ocl/test_warp.cpp
View file @
5566d314
...
...
@@ -104,8 +104,7 @@ PARAM_TEST_CASE(WarpTestBase, MatType, Interpolation, bool, bool)
void
Near
(
double
threshold
=
0.0
)
{
EXPECT_MAT_NEAR
(
dst
,
udst
,
threshold
);
EXPECT_MAT_NEAR
(
dst_roi
,
udst_roi
,
threshold
);
OCL_EXPECT_MATS_NEAR
(
dst
,
threshold
)
}
};
...
...
@@ -203,8 +202,7 @@ PARAM_TEST_CASE(Resize, MatType, double, double, Interpolation, bool)
void
Near
(
double
threshold
=
0.0
)
{
EXPECT_MAT_NEAR
(
dst_roi
,
udst_roi
,
threshold
);
EXPECT_MAT_NEAR
(
dst
,
udst
,
threshold
);
OCL_EXPECT_MATS_NEAR
(
dst
,
threshold
)
}
};
...
...
@@ -280,8 +278,7 @@ PARAM_TEST_CASE(Remap, MatDepth, Channels, std::pair<MatType, MatType>, BorderTy
void
Near
(
double
threshold
=
0.0
)
{
EXPECT_MAT_NEAR
(
dst
,
udst
,
threshold
);
EXPECT_MAT_NEAR
(
dst_roi
,
udst_roi
,
threshold
);
OCL_EXPECT_MATS_NEAR
(
dst
,
threshold
)
}
};
...
...
modules/ts/include/opencv2/ts/ocl_test.hpp
View file @
5566d314
...
...
@@ -110,6 +110,26 @@ extern int test_loop_times;
<< cv::format("Size: %d x %d", mat1.size().width, mat1.size().height) << std::endl; \
}
#define OCL_EXPECT_MATS_NEAR(name, eps) \
{ \
EXPECT_MAT_NEAR(name ## _roi, u ## name ## _roi, eps); \
int nextValue = rng.next(); \
RNG dataRng1(nextValue), dataRng2(nextValue); \
dataRng1.fill(name ## _roi, RNG::UNIFORM, Scalar::all(-MAX_VALUE), Scalar::all(MAX_VALUE)); \
dataRng2.fill(u ## name ## _roi, RNG::UNIFORM, Scalar::all(-MAX_VALUE), Scalar::all(MAX_VALUE)); \
EXPECT_MAT_NEAR(name, u ## name, 0
/*FLT_EPSILON*/
); \
}
#define OCL_EXPECT_MATS_NEAR_RELATIVE(name, eps) \
{ \
EXPECT_MAT_NEAR_RELATIVE(name ## _roi, u ## name ## _roi, eps); \
int nextValue = rng.next(); \
RNG dataRng1(nextValue), dataRng2(nextValue); \
dataRng1.fill(name ## _roi, RNG::UNIFORM, Scalar::all(-MAX_VALUE), Scalar::all(MAX_VALUE)); \
dataRng2.fill(u ## name ## _roi, RNG::UNIFORM, Scalar::all(-MAX_VALUE), Scalar::all(MAX_VALUE)); \
EXPECT_MAT_NEAR_RELATIVE(name, u ## name, 0
/*FLT_EPSILON*/
); \
}
#define EXPECT_MAT_SIMILAR(mat1, mat2, eps) \
{ \
ASSERT_EQ(mat1.type(), mat2.type()); \
...
...
@@ -302,7 +322,7 @@ IMPLEMENT_PARAM_CLASS(Channels, int)
#define OCL_OFF(fn) cv::ocl::setUseOpenCL(false); fn
#define OCL_ON(fn) cv::ocl::setUseOpenCL(true); fn
#define OCL_ALL_DEPTHS Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F)
#define OCL_ALL_DEPTHS Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F
, CV_64F
)
#define OCL_ALL_CHANNELS Values(1, 2, 3, 4)
CV_ENUM
(
Interpolation
,
INTER_NEAREST
,
INTER_LINEAR
,
INTER_CUBIC
,
INTER_AREA
)
...
...
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