fix GpuMat::copyTo method with mask:

fill destination matrix with zeros if it was reallocated(cherry picked from commit dda999545c)
This commit is contained in:
Vladislav Vinogradov 2014-01-22 10:40:14 +04:00 committed by Alexander Smorkalov
parent 6cb7a7be18
commit d5d88efd5d

View File

@ -620,11 +620,19 @@ void cv::gpu::GpuMat::copyTo(GpuMat& m) const
void cv::gpu::GpuMat::copyTo(GpuMat& mat, const GpuMat& mask) const
{
if (mask.empty())
{
copyTo(mat);
}
else
{
uchar* data0 = mat.data;
mat.create(size(), type());
// do not leave dst uninitialized
if (mat.data != data0)
mat.setTo(Scalar::all(0));
gpuFuncTable()->copyWithMask(*this, mat, mask);
}
}