Fix behavior of Matx 12 and 16 args constructors.

The 12 and 16 arguments Matx constructors differs from all others,
leaving values initialized and requiring the argument number to be equal
to the channels number.
pull/5542/head
Renato Florentino Garcia 9 years ago
parent 37ce3b8cfe
commit f5b98bea41
  1. 6
      modules/core/include/opencv2/core/matx.hpp

@ -574,20 +574,22 @@ Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _T
template<typename _Tp, int m, int n> inline
Matx<_Tp,m,n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9, _Tp v10, _Tp v11)
{
CV_StaticAssert(channels == 12, "Matx should have at least 12 elements.");
CV_StaticAssert(channels >= 12, "Matx should have at least 12 elements.");
val[0] = v0; val[1] = v1; val[2] = v2; val[3] = v3;
val[4] = v4; val[5] = v5; val[6] = v6; val[7] = v7;
val[8] = v8; val[9] = v9; val[10] = v10; val[11] = v11;
for(int i = 12; i < channels; i++) val[i] = _Tp(0);
}
template<typename _Tp, int m, int n> inline
Matx<_Tp,m,n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9, _Tp v10, _Tp v11, _Tp v12, _Tp v13, _Tp v14, _Tp v15)
{
CV_StaticAssert(channels == 16, "Matx should have at least 16 elements.");
CV_StaticAssert(channels >= 16, "Matx should have at least 16 elements.");
val[0] = v0; val[1] = v1; val[2] = v2; val[3] = v3;
val[4] = v4; val[5] = v5; val[6] = v6; val[7] = v7;
val[8] = v8; val[9] = v9; val[10] = v10; val[11] = v11;
val[12] = v12; val[13] = v13; val[14] = v14; val[15] = v15;
for(int i = 16; i < channels; i++) val[i] = _Tp(0);
}
template<typename _Tp, int m, int n> inline

Loading…
Cancel
Save