From f676bfb3d74efec62cdc845bb50f58aafeaab6d5 Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Thu, 15 Jan 2015 19:33:27 +0300 Subject: [PATCH] fix GpuMat::setTo method in case if mask is empty: it might be called from _OutputArray::setTo --- modules/core/src/cuda/gpu_mat.cu | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/core/src/cuda/gpu_mat.cu b/modules/core/src/cuda/gpu_mat.cu index 71b1b52198..f21c5f4c19 100644 --- a/modules/core/src/cuda/gpu_mat.cu +++ b/modules/core/src/cuda/gpu_mat.cu @@ -390,6 +390,11 @@ GpuMat& cv::cuda::GpuMat::setTo(Scalar value, InputArray _mask, Stream& stream) GpuMat mask = _mask.getGpuMat(); + if (mask.empty()) + { + return setTo(value, stream); + } + CV_DbgAssert( size() == mask.size() && mask.type() == CV_8UC1 ); typedef void (*func_t)(const GpuMat& mat, const GpuMat& mask, Scalar scalar, Stream& stream);