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
8bf616e4
Commit
8bf616e4
authored
Feb 19, 2014
by
Ilya Lavrenov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added color image support via L*a*b*
parent
634e8d37
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
7 deletions
+60
-7
perf_denoising.cpp
modules/photo/perf/opencl/perf_denoising.cpp
+2
-2
denoising.cpp
modules/photo/src/denoising.cpp
+10
-5
fast_nlmeans_denoising_opencl.hpp
modules/photo/src/fast_nlmeans_denoising_opencl.hpp
+32
-0
test_denoising.cpp
modules/photo/test/ocl/test_denoising.cpp
+16
-0
No files found.
modules/photo/perf/opencl/perf_denoising.cpp
View file @
8bf616e4
...
...
@@ -45,7 +45,7 @@ OCL_PERF_TEST(Photo, DenoisingColored)
SANITY_CHECK
(
result
);
}
OCL_PERF_TEST
(
Photo
,
D
E
SABLED_DenoisingGrayscaleMulti
)
OCL_PERF_TEST
(
Photo
,
D
I
SABLED_DenoisingGrayscaleMulti
)
{
const
int
imgs_count
=
3
;
...
...
@@ -68,7 +68,7 @@ OCL_PERF_TEST(Photo, DESABLED_DenoisingGrayscaleMulti)
SANITY_CHECK
(
result
);
}
OCL_PERF_TEST
(
Photo
,
D
E
SABLED_DenoisingColoredMulti
)
OCL_PERF_TEST
(
Photo
,
D
I
SABLED_DenoisingColoredMulti
)
{
const
int
imgs_count
=
3
;
...
...
modules/photo/src/denoising.cpp
View file @
8bf616e4
...
...
@@ -86,15 +86,20 @@ void cv::fastNlMeansDenoisingColored( InputArray _src, OutputArray _dst,
float
h
,
float
hForColorComponents
,
int
templateWindowSize
,
int
searchWindowSize
)
{
Mat
src
=
_src
.
getMat
();
_dst
.
create
(
src
.
size
(),
src
.
type
());
Mat
dst
=
_dst
.
getMat
();
if
(
src
.
type
()
!=
CV_8UC3
)
{
if
(
_src
.
type
()
!=
CV_8UC3
)
{
CV_Error
(
Error
::
StsBadArg
,
"Type of input image should be CV_8UC3!"
);
return
;
}
CV_OCL_RUN
(
_src
.
dims
()
<=
2
&&
(
_dst
.
isUMat
()
||
_src
.
isUMat
()),
ocl_fastNlMeansDenoisingColored
(
_src
,
_dst
,
h
,
hForColorComponents
,
templateWindowSize
,
searchWindowSize
))
Mat
src
=
_src
.
getMat
();
_dst
.
create
(
src
.
size
(),
src
.
type
());
Mat
dst
=
_dst
.
getMat
();
Mat
src_lab
;
cvtColor
(
src
,
src_lab
,
COLOR_LBGR2Lab
);
...
...
modules/photo/src/fast_nlmeans_denoising_opencl.hpp
View file @
8bf616e4
...
...
@@ -132,6 +132,38 @@ static bool ocl_fastNlMeansDenoising(InputArray _src, OutputArray _dst, float h,
return
k
.
run
(
2
,
globalsize
,
localsize
,
false
);
}
static
bool
ocl_fastNlMeansDenoisingColored
(
InputArray
_src
,
OutputArray
_dst
,
float
h
,
float
hForColorComponents
,
int
templateWindowSize
,
int
searchWindowSize
)
{
UMat
src
=
_src
.
getUMat
();
_dst
.
create
(
src
.
size
(),
src
.
type
());
UMat
dst
=
_dst
.
getUMat
();
UMat
src_lab
;
cvtColor
(
src
,
src_lab
,
COLOR_LBGR2Lab
);
UMat
l
(
src
.
size
(),
CV_8U
);
UMat
ab
(
src
.
size
(),
CV_8UC2
);
std
::
vector
<
UMat
>
l_ab
(
2
),
l_ab_denoised
(
2
);
l_ab
[
0
]
=
l
;
l_ab
[
1
]
=
ab
;
l_ab_denoised
[
0
].
create
(
src
.
size
(),
CV_8U
);
l_ab_denoised
[
1
].
create
(
src
.
size
(),
CV_8UC2
);
int
from_to
[]
=
{
0
,
0
,
1
,
1
,
2
,
2
};
mixChannels
(
std
::
vector
<
UMat
>
(
1
,
src_lab
),
l_ab
,
from_to
,
3
);
fastNlMeansDenoising
(
l_ab
[
0
],
l_ab_denoised
[
0
],
h
,
templateWindowSize
,
searchWindowSize
);
fastNlMeansDenoising
(
l_ab
[
1
],
l_ab_denoised
[
1
],
hForColorComponents
,
templateWindowSize
,
searchWindowSize
);
UMat
dst_lab
(
src
.
size
(),
src
.
type
());
mixChannels
(
l_ab_denoised
,
std
::
vector
<
UMat
>
(
1
,
dst_lab
),
from_to
,
3
);
cvtColor
(
dst_lab
,
dst
,
COLOR_Lab2LBGR
);
return
true
;
}
}
#endif
modules/photo/test/ocl/test_denoising.cpp
View file @
8bf616e4
...
...
@@ -98,7 +98,23 @@ OCL_TEST_P(FastNlMeansDenoising, Mat)
}
}
typedef
FastNlMeansDenoisingTestBase
fastNlMeansDenoisingColored
;
OCL_TEST_P
(
fastNlMeansDenoisingColored
,
Mat
)
{
for
(
int
j
=
0
;
j
<
test_loop_times
;
j
++
)
{
generateTestData
();
OCL_OFF
(
cv
::
fastNlMeansDenoisingColored
(
src_roi
,
dst_roi
,
h
,
h
,
templateWindowSize
,
searchWindowSize
));
OCL_ON
(
cv
::
fastNlMeansDenoisingColored
(
usrc_roi
,
udst_roi
,
h
,
h
,
templateWindowSize
,
searchWindowSize
));
OCL_EXPECT_MATS_NEAR
(
dst
,
1
)
}
}
OCL_INSTANTIATE_TEST_CASE_P
(
Photo
,
FastNlMeansDenoising
,
Combine
(
Values
(
1
,
2
),
Bool
()));
OCL_INSTANTIATE_TEST_CASE_P
(
Photo
,
fastNlMeansDenoisingColored
,
Combine
(
Values
(
Channels
(
3
)),
Bool
()));
}
}
// 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