diff --git a/modules/photo/include/opencv2/photo.hpp b/modules/photo/include/opencv2/photo.hpp index 1867d3ef0..ff98ba74f 100644 --- a/modules/photo/include/opencv2/photo.hpp +++ b/modules/photo/include/opencv2/photo.hpp @@ -160,8 +160,9 @@ image in different colorspaces. Such approach is used in fastNlMeansDenoisingCol 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, std::vector h, - int templateWindowSize = 7, int searchWindowSize = 21); + CV_EXPORTS_W void fastNlMeansDenoising( InputArray src, OutputArray dst, + const std::vector& h, + int templateWindowSize = 7, int searchWindowSize = 21); /** @brief Perform image denoising using Non-local Means Denoising algorithm @@ -212,8 +213,9 @@ image in different colorspaces. Such approach is used in fastNlMeansDenoisingCol 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, std::vector h, - int templateWindowSize = 7, int searchWindowSize = 21); +CV_EXPORTS_W void fastNlMeansDenoisingAbs( InputArray src, OutputArray dst, + const std::vector& h, + int templateWindowSize = 7, int searchWindowSize = 21); /** @brief Modification of fastNlMeansDenoising function for colored images @@ -290,7 +292,7 @@ value preserves details but also preserves some noise */ CV_EXPORTS_W void fastNlMeansDenoisingMulti( InputArrayOfArrays srcImgs, OutputArray dst, int imgToDenoiseIndex, int temporalWindowSize, - std::vector h , int templateWindowSize = 7, int searchWindowSize = 21); + const std::vector& h , int templateWindowSize = 7, int searchWindowSize = 21); /** @brief Modification of fastNlMeansDenoising function for images sequence where consequtive images have been captured in small period @@ -353,7 +355,7 @@ value preserves details but also preserves some noise */ CV_EXPORTS_W void fastNlMeansDenoisingMultiAbs( InputArrayOfArrays srcImgs, OutputArray dst, int imgToDenoiseIndex, int temporalWindowSize, - std::vector h, int templateWindowSize = 7, int searchWindowSize = 21); + const std::vector& h, int templateWindowSize = 7, int searchWindowSize = 21); /** @brief Modification of fastNlMeansDenoisingMulti function for colored images sequences diff --git a/modules/photo/src/denoising.cpp b/modules/photo/src/denoising.cpp index 7dde96081..5243b4330 100644 --- a/modules/photo/src/denoising.cpp +++ b/modules/photo/src/denoising.cpp @@ -52,7 +52,7 @@ void cv::fastNlMeansDenoising( InputArray _src, OutputArray _dst, float h, templateWindowSize, searchWindowSize); } -void cv::fastNlMeansDenoising( InputArray _src, OutputArray _dst, std::vector h, +void cv::fastNlMeansDenoising( InputArray _src, OutputArray _dst, const std::vector& h, int templateWindowSize, int searchWindowSize) { int hn = h.size(); @@ -123,7 +123,7 @@ void cv::fastNlMeansDenoisingAbs( InputArray _src, OutputArray _dst, float h, templateWindowSize, searchWindowSize); } -void cv::fastNlMeansDenoisingAbs( InputArray _src, OutputArray _dst, std::vector h, +void cv::fastNlMeansDenoisingAbs( InputArray _src, OutputArray _dst, const std::vector& h, int templateWindowSize, int searchWindowSize) { int hn = h.size(); @@ -299,7 +299,7 @@ void cv::fastNlMeansDenoisingMulti( InputArrayOfArrays _srcImgs, OutputArray _ds void cv::fastNlMeansDenoisingMulti( InputArrayOfArrays _srcImgs, OutputArray _dst, int imgToDenoiseIndex, int temporalWindowSize, - std::vector h, + const std::vector& h, int templateWindowSize, int searchWindowSize) { std::vector srcImgs; @@ -375,7 +375,7 @@ void cv::fastNlMeansDenoisingMultiAbs( InputArrayOfArrays _srcImgs, OutputArray void cv::fastNlMeansDenoisingMultiAbs( InputArrayOfArrays _srcImgs, OutputArray _dst, int imgToDenoiseIndex, int temporalWindowSize, - std::vector h, + const std::vector& h, int templateWindowSize, int searchWindowSize) { std::vector srcImgs; diff --git a/modules/photo/src/fast_nlmeans_denoising_opencl.hpp b/modules/photo/src/fast_nlmeans_denoising_opencl.hpp index a06dc6192..b7fdc7cf9 100644 --- a/modules/photo/src/fast_nlmeans_denoising_opencl.hpp +++ b/modules/photo/src/fast_nlmeans_denoising_opencl.hpp @@ -29,7 +29,7 @@ static int divUp(int a, int b) } template -static bool ocl_calcAlmostDist2Weight(UMat & almostDist2Weight, int searchWindowSize, int templateWindowSize, FT *h, int hn, int cn, +static bool ocl_calcAlmostDist2Weight(UMat & almostDist2Weight, int searchWindowSize, int templateWindowSize, const FT *h, int hn, int cn, int & almostTemplateWindowSizeSqBinShift, bool abs) { const WT maxEstimateSumValue = searchWindowSize * searchWindowSize * @@ -78,7 +78,7 @@ static bool ocl_calcAlmostDist2Weight(UMat & almostDist2Weight, int searchWindow return k.run(1, globalsize, NULL, false); } -static bool ocl_fastNlMeansDenoising(InputArray _src, OutputArray _dst, float *h, int hn, +static bool ocl_fastNlMeansDenoising(InputArray _src, OutputArray _dst, const float *h, int hn, int templateWindowSize, int searchWindowSize, bool abs) { int type = _src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);