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
9b31e6cd
Commit
9b31e6cd
authored
Mar 11, 2014
by
Ilya Lavrenov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changes according to reviewer's suggestions
parent
c7857e8c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
12 deletions
+13
-12
fast_nlmeans_denoising_opencl.hpp
modules/photo/src/fast_nlmeans_denoising_opencl.hpp
+3
-11
test_denoising.cpp
modules/photo/test/ocl/test_denoising.cpp
+10
-1
No files found.
modules/photo/src/fast_nlmeans_denoising_opencl.hpp
View file @
9b31e6cd
...
...
@@ -22,14 +22,6 @@ enum
CTA_SIZE
=
256
};
static
inline
int
getNearestPowerOf2OpenCL
(
int
value
)
{
int
p
=
0
;
while
(
1
<<
p
<
value
)
++
p
;
return
p
;
}
static
int
divUp
(
int
a
,
int
b
)
{
return
(
a
+
b
-
1
)
/
b
;
...
...
@@ -51,7 +43,7 @@ static bool ocl_calcAlmostDist2Weight(UMat & almostDist2Weight, int searchWindow
// additional optimization of precalced weights to replace division(averaging) by binary shift
CV_Assert
(
templateWindowSize
<=
46340
);
// sqrt(INT_MAX)
int
templateWindowSizeSq
=
templateWindowSize
*
templateWindowSize
;
almostTemplateWindowSizeSqBinShift
=
getNearestPowerOf2
OpenCL
(
templateWindowSizeSq
);
almostTemplateWindowSizeSqBinShift
=
getNearestPowerOf2
(
templateWindowSizeSq
);
FT
almostDist2ActualDistMultiplier
=
(
FT
)(
1
<<
almostTemplateWindowSizeSqBinShift
)
/
templateWindowSizeSq
;
const
FT
WEIGHT_THRESHOLD
=
1e-3
f
;
...
...
@@ -77,10 +69,10 @@ static bool ocl_calcAlmostDist2Weight(UMat & almostDist2Weight, int searchWindow
static
bool
ocl_fastNlMeansDenoising
(
InputArray
_src
,
OutputArray
_dst
,
float
h
,
int
templateWindowSize
,
int
searchWindowSize
)
{
int
type
=
_src
.
type
(),
depth
=
CV_MAT_DEPTH
(
type
),
cn
=
CV_MAT_CN
(
type
);
int
type
=
_src
.
type
(),
cn
=
CV_MAT_CN
(
type
);
Size
size
=
_src
.
size
();
if
(
!
(
depth
==
CV_8U
&&
cn
<=
4
&&
cn
!=
3
)
)
if
(
type
!=
CV_8UC1
||
type
!=
CV_8UC2
||
type
!=
CV_8UC4
)
return
false
;
int
templateWindowHalfWize
=
templateWindowSize
/
2
;
...
...
modules/photo/test/ocl/test_denoising.cpp
View file @
9b31e6cd
...
...
@@ -34,11 +34,20 @@ PARAM_TEST_CASE(FastNlMeansDenoisingTestBase, Channels, bool)
virtual
void
generateTestData
()
{
Mat
image
;
if
(
cn
==
1
)
{
image
=
readImage
(
"denoising/lena_noised_gaussian_sigma=10.png"
,
IMREAD_GRAYSCALE
);
ASSERT_FALSE
(
image
.
empty
());
}
const
int
type
=
CV_8UC
(
cn
);
Size
roiSize
=
randomSize
(
1
,
MAX_VALUE
);
Size
roiSize
=
cn
==
1
?
image
.
size
()
:
randomSize
(
1
,
MAX_VALUE
);
Border
srcBorder
=
randomBorder
(
0
,
use_roi
?
MAX_VALUE
:
0
);
randomSubMat
(
src
,
src_roi
,
roiSize
,
srcBorder
,
type
,
0
,
255
);
if
(
cn
==
1
)
image
.
copyTo
(
src_roi
);
Border
dstBorder
=
randomBorder
(
0
,
use_roi
?
MAX_VALUE
:
0
);
randomSubMat
(
dst
,
dst_roi
,
roiSize
,
dstBorder
,
type
,
0
,
255
);
...
...
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