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
4b719215
Commit
4b719215
authored
Mar 27, 2014
by
mlyashko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
both tests by picture and rand mat
parent
e34a7caa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
1 deletion
+50
-1
test_histogram.cpp
modules/imgproc/test/ocl/test_histogram.cpp
+39
-1
ocl_test.hpp
modules/ts/include/opencv2/ts/ocl_test.hpp
+11
-0
No files found.
modules/imgproc/test/ocl/test_histogram.cpp
View file @
4b719215
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
// Copyright (C) 2010-2012, Institute Of Software Chinese Academy Of Science, all rights reserved.
// Copyright (C) 2010-2012, Institute Of Software Chinese Academy Of Science, all rights reserved.
// Copyright (C) 2010-2012, Advanced Micro Devices, Inc., all rights reserved.
// Copyright (C) 2010-2012, Advanced Micro Devices, Inc., all rights reserved.
// Copyright (C) 2010-2012, Multicoreware, Inc., all rights reserved.
// Copyright (C) 2010-2012, Multicoreware, Inc., all rights reserved.
// Copyright (C) 2013-2014, Itseez, Inc, all rights reserved.
// Third party copyrights are property of their respective owners.
// Third party copyrights are property of their respective owners.
//
//
// @Authors
// @Authors
...
@@ -144,6 +145,36 @@ PARAM_TEST_CASE(CalcBackProject, MatDepth, int, bool)
...
@@ -144,6 +145,36 @@ PARAM_TEST_CASE(CalcBackProject, MatDepth, int, bool)
scale
=
randomDouble
(
0.1
,
1
);
scale
=
randomDouble
(
0.1
,
1
);
}
}
virtual
void
test_by_pict
()
{
Mat
frame1
=
readImage
(
"optflow/RubberWhale1.png"
,
IMREAD_GRAYSCALE
);
UMat
usrc
;
frame1
.
copyTo
(
usrc
);
int
histSize
=
randomInt
(
3
,
29
);
float
hue_range
[]
=
{
0
,
180
};
const
float
*
ranges
=
{
hue_range
};
//compute histogram
calcHist
(
&
frame1
,
1
,
0
,
Mat
(),
hist
,
1
,
&
histSize
,
&
ranges
,
true
,
false
);
normalize
(
hist
,
hist
,
0
,
255
,
NORM_MINMAX
,
-
1
,
Mat
());
Mat
dst
;
UMat
udst
,
src
,
uhist
;
hist
.
copyTo
(
uhist
);
std
::
vector
<
UMat
>
uims
;
uims
.
push_back
(
usrc
);
std
::
vector
<
float
>
urngs
;
urngs
.
push_back
(
0
);
urngs
.
push_back
(
180
);
std
::
vector
<
int
>
chs
;
chs
.
push_back
(
0
);
OCL_OFF
(
calcBackProject
(
&
frame1
,
1
,
0
,
hist
,
dst
,
&
ranges
,
1
,
true
));
OCL_ON
(
calcBackProject
(
uims
,
chs
,
uhist
,
udst
,
urngs
,
1.0
));
EXPECT_MAT_NEAR
(
dst
,
udst
,
0.0
);
}
};
};
//////////////////////////////// CalcBackProject //////////////////////////////////////////////
//////////////////////////////// CalcBackProject //////////////////////////////////////////////
...
@@ -157,7 +188,14 @@ OCL_TEST_P(CalcBackProject, Mat)
...
@@ -157,7 +188,14 @@ OCL_TEST_P(CalcBackProject, Mat)
OCL_OFF
(
cv
::
calcBackProject
(
images_roi
,
channels
,
hist_roi
,
dst_roi
,
ranges
,
scale
));
OCL_OFF
(
cv
::
calcBackProject
(
images_roi
,
channels
,
hist_roi
,
dst_roi
,
ranges
,
scale
));
OCL_ON
(
cv
::
calcBackProject
(
uimages_roi
,
channels
,
uhist_roi
,
udst_roi
,
ranges
,
scale
));
OCL_ON
(
cv
::
calcBackProject
(
uimages_roi
,
channels
,
uhist_roi
,
udst_roi
,
ranges
,
scale
));
OCL_EXPECT_MATS_NEAR
(
dst
,
0.0
);
Size
dstSize
=
dst_roi
.
size
();
int
nDiffs
=
(
int
)(
0.03
f
*
dstSize
.
height
*
dstSize
.
width
);
//check if the dst mats are the same except 3% difference
EXPECT_MAT_N_DIFF
(
dst_roi
,
udst_roi
,
nDiffs
);
//check in addition on given image
test_by_pict
();
}
}
}
}
...
...
modules/ts/include/opencv2/ts/ocl_test.hpp
View file @
4b719215
...
@@ -85,6 +85,17 @@ do \
...
@@ -85,6 +85,17 @@ do \
<< "Size: " << mat1.size() << std::endl; \
<< "Size: " << mat1.size() << std::endl; \
} while ((void)0, 0)
} while ((void)0, 0)
#define EXPECT_MAT_N_DIFF(mat1, mat2, num) \
do \
{ \
ASSERT_EQ(mat1.type(), mat2.type()); \
ASSERT_EQ(mat1.size(), mat2.size()); \
Mat diff; \
absdiff(mat1, mat2, diff); \
EXPECT_LE(countNonZero(diff.reshape(1)), num) \
<< "Size: " << mat1.size() << std::endl; \
} while ((void)0, 0)
#define OCL_EXPECT_MATS_NEAR(name, eps) \
#define OCL_EXPECT_MATS_NEAR(name, eps) \
do \
do \
{ \
{ \
...
...
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