Commit 93944861 authored by Alexander Alekhin's avatar Alexander Alekhin

fix issue 3891

parent 424c2bdd
......@@ -1586,7 +1586,13 @@ template<typename _Tp> template<int n> inline
Mat_<_Tp>::operator Vec<typename DataType<_Tp>::channel_type, n>() const
{
CV_Assert(n % DataType<_Tp>::channels == 0);
#if defined _MSC_VER
const Mat* pMat = (const Mat*)this; // workaround for MSVS <= 2012 compiler bugs (but GCC 4.6 dislikes this workaround)
return pMat->operator Vec<typename DataType<_Tp>::channel_type, n>();
#else
return this->Mat::operator Vec<typename DataType<_Tp>::channel_type, n>();
#endif
}
template<typename _Tp> template<int m, int n> inline
......@@ -1594,8 +1600,14 @@ Mat_<_Tp>::operator Matx<typename DataType<_Tp>::channel_type, m, n>() const
{
CV_Assert(n % DataType<_Tp>::channels == 0);
#if defined _MSC_VER
const Mat* pMat = (const Mat*)this; // workaround for MSVS <= 2012 compiler bugs (but GCC 4.6 dislikes this workaround)
Matx<typename DataType<_Tp>::channel_type, m, n> res = pMat->operator Matx<typename DataType<_Tp>::channel_type, m, n>();
return res;
#else
Matx<typename DataType<_Tp>::channel_type, m, n> res = this->Mat::operator Matx<typename DataType<_Tp>::channel_type, m, n>();
return res;
#endif
}
template<typename _Tp> inline
......
......@@ -1214,7 +1214,7 @@ TEST(Core_Matx, fromMat_)
{
Mat_<double> a = (Mat_<double>(2,2) << 10, 11, 12, 13);
Matx22d b(a);
ASSERT_EQ( norm(a, b, NORM_INF), 0.);
ASSERT_EQ( cvtest::norm(a, b, NORM_INF), 0.);
}
TEST(Core_InputArray, empty)
......
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