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
3bde9e93
Commit
3bde9e93
authored
Mar 01, 2015
by
Erik Karlsson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added test cases
parent
a9ff335a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
12 deletions
+39
-12
test_denoising.cpp
modules/photo/test/ocl/test_denoising.cpp
+39
-12
No files found.
modules/photo/test/ocl/test_denoising.cpp
View file @
3bde9e93
...
@@ -13,11 +13,11 @@
...
@@ -13,11 +13,11 @@
namespace
cvtest
{
namespace
cvtest
{
namespace
ocl
{
namespace
ocl
{
PARAM_TEST_CASE
(
FastNlMeansDenoisingTestBase
,
Channels
,
bool
)
PARAM_TEST_CASE
(
FastNlMeansDenoisingTestBase
,
Channels
,
bool
,
bool
)
{
{
int
cn
,
templateWindowSize
,
searchWindowSize
;
int
cn
,
templateWindowSize
,
searchWindowSize
;
float
h
;
float
h
;
bool
use_roi
;
bool
use_roi
,
use_image
;
TEST_DECLARE_INPUT_PARAMETER
(
src
);
TEST_DECLARE_INPUT_PARAMETER
(
src
);
TEST_DECLARE_OUTPUT_PARAMETER
(
dst
);
TEST_DECLARE_OUTPUT_PARAMETER
(
dst
);
...
@@ -26,6 +26,7 @@ PARAM_TEST_CASE(FastNlMeansDenoisingTestBase, Channels, bool)
...
@@ -26,6 +26,7 @@ PARAM_TEST_CASE(FastNlMeansDenoisingTestBase, Channels, bool)
{
{
cn
=
GET_PARAM
(
0
);
cn
=
GET_PARAM
(
0
);
use_roi
=
GET_PARAM
(
1
);
use_roi
=
GET_PARAM
(
1
);
use_image
=
GET_PARAM
(
2
);
templateWindowSize
=
7
;
templateWindowSize
=
7
;
searchWindowSize
=
21
;
searchWindowSize
=
21
;
...
@@ -34,20 +35,27 @@ PARAM_TEST_CASE(FastNlMeansDenoisingTestBase, Channels, bool)
...
@@ -34,20 +35,27 @@ PARAM_TEST_CASE(FastNlMeansDenoisingTestBase, Channels, bool)
virtual
void
generateTestData
()
virtual
void
generateTestData
()
{
{
const
int
type
=
CV_8UC
(
cn
);
Mat
image
;
Mat
image
;
if
(
cn
==
1
)
{
if
(
use_image
)
{
image
=
readImage
(
"denoising/lena_noised_gaussian_sigma=10.png"
,
IMREAD_GRAYSCALE
);
image
=
readImage
(
"denoising/lena_noised_gaussian_sigma=10.png"
,
cn
==
1
?
IMREAD_GRAYSCALE
:
IMREAD_COLOR
);
ASSERT_FALSE
(
image
.
empty
());
ASSERT_FALSE
(
image
.
empty
());
}
}
const
int
type
=
CV_8UC
(
cn
);
Size
roiSize
=
use_image
?
image
.
size
()
:
randomSize
(
1
,
MAX_VALUE
);
Size
roiSize
=
cn
==
1
?
image
.
size
()
:
randomSize
(
1
,
MAX_VALUE
);
Border
srcBorder
=
randomBorder
(
0
,
use_roi
?
MAX_VALUE
:
0
);
Border
srcBorder
=
randomBorder
(
0
,
use_roi
?
MAX_VALUE
:
0
);
randomSubMat
(
src
,
src_roi
,
roiSize
,
srcBorder
,
type
,
0
,
255
);
randomSubMat
(
src
,
src_roi
,
roiSize
,
srcBorder
,
type
,
0
,
255
);
if
(
cn
==
1
)
if
(
use_image
)
{
image
.
copyTo
(
src_roi
);
ASSERT_TRUE
(
cn
==
1
||
cn
==
2
||
cn
==
3
);
if
(
cn
==
2
)
{
int
from_to
[]
=
{
0
,
0
,
1
,
1
};
src_roi
.
create
(
roiSize
,
type
);
mixChannels
(
&
image
,
1
,
&
src_roi
,
1
,
from_to
,
2
);
}
else
image
.
copyTo
(
src_roi
);
}
Border
dstBorder
=
randomBorder
(
0
,
use_roi
?
MAX_VALUE
:
0
);
Border
dstBorder
=
randomBorder
(
0
,
use_roi
?
MAX_VALUE
:
0
);
randomSubMat
(
dst
,
dst_roi
,
roiSize
,
dstBorder
,
type
,
0
,
255
);
randomSubMat
(
dst
,
dst_roi
,
roiSize
,
dstBorder
,
type
,
0
,
255
);
...
@@ -72,6 +80,21 @@ OCL_TEST_P(FastNlMeansDenoising, Mat)
...
@@ -72,6 +80,21 @@ OCL_TEST_P(FastNlMeansDenoising, Mat)
}
}
}
}
typedef
FastNlMeansDenoisingTestBase
FastNlMeansDenoisingAbs
;
OCL_TEST_P
(
FastNlMeansDenoisingAbs
,
Mat
)
{
for
(
int
j
=
0
;
j
<
test_loop_times
;
j
++
)
{
generateTestData
();
OCL_OFF
(
cv
::
fastNlMeansDenoisingAbs
(
src_roi
,
dst_roi
,
h
,
templateWindowSize
,
searchWindowSize
));
OCL_ON
(
cv
::
fastNlMeansDenoisingAbs
(
usrc_roi
,
udst_roi
,
h
,
templateWindowSize
,
searchWindowSize
));
OCL_EXPECT_MATS_NEAR
(
dst
,
1
);
}
}
typedef
FastNlMeansDenoisingTestBase
FastNlMeansDenoisingColored
;
typedef
FastNlMeansDenoisingTestBase
FastNlMeansDenoisingColored
;
OCL_TEST_P
(
FastNlMeansDenoisingColored
,
Mat
)
OCL_TEST_P
(
FastNlMeansDenoisingColored
,
Mat
)
...
@@ -87,8 +110,12 @@ OCL_TEST_P(FastNlMeansDenoisingColored, Mat)
...
@@ -87,8 +110,12 @@ OCL_TEST_P(FastNlMeansDenoisingColored, Mat)
}
}
}
}
OCL_INSTANTIATE_TEST_CASE_P
(
Photo
,
FastNlMeansDenoising
,
Combine
(
Values
(
1
,
2
,
3
),
Bool
()));
OCL_INSTANTIATE_TEST_CASE_P
(
Photo
,
FastNlMeansDenoising
,
OCL_INSTANTIATE_TEST_CASE_P
(
Photo
,
FastNlMeansDenoisingColored
,
Combine
(
Values
(
3
,
4
),
Bool
()));
Combine
(
Values
(
1
,
2
,
3
),
Bool
(),
Bool
()));
OCL_INSTANTIATE_TEST_CASE_P
(
Photo
,
FastNlMeansDenoisingAbs
,
Combine
(
Values
(
1
,
2
,
3
),
Bool
(),
Bool
()));
OCL_INSTANTIATE_TEST_CASE_P
(
Photo
,
FastNlMeansDenoisingColored
,
Combine
(
Values
(
3
,
4
),
Bool
(),
Values
(
false
)));
}
}
// namespace cvtest::ocl
}
}
// namespace cvtest::ocl
...
...
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