Commit dda99954 authored by Vladislav Vinogradov's avatar Vladislav Vinogradov

fix GpuMat::copyTo method with mask:

fill destination matrix with zeros if it was reallocated
parent a548a081
...@@ -620,11 +620,19 @@ void cv::gpu::GpuMat::copyTo(GpuMat& m) const ...@@ -620,11 +620,19 @@ void cv::gpu::GpuMat::copyTo(GpuMat& m) const
void cv::gpu::GpuMat::copyTo(GpuMat& mat, const GpuMat& mask) const void cv::gpu::GpuMat::copyTo(GpuMat& mat, const GpuMat& mask) const
{ {
if (mask.empty()) if (mask.empty())
{
copyTo(mat); copyTo(mat);
}
else else
{ {
uchar* data0 = mat.data;
mat.create(size(), type()); mat.create(size(), type());
// do not leave dst uninitialized
if (mat.data != data0)
mat.setTo(Scalar::all(0));
gpuFuncTable()->copyWithMask(*this, mat, mask); gpuFuncTable()->copyWithMask(*this, mat, mask);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment