@@ -100,11 +100,14 @@ In case if C++11 features are avaliable, std::initializer_list can be also used
100
100
template <typename _Tp, int m, int n> class Matx
101
101
{
102
102
public:
103
- enum { depth = DataType<_Tp>::depth,
103
+ enum {
104
104
rows = m,
105
105
cols = n,
106
106
channels = rows*cols,
107
+ #ifdef OPENCV_TRAITS_ENABLE_DEPRECATED
108
+ depth = traits::Type<_Tp>::value,
107
109
type = CV_MAKETYPE (depth, channels),
110
+ #endif
108
111
shortdim = (m < n ? m : n)
109
112
};
110
113
@@ -259,13 +262,23 @@ template<typename _Tp, int m, int n> class DataType< Matx<_Tp, m, n> >
259
262
typedef value_type vec_type;
260
263
261
264
enum { generic_type = 0 ,
262
- depth = DataType<channel_type>::depth,
263
265
channels = m * n,
264
- fmt = DataType<channel_type>::fmt + ((channels - 1 ) << 8 ),
265
- type = CV_MAKETYPE (depth, channels)
266
+ fmt = traits::SafeFmt<channel_type>::fmt + ((channels - 1 ) << 8 )
267
+ #ifdef OPENCV_TRAITS_ENABLE_DEPRECATED
268
+ ,depth = DataType<channel_type>::depth
269
+ ,type = CV_MAKETYPE (depth, channels)
270
+ #endif
266
271
};
267
272
};
268
273
274
+ namespace traits {
275
+ template <typename _Tp, int m, int n>
276
+ struct Depth < Matx<_Tp, m, n> > { enum { value = Depth<_Tp>::value }; };
277
+ template <typename _Tp, int m, int n>
278
+ struct Type < Matx<_Tp, m, n> > { enum { value = CV_MAKETYPE (Depth<_Tp>::value, n*m) }; };
279
+ } // namespace
280
+
281
+
269
282
/* * @brief Comma-separated Matrix Initializer
270
283
*/
271
284
template <typename _Tp, int m, int n> class MatxCommaInitializer
@@ -323,9 +336,13 @@ template<typename _Tp, int cn> class Vec : public Matx<_Tp, cn, 1>
323
336
{
324
337
public:
325
338
typedef _Tp value_type;
326
- enum { depth = Matx<_Tp, cn, 1 >::depth,
339
+ enum {
327
340
channels = cn,
328
- type = CV_MAKETYPE (depth, channels)
341
+ #ifdef OPENCV_TRAITS_ENABLE_DEPRECATED
342
+ depth = Matx<_Tp, cn, 1 >::depth,
343
+ type = CV_MAKETYPE (depth, channels),
344
+ #endif
345
+ _dummy_enum_finalizer = 0
329
346
};
330
347
331
348
// ! default constructor
@@ -422,13 +439,24 @@ template<typename _Tp, int cn> class DataType< Vec<_Tp, cn> >
422
439
typedef value_type vec_type;
423
440
424
441
enum { generic_type = 0 ,
425
- depth = DataType<channel_type>::depth,
426
442
channels = cn,
427
443
fmt = DataType<channel_type>::fmt + ((channels - 1 ) << 8 ),
428
- type = CV_MAKETYPE (depth, channels)
444
+ #ifdef OPENCV_TRAITS_ENABLE_DEPRECATED
445
+ depth = DataType<channel_type>::depth,
446
+ type = CV_MAKETYPE (depth, channels),
447
+ #endif
448
+ _dummy_enum_finalizer = 0
429
449
};
430
450
};
431
451
452
+ namespace traits {
453
+ template <typename _Tp, int cn>
454
+ struct Depth < Vec<_Tp, cn> > { enum { value = Depth<_Tp>::value }; };
455
+ template <typename _Tp, int cn>
456
+ struct Type < Vec<_Tp, cn> > { enum { value = CV_MAKETYPE (Depth<_Tp>::value, cn) }; };
457
+ } // namespace
458
+
459
+
432
460
/* * @brief Comma-separated Vec Initializer
433
461
*/
434
462
template <typename _Tp, int m> class VecCommaInitializer : public MatxCommaInitializer <_Tp, m, 1 >
0 commit comments