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
cc8d94c6
Commit
cc8d94c6
authored
Mar 06, 2015
by
Erik Karlsson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Addition of per-channel h-values for fastNlMeansDenoising[Multi][Abs]
parent
324fa268
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
122 additions
and
10 deletions
+122
-10
photo.hpp
modules/photo/include/opencv2/photo.hpp
+118
-6
denoising.cpp
modules/photo/src/denoising.cpp
+0
-0
fast_nlmeans_denoising_invoker.hpp
modules/photo/src/fast_nlmeans_denoising_invoker.hpp
+1
-1
fast_nlmeans_denoising_invoker_commons.hpp
modules/photo/src/fast_nlmeans_denoising_invoker_commons.hpp
+1
-1
fast_nlmeans_multi_denoising_invoker.hpp
modules/photo/src/fast_nlmeans_multi_denoising_invoker.hpp
+1
-1
nlmeans.cl
modules/photo/src/opencl/nlmeans.cl
+1
-1
No files found.
modules/photo/include/opencv2/photo.hpp
View file @
cc8d94c6
...
...
@@ -138,6 +138,31 @@ parameter.
CV_EXPORTS_W
void
fastNlMeansDenoising
(
InputArray
src
,
OutputArray
dst
,
float
h
=
3
,
int
templateWindowSize
=
7
,
int
searchWindowSize
=
21
);
/** @brief Perform image denoising using Non-local Means Denoising algorithm
<http://www.ipol.im/pub/algo/bcm_non_local_means_denoising/> with several computational
optimizations. Noise expected to be a gaussian white noise
@param src Input 8-bit 1-channel, 2-channel, 3-channel or 4-channel image.
@param dst Output image with the same size and type as src .
@param templateWindowSize Size in pixels of the template patch that is used to compute weights.
Should be odd. Recommended value 7 pixels
@param searchWindowSize Size in pixels of the window that is used to compute weighted average for
given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater
denoising time. Recommended value 21 pixels
@param h Array of parameters regulating filter strength, one per
channel. Big h value perfectly removes noise but also removes image
details, smaller h value preserves details but also preserves some
noise
This function expected to be applied to grayscale images. For colored images look at
fastNlMeansDenoisingColored. Advanced usage of this functions can be manual denoising of colored
image in different colorspaces. Such approach is used in fastNlMeansDenoisingColored by converting
image to CIELAB colorspace and then separately denoise L and AB components with different h
parameter.
*/
CV_EXPORTS_W
void
fastNlMeansDenoising
(
InputArray
src
,
OutputArray
dst
,
float
*
h
,
int
templateWindowSize
=
7
,
int
searchWindowSize
=
21
);
/** @brief Perform image denoising using Non-local Means Denoising
algorithm <http://www.ipol.im/pub/algo/bcm_non_local_means_denoising/>
with several computational optimizations. Noise expected to be a
...
...
@@ -163,6 +188,33 @@ parameter.
CV_EXPORTS_W
void
fastNlMeansDenoisingAbs
(
InputArray
src
,
OutputArray
dst
,
float
h
=
3
,
int
templateWindowSize
=
7
,
int
searchWindowSize
=
21
);
/** @brief Perform image denoising using Non-local Means Denoising
algorithm <http://www.ipol.im/pub/algo/bcm_non_local_means_denoising/>
with several computational optimizations. Noise expected to be a
gaussian white noise. Uses squared sum of absolute value distances
instead of sum of squared distances for weight calculation
@param src Input 8-bit or 16-bit 1-channel, 2-channel, 3-channel or 4-channel image.
@param dst Output image with the same size and type as src .
@param templateWindowSize Size in pixels of the template patch that is used to compute weights.
Should be odd. Recommended value 7 pixels
@param searchWindowSize Size in pixels of the window that is used to compute weighted average for
given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater
denoising time. Recommended value 21 pixels
@param h Array of parameters regulating filter strength, one per
channel. Big h value perfectly removes noise but also removes image
details, smaller h value preserves details but also preserves some
noise
This function expected to be applied to grayscale images. For colored images look at
fastNlMeansDenoisingColored. Advanced usage of this functions can be manual denoising of colored
image in different colorspaces. Such approach is used in fastNlMeansDenoisingColored by converting
image to CIELAB colorspace and then separately denoise L and AB components with different h
parameter.
*/
CV_EXPORTS_W
void
fastNlMeansDenoisingAbs
(
InputArray
src
,
OutputArray
dst
,
float
*
h
,
int
templateWindowSize
=
7
,
int
searchWindowSize
=
21
);
/** @brief Modification of fastNlMeansDenoising function for colored images
@param src Input 8-bit 3-channel image.
...
...
@@ -204,14 +256,42 @@ Should be odd. Recommended value 7 pixels
@param searchWindowSize Size in pixels of the window that is used to compute weighted average for
given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater
denoising time. Recommended value 21 pixels
@param h Parameter regulating filter strength
for luminance component. Bigger h value perfectly
removes noise but also removes image details, smaller h value preserves details but also preserves
some noise
@param h Parameter regulating filter strength
. Bigger h value
perfectly removes noise but also removes image details, smaller h
value preserves details but also preserves
some noise
*/
CV_EXPORTS_W
void
fastNlMeansDenoisingMulti
(
InputArrayOfArrays
srcImgs
,
OutputArray
dst
,
int
imgToDenoiseIndex
,
int
temporalWindowSize
,
float
h
=
3
,
int
templateWindowSize
=
7
,
int
searchWindowSize
=
21
);
/** @brief Modification of fastNlMeansDenoising function for images sequence where consequtive images have been
captured in small period of time. For example video. This version of the function is for grayscale
images or for manual manipulation with colorspaces. For more details see
<http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.131.6394>
@param srcImgs Input 8-bit 1-channel, 2-channel, 3-channel or
4-channel images sequence. All images should have the same type and
size.
@param imgToDenoiseIndex Target image to denoise index in srcImgs sequence
@param temporalWindowSize Number of surrounding images to use for target image denoising. Should
be odd. Images from imgToDenoiseIndex - temporalWindowSize / 2 to
imgToDenoiseIndex - temporalWindowSize / 2 from srcImgs will be used to denoise
srcImgs[imgToDenoiseIndex] image.
@param dst Output image with the same size and type as srcImgs images.
@param templateWindowSize Size in pixels of the template patch that is used to compute weights.
Should be odd. Recommended value 7 pixels
@param searchWindowSize Size in pixels of the window that is used to compute weighted average for
given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater
denoising time. Recommended value 21 pixels
@param h Array of parameters regulating filter strength, one for each
channel. Bigger h value perfectly removes noise but also removes image
details, smaller h value preserves details but also preserves some
noise
*/
CV_EXPORTS_W
void
fastNlMeansDenoisingMulti
(
InputArrayOfArrays
srcImgs
,
OutputArray
dst
,
int
imgToDenoiseIndex
,
int
temporalWindowSize
,
float
*
h
,
int
templateWindowSize
=
7
,
int
searchWindowSize
=
21
);
/** @brief Modification of fastNlMeansDenoising function for images
sequence where consequtive images have been captured in small period
of time. For example video. This version of the function is for
...
...
@@ -235,14 +315,46 @@ Should be odd. Recommended value 7 pixels
@param searchWindowSize Size in pixels of the window that is used to compute weighted average for
given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater
denoising time. Recommended value 21 pixels
@param h Parameter regulating filter strength
for luminance component. Bigger h value perfectly
removes noise but also removes image details, smaller h value preserves details but also preserves
some noise
@param h Parameter regulating filter strength
. Bigger h value
perfectly removes noise but also removes image details, smaller h
value preserves details but also preserves
some noise
*/
CV_EXPORTS_W
void
fastNlMeansDenoisingMultiAbs
(
InputArrayOfArrays
srcImgs
,
OutputArray
dst
,
int
imgToDenoiseIndex
,
int
temporalWindowSize
,
float
h
=
3
,
int
templateWindowSize
=
7
,
int
searchWindowSize
=
21
);
/** @brief Modification of fastNlMeansDenoising function for images
sequence where consequtive images have been captured in small period
of time. For example video. This version of the function is for
grayscale images or for manual manipulation with colorspaces. For more
details see
<http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.131.6394>. Uses
squared sum of absolute value distances instead of sum of squared
distances for weight calculation
@param srcImgs Input 8-bit or 16-bit 1-channel, 2-channel, 3-channel
or 4-channel images sequence. All images should have the same type and
size.
@param imgToDenoiseIndex Target image to denoise index in srcImgs sequence
@param temporalWindowSize Number of surrounding images to use for target image denoising. Should
be odd. Images from imgToDenoiseIndex - temporalWindowSize / 2 to
imgToDenoiseIndex - temporalWindowSize / 2 from srcImgs will be used to denoise
srcImgs[imgToDenoiseIndex] image.
@param dst Output image with the same size and type as srcImgs images.
@param templateWindowSize Size in pixels of the template patch that is used to compute weights.
Should be odd. Recommended value 7 pixels
@param searchWindowSize Size in pixels of the window that is used to compute weighted average for
given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater
denoising time. Recommended value 21 pixels
@param h Array of parameters regulating filter strength, one for each
channel. Bigger h value perfectly removes noise but also removes image
details, smaller h value preserves details but also preserves some
noise
*/
CV_EXPORTS_W
void
fastNlMeansDenoisingMultiAbs
(
InputArrayOfArrays
srcImgs
,
OutputArray
dst
,
int
imgToDenoiseIndex
,
int
temporalWindowSize
,
float
*
h
,
int
templateWindowSize
=
7
,
int
searchWindowSize
=
21
);
/** @brief Modification of fastNlMeansDenoisingMulti function for colored images sequences
@param srcImgs Input 8-bit 3-channel images sequence. All images should have the same type and
...
...
modules/photo/src/denoising.cpp
View file @
cc8d94c6
This diff is collapsed.
Click to expand it.
modules/photo/src/fast_nlmeans_denoising_invoker.hpp
View file @
cc8d94c6
...
...
@@ -236,7 +236,7 @@ void FastNlMeansDenoisingInvoker<T, IT, UIT, D, WT>::operator() (const Range& ra
for
(
int
x
=
0
;
x
<
search_window_size_
;
x
++
)
{
int
almostAvgDist
=
dist_sums_row
[
x
]
>>
almost_template_window_size_sq_bin_shift_
;
int
weight
=
almost_dist2weight_
[
almostAvgDist
];
WT
weight
=
almost_dist2weight_
[
almostAvgDist
];
T
p
=
cur_row_ptr
[
border_size_
+
search_window_x
+
x
];
incWithWeight
<
T
,
IT
,
WT
>
(
estimation
,
weights_sum
,
weight
,
p
);
}
...
...
modules/photo/src/fast_nlmeans_denoising_invoker_commons.hpp
View file @
cc8d94c6
...
...
@@ -387,7 +387,7 @@ template <typename ET, typename IT, typename EW> struct incWithWeight_<Vec<ET, 4
};
template
<
typename
T
,
typename
IT
,
typename
WT
>
static
inline
void
incWithWeight
(
IT
*
estimation
,
IT
*
weights_sum
,
I
T
weight
,
T
p
)
static
inline
void
incWithWeight
(
IT
*
estimation
,
IT
*
weights_sum
,
W
T
weight
,
T
p
)
{
return
incWithWeight_
<
T
,
IT
,
WT
>::
f
(
estimation
,
weights_sum
,
weight
,
p
);
}
...
...
modules/photo/src/fast_nlmeans_multi_denoising_invoker.hpp
View file @
cc8d94c6
...
...
@@ -262,7 +262,7 @@ void FastNlMeansMultiDenoisingInvoker<T, IT, UIT, D, WT>::operator() (const Rang
{
int
almostAvgDist
=
dist_sums_row
[
x
]
>>
almost_template_window_size_sq_bin_shift
;
int
weight
=
almost_dist2weight
[
almostAvgDist
];
WT
weight
=
almost_dist2weight
[
almostAvgDist
];
T
p
=
cur_row_ptr
[
border_size_
+
search_window_x
+
x
];
incWithWeight
<
T
,
IT
,
WT
>
(
estimation
,
weights_sum
,
weight
,
p
);
}
...
...
modules/photo/src/opencl/nlmeans.cl
View file @
cc8d94c6
...
...
@@ -36,7 +36,7 @@ __kernel void calcAlmostDist2Weight(__global wlut_t * almostDist2Weight, int alm
#
endif
wlut_t
weight
=
convert_wlut_t
(
fixedPointMult
*
(
isnan
(
w
)
?
(
w_t
)
1.0
:
w
))
;
almostDist2Weight[almostDist]
=
weight
<
WEIGHT_THRESHOLD
*
fixedPointMult
?
(
wlut_t
)
0
:
weight
;
weight
<
(
wlut_t
)(
WEIGHT_THRESHOLD
*
fixedPointMult
)
?
(
wlut_t
)
0
:
weight
;
}
}
...
...
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