From 7a7dae362712f5048a9a5209796d9ebf81509fe8 Mon Sep 17 00:00:00 2001 From: Vadim Pisarevsky Date: Fri, 11 May 2012 12:40:20 +0000 Subject: [PATCH] fixed problem with Mat::copyTo() with Mat_<> arguments (ticket #1918) --- modules/core/src/matrix.cpp | 2 +- modules/core/test/test_arithm.cpp | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/core/src/matrix.cpp b/modules/core/src/matrix.cpp index 364e6f5..89d2bbf 100644 --- a/modules/core/src/matrix.cpp +++ b/modules/core/src/matrix.cpp @@ -1352,7 +1352,7 @@ void _OutputArray::create(int dims, const int* size, int type, int i, bool allow if(CV_MAT_CN(type) == m.channels() && ((1 << CV_MAT_TYPE(flags)) & fixedDepthMask) != 0 ) type = m.type(); else - CV_Assert(!fixedType() || (CV_MAT_CN(type) == m.channels() && ((1 << CV_MAT_TYPE(flags)) & fixedDepthMask) != 0)); + CV_Assert(CV_MAT_TYPE(type) == m.type()); } if(fixedSize()) { diff --git a/modules/core/test/test_arithm.cpp b/modules/core/test/test_arithm.cpp index bb61405..b20d28a 100644 --- a/modules/core/test/test_arithm.cpp +++ b/modules/core/test/test_arithm.cpp @@ -1504,6 +1504,14 @@ protected: d.convertTo(d1, depth); CV_Assert( norm(c, d1, CV_C) <= DBL_EPSILON ); } + + Mat_ tmpSrc(100,100); + tmpSrc = 124; + Mat_ tmpMask(100,100); + tmpMask = 255; + Mat_ tmpDst(100,100); + tmpDst = 2; + tmpSrc.copyTo(tmpDst,tmpMask); } catch(...) { -- 2.7.4