From d63f698cbe0007dd975e74531bbf39fd668fc69c Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Fri, 8 Sep 2017 14:19:09 +0300 Subject: [PATCH] cudafilters: don't modify "const" data --- modules/cudafilters/src/filtering.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/cudafilters/src/filtering.cpp b/modules/cudafilters/src/filtering.cpp index 1afd9cd763..e5a03b79a6 100644 --- a/modules/cudafilters/src/filtering.cpp +++ b/modules/cudafilters/src/filtering.cpp @@ -312,9 +312,8 @@ Ptr cv::cuda::createLaplacianFilter(int srcType, int dstType, int ksize, {2.0f, 0.0f, 2.0f, 0.0f, -8.0f, 0.0f, 2.0f, 0.0f, 2.0f} }; - Mat kernel(3, 3, CV_32FC1, (void*)K[ksize == 3]); - if (scale != 1) - kernel *= scale; + Mat kernel1(3, 3, CV_32FC1, (void*)K[ksize == 3]); + Mat kernel = (scale == 1) ? kernel1 : (kernel1 * scale); return cuda::createLinearFilter(srcType, dstType, kernel, Point(-1,-1), borderMode, borderVal); }