44 #ifndef OPENCV_CORE_MATX_HPP
45 #define OPENCV_CORE_MATX_HPP
48 # error matx.hpp header must be compiled as C++
51 #include "opencv2/core/cvdef.h"
52 #include "opencv2/core/base.hpp"
53 #include "opencv2/core/traits.hpp"
54 #include "opencv2/core/saturate.hpp"
56 #include <initializer_list>
66 struct CV_EXPORTS Matx_AddOp { Matx_AddOp() {} Matx_AddOp(
const Matx_AddOp&) {} };
67 struct CV_EXPORTS Matx_SubOp { Matx_SubOp() {} Matx_SubOp(
const Matx_SubOp&) {} };
68 struct CV_EXPORTS Matx_ScaleOp { Matx_ScaleOp() {} Matx_ScaleOp(
const Matx_ScaleOp&) {} };
69 struct CV_EXPORTS Matx_MulOp { Matx_MulOp() {} Matx_MulOp(
const Matx_MulOp&) {} };
70 struct CV_EXPORTS Matx_DivOp { Matx_DivOp() {} Matx_DivOp(
const Matx_DivOp&) {} };
71 struct CV_EXPORTS Matx_MatMulOp { Matx_MatMulOp() {} Matx_MatMulOp(
const Matx_MatMulOp&) {} };
72 struct CV_EXPORTS Matx_TOp { Matx_TOp() {} Matx_TOp(
const Matx_TOp&) {} };
99 template<
typename _Tp,
int m,
int n>
class Matx
106 #ifdef OPENCV_TRAITS_ENABLE_DEPRECATED
120 explicit Matx(_Tp v0);
121 Matx(_Tp v0, _Tp v1);
122 Matx(_Tp v0, _Tp v1, _Tp v2);
123 Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3);
124 Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4);
125 Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5);
126 Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6);
127 Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7);
128 Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8);
129 Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9);
130 Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3,
131 _Tp v4, _Tp v5, _Tp v6, _Tp v7,
132 _Tp v8, _Tp v9, _Tp v10, _Tp v11);
133 Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3,
134 _Tp v4, _Tp v5, _Tp v6, _Tp v7,
135 _Tp v8, _Tp v9, _Tp v10, _Tp v11,
137 Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3,
138 _Tp v4, _Tp v5, _Tp v6, _Tp v7,
139 _Tp v8, _Tp v9, _Tp v10, _Tp v11,
140 _Tp v12, _Tp v13, _Tp v14, _Tp v15);
141 explicit Matx(
const _Tp* vals);
259 template<
typename _Tp,
int m>
static inline
262 template<
typename _Tp,
int m,
int n>
static inline
265 template<
typename _Tp,
int m,
int n>
static inline
268 template<
typename _Tp,
int m,
int n>
static inline
271 template<
typename _Tp1,
typename _Tp2,
int m,
int n>
static inline
274 template<
typename _Tp1,
typename _Tp2,
int m,
int n>
static inline
277 template<
typename _Tp,
int m,
int n>
static inline
280 template<
typename _Tp,
int m,
int n>
static inline
283 template<
typename _Tp,
int m,
int n>
static inline
286 template<
typename _Tp,
int m,
int n>
static inline
289 template<
typename _Tp,
int m,
int n>
static inline
292 template<
typename _Tp,
int m,
int n>
static inline
295 template<
typename _Tp,
int m,
int n>
static inline
298 template<
typename _Tp,
int m,
int n>
static inline
301 template<
typename _Tp,
int m,
int n>
static inline
304 template<
typename _Tp,
int m,
int n>
static inline
307 template<
typename _Tp,
int m,
int n>
static inline
310 template<
typename _Tp,
int m,
int n>
static inline
313 template<
typename _Tp,
int m,
int n>
static inline
316 template<
typename _Tp,
int m,
int n>
static inline
319 template<
typename _Tp,
int m,
int n>
static inline
322 template<
typename _Tp,
int m,
int n>
static inline
325 template<
typename _Tp,
int m,
int n,
int l>
static inline
328 template<
typename _Tp,
int m,
int n>
static inline
331 template<
typename _Tp,
int m,
int n>
static inline
334 template<
typename _Tp,
int m,
int n>
static inline
368 template<
typename _Tp,
int cn>
class Vec :
public Matx<_Tp, cn, 1>
374 #ifdef OPENCV_TRAITS_ENABLE_DEPRECATED
386 Vec(_Tp v0, _Tp v1, _Tp v2);
387 Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3);
388 Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4);
389 Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5);
390 Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6);
391 Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7);
392 Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8);
393 Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9);
394 Vec(_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);
395 explicit Vec(
const _Tp* values);
422 template<
typename T2>
operator Vec<T2, cn>()
const;
469 template<
typename _Tp,
int cn>
inline
472 template<
typename _Tp1,
typename _Tp2,
int cn>
static inline
475 template<
typename _Tp1,
typename _Tp2,
int cn>
static inline
478 template<
typename _Tp,
int cn>
static inline
481 template<
typename _Tp,
int cn>
static inline
484 template<
typename _Tp,
int cn>
static inline
487 template<
typename _Tp,
int cn>
static inline
490 template<
typename _Tp,
int cn>
static inline
493 template<
typename _Tp,
int cn>
static inline
496 template<
typename _Tp,
int cn>
static inline
499 template<
typename _Tp,
int cn>
static inline
502 template<
typename _Tp,
int cn>
static inline
505 template<
typename _Tp,
int cn>
static inline
508 template<
typename _Tp,
int cn>
static inline
511 template<
typename _Tp,
int cn>
static inline
514 template<
typename _Tp,
int cn>
static inline
517 template<
typename _Tp,
int cn>
static inline
520 template<
typename _Tp,
int cn>
static inline
523 template<
typename _Tp,
int cn>
static inline
526 template<
typename _Tp,
int cn>
static inline
529 template<
typename _Tp,
int cn>
static inline
532 template<
typename _Tp>
inline
535 template<
typename _Tp>
inline
542 #include "opencv2/core/matx.inl.hpp"
Template class for small matrices whose type and size are known at compilation time.
Definition: matx.hpp:100
Matx< _Tp, m, n > mul(const Matx< _Tp, m, n > &a) const
multiply two matrices element-wise
Definition: matx.inl.hpp:492
Matx()
default constructor
Definition: matx.inl.hpp:148
Matx< _Tp, n, m > t() const
transpose the matrix
Definition: matx.inl.hpp:504
static CV_NODISCARD_STD Matx ones()
Definition: matx.inl.hpp:313
_Tp value_type
Definition: matx.hpp:113
Matx< _Tp, 1, n > row(int i) const
extract the matrix row
Definition: matx.inl.hpp:380
Matx< _Tp, n, m > inv(int method=DECOMP_LU, bool *p_is_ok=NULL) const
invert the matrix
Matx< _Tp, shortdim, 1 > diag_type
Definition: matx.hpp:115
Matx< _Tp, m, 1 > col(int i) const
extract the matrix column
Definition: matx.inl.hpp:387
static CV_NODISCARD_STD Matx eye()
Definition: matx.inl.hpp:319
Matx< _Tp, n, l > solve(const Matx< _Tp, m, l > &rhs, int flags=DECOMP_LU) const
solve linear system
Matx< _Tp, m, n > div(const Matx< _Tp, m, n > &a) const
divide two matrices element-wise
Definition: matx.inl.hpp:498
static CV_NODISCARD_STD Matx randn(_Tp a, _Tp b)
Generates normally distributed random numbers.
Matx< _Tp, m, n > mat_type
Definition: matx.hpp:114
Matx< _Tp, m1, n1 > reshape() const
change the matrix shape
Definition: matx.inl.hpp:361
static CV_NODISCARD_STD Matx zeros()
Definition: matx.inl.hpp:307
const _Tp & operator()(int row, int col) const
element access
Definition: matx.inl.hpp:406
static CV_NODISCARD_STD Matx all(_Tp alpha)
Definition: matx.inl.hpp:299
static CV_NODISCARD_STD Matx randu(_Tp a, _Tp b)
Generates uniformly distributed random numbers.
double ddot(const Matx< _Tp, m, n > &v) const
dot product computed in double-precision arithmetics
Definition: matx.inl.hpp:336
@ cols
Definition: matx.hpp:104
@ rows
Definition: matx.hpp:103
@ channels
Definition: matx.hpp:105
@ shortdim
Definition: matx.hpp:110
static CV_NODISCARD_STD Matx diag(const diag_type &d)
diag_type diag() const
extract the matrix diagonal
Definition: matx.inl.hpp:397
_Tp val[m *n]
matrix elements
Definition: matx.hpp:218
Matx< _Tp, m1, n1 > get_minor(int base_row, int base_col) const
extract part of the matrix
Definition: matx.inl.hpp:369
_Tp dot(const Matx< _Tp, m, n > &v) const
dot product computed with the default precision
Definition: matx.inl.hpp:328
Template class for short numerical vectors, a partial case of Matx.
Definition: matx.hpp:369
static Vec zeros()
Definition: matx.inl.hpp:855
static Vec all(_Tp alpha)
Definition: matx.inl.hpp:841
static Vec diag(_Tp alpha)=delete
Vec mul(const Vec< _Tp, cn > &v) const
per-element multiplication
Definition: matx.inl.hpp:861
static Vec randn(_Tp a, _Tp b)
Vec()
default constructor
Definition: matx.inl.hpp:770
static Vec randu(_Tp a, _Tp b)
const _Tp & operator[](int i) const
Definition: matx.inl.hpp:924
Vec cross(const Vec &v) const
Definition: matx.inl.hpp:893
static Vec ones()
Definition: matx.inl.hpp:849
Vec< _Tp, cn > & operator=(const Vec< _Tp, cn > &rhs)=default
_Tp value_type
Definition: matx.hpp:371
const _Tp & operator()(int i) const
Definition: matx.inl.hpp:938
@ _dummy_enum_finalizer
Definition: matx.hpp:378
@ channels
Definition: matx.hpp:373
Vec conj() const
conjugation (makes sense for complex numbers and quaternions)
InputArrayOfArrays Size InputOutputArray InputOutputArray OutputArrayOfArrays OutputArrayOfArrays OutputArray OutputArray OutputArray int flags
Definition: calib3d.hpp:1617
@ DECOMP_LU
Definition: base.hpp:135
static double determinant(const Matx< _Tp, m, m > &a)
Vec< double, 6 > Vec6d
Definition: matx.hpp:466
Matx< double, 2, 1 > Matx21d
Definition: matx.hpp:231
Matx< float, 1, 3 > Matx13f
Definition: matx.hpp:223
Matx< double, 3, 2 > Matx32d
Definition: matx.hpp:244
Matx< double, 2, 2 > Matx22d
Definition: matx.hpp:240
Matx< float, 3, 3 > Matx33f
Definition: matx.hpp:246
Vec< int, 2 > Vec2i
Definition: matx.hpp:452
Matx< float, 3, 1 > Matx31f
Definition: matx.hpp:232
Vec< _Tp, cn > normalize(const Vec< _Tp, cn > &v)
Definition: matx.inl.hpp:952
Vec< short, 3 > Vec3s
Definition: matx.hpp:445
Matx< double, 3, 4 > Matx34d
Definition: matx.hpp:250
Matx< double, 1, 2 > Matx12d
Definition: matx.hpp:222
Matx< double, 4, 4 > Matx44d
Definition: matx.hpp:255
static double trace(const Matx< _Tp, m, n > &a)
Vec< double, 3 > Vec3d
Definition: matx.hpp:464
Matx< float, 2, 1 > Matx21f
Definition: matx.hpp:230
Matx< double, 2, 3 > Matx23d
Definition: matx.hpp:242
Vec< float, 2 > Vec2f
Definition: matx.hpp:458
Matx< float, 1, 2 > Matx12f
Definition: matx.hpp:221
Matx< double, 1, 4 > Matx14d
Definition: matx.hpp:226
Matx< double, 1, 6 > Matx16d
Definition: matx.hpp:228
Vec< int, 8 > Vec8i
Definition: matx.hpp:456
Vec< short, 4 > Vec4s
Definition: matx.hpp:446
Vec< double, 4 > Vec4d
Definition: matx.hpp:465
static bool operator!=(const Matx< _Tp, m, n > &a, const Matx< _Tp, m, n > &b)
Matx< float, 6, 1 > Matx61f
Definition: matx.hpp:236
static double norm(const Matx< _Tp, m, n > &M)
Vec< float, 4 > Vec4f
Definition: matx.hpp:460
Vec< ushort, 4 > Vec4w
Definition: matx.hpp:450
Vec< int, 3 > Vec3i
Definition: matx.hpp:453
Vec< uchar, 2 > Vec2b
Definition: matx.hpp:440
static bool operator==(const Matx< _Tp, m, n > &a, const Matx< _Tp, m, n > &b)
Vec< ushort, 2 > Vec2w
Definition: matx.hpp:448
Matx< float, 3, 2 > Matx32f
Definition: matx.hpp:243
Vec< float, 6 > Vec6f
Definition: matx.hpp:461
Matx< double, 1, 3 > Matx13d
Definition: matx.hpp:224
Matx< double, 3, 1 > Matx31d
Definition: matx.hpp:233
Matx< float, 1, 6 > Matx16f
Definition: matx.hpp:227
Matx< double, 4, 3 > Matx43d
Definition: matx.hpp:252
Vec< uchar, 3 > Vec3b
Definition: matx.hpp:441
Vec< short, 2 > Vec2s
Definition: matx.hpp:444
Matx< float, 2, 2 > Matx22f
Definition: matx.hpp:239
Vec< int, 4 > Vec4i
Definition: matx.hpp:454
Matx< double, 6, 1 > Matx61d
Definition: matx.hpp:237
Matx< float, 4, 1 > Matx41f
Definition: matx.hpp:234
Matx< float, 2, 3 > Matx23f
Definition: matx.hpp:241
Matx< float, 4, 4 > Matx44f
Definition: matx.hpp:254
Vec< float, 3 > Vec3f
Definition: matx.hpp:459
Vec< ushort, 3 > Vec3w
Definition: matx.hpp:449
Matx< float, 4, 3 > Matx43f
Definition: matx.hpp:251
Vec< uchar, 4 > Vec4b
Definition: matx.hpp:442
Matx< float, 3, 4 > Matx34f
Definition: matx.hpp:249
Matx< float, 6, 6 > Matx66f
Definition: matx.hpp:256
Matx< float, 1, 4 > Matx14f
Definition: matx.hpp:225
Vec< int, 6 > Vec6i
Definition: matx.hpp:455
Vec< double, 2 > Vec2d
Definition: matx.hpp:463
Matx< double, 4, 1 > Matx41d
Definition: matx.hpp:235
Matx< double, 6, 6 > Matx66d
Definition: matx.hpp:257
Matx< double, 3, 3 > Matx33d
Definition: matx.hpp:247
int int type
Definition: core_c.h:221
int depth
Definition: core_c.h:100
double alpha
Definition: core_c.h:1093
#define CV_MAKETYPE(depth, cn)
Definition: interface.h:85
CV_INLINE v_reg< _Tp, n > & operator-=(v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
CV_INLINE v_reg< _Tp, n > & operator*=(v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
CV_INLINE v_reg< _Tp, n > & operator/=(v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
CV_INLINE v_reg< _Tp, n > operator/(const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
Divide values.
CV_INLINE v_reg< _Tp, n > & operator+=(v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
#define CV_EXPORTS
Definition: cvdef.h:435
#define CV_NODISCARD_STD
Definition: cvdef.h:767
CvArr CvPoint2D32f double M
Definition: imgproc_c.h:270
const CvArr CvArr int method
Definition: imgproc_c.h:384
"black box" representation of the file storage associated with a file on disk.
Definition: calib3d.hpp:441
DualQuat< T > operator+(const T a, const DualQuat< T > &q)
Definition: dualquaternion.inl.hpp:243
DualQuat< T > operator*(const T a, const DualQuat< T > &q)
Definition: dualquaternion.inl.hpp:274
DualQuat< T > operator-(const DualQuat< T > &q, const T a)
Definition: dualquaternion.inl.hpp:255
Definition: traits.hpp:386