OpenCV 4.12.0
开源计算机视觉
加载中...
搜索中...
无匹配项
cv::Matx< _Tp, m, n > 类模板参考

用于在编译时已知类型和大小的小型矩阵的模板类。更多...

#include <opencv2/core/matx.hpp>

cv::Matx< _Tp, m, n > 的协作图

公共类型

枚举  {
  rows = m ,
  cols = n ,
  channels = rows*cols ,
  shortdim = (m < n ? m : n)
}
 
typedef Matx< _Tp, shortdim, 1 > diag_type
 
typedef Matx< _Tp, m, n > mat_type
 
typedef _Tp value_type
 

公共成员函数

 Matx ()
 默认构造函数
 
 Matx (_Tp v0)
 1x1 矩阵
 
 Matx (_Tp v0, _Tp v1)
 1x2 或 2x1 矩阵
 
 Matx (_Tp v0, _Tp v1, _Tp v2)
 1x3 或 3x1 矩阵
 
 Matx (_Tp v0, _Tp v1, _Tp v2, _Tp v3)
 1x4, 2x2 或 4x1 矩阵
 
 Matx (_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4)
 1x5 或 5x1 矩阵
 
 Matx (_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5)
 1x6, 2x3, 3x2 或 6x1 矩阵
 
 Matx (_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6)
 1x7 或 7x1 矩阵
 
 Matx (_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7)
 1x8, 2x4, 4x2 或 8x1 矩阵
 
 Matx (_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8)
 1x9, 3x3 或 9x1 矩阵
 
 Matx (_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9)
 1x10, 2x5, 5x2 或 10x1 矩阵
 
 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)
 1x12, 2x6, 3x4, 4x3, 6x2 或 12x1 矩阵
 
 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)
 1x14, 2x7, 7x2 或 14x1 矩阵
 
 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)
 1x16, 4x4 或 16x1 矩阵
 
 Matx (const _Tp *vals)
 从普通数组初始化
 
template<int l>
 Matx (const Matx< _Tp, m, l > &a, const Matx< _Tp, l, n > &b, Matx_MatMulOp)
 
template<typename _T2 >
 Matx (const Matx< _Tp, m, n > &a, _T2 alpha, Matx_ScaleOp)
 
 Matx (const Matx< _Tp, m, n > &a, const Matx< _Tp, m, n > &b, Matx_AddOp)
 
 Matx (const Matx< _Tp, m, n > &a, const Matx< _Tp, m, n > &b, Matx_DivOp)
 
 Matx (const Matx< _Tp, m, n > &a, const Matx< _Tp, m, n > &b, Matx_MulOp)
 
 Matx (const Matx< _Tp, m, n > &a, const Matx< _Tp, m, n > &b, Matx_SubOp)
 
 Matx (const Matx< _Tp, n, m > &a, Matx_TOp)
 
 Matx (std::initializer_list< _Tp >)
 从初始化列表初始化
 
Matx< _Tp, m, 1 > col (int i) const
 提取矩阵列
 
double ddot (const Matx< _Tp, m, n > &v) const
 以双精度算法计算点积
 
diag_type diag () const
 提取矩阵对角线
 
Matx< _Tp, m, n > div (const Matx< _Tp, m, n > &a) const
 逐元素除法
 
_Tp dot (const Matx< _Tp, m, n > &v) const
 使用默认精度计算点积
 
template<int m1, int n1>
Matx< _Tp, m1, n1 > get_minor (int base_row, int base_col) const
 提取矩阵的一部分
 
Matx< _Tp, n, m > inv (int method=DECOMP_LU, bool *p_is_ok=NULL) const
 矩阵求逆
 
Matx< _Tp, m, n > mul (const Matx< _Tp, m, n > &a) const
 逐元素乘法
 
template<typename T2 >
 operator Matx< T2, m, n > () const
 转换为另一种数据类型
 
_Tpoperator() (int i)
 
const _Tpoperator() (int i) const
 1D 元素访问
 
_Tpoperator() (int row, int col)
 
const _Tpoperator() (int row, int col) const
 元素访问
 
template<int m1, int n1>
Matx< _Tp, m1, n1 > reshape () const
 改变矩阵形状
 
Matx< _Tp, 1, n > row (int i) const
 提取矩阵行
 
template<int l>
Matx< _Tp, n, l > solve (const Matx< _Tp, m, l > &rhs, int flags=DECOMP_LU) const
 求解线性系统
 
Vec< _Tp, n > solve (const Vec< _Tp, m > &rhs, int method) const
 
Matx< _Tp, n, m > t () const
 转置矩阵
 

静态公共成员函数

static CV_NODISCARD_STD Matx all (_Tp alpha)
 
static CV_NODISCARD_STD Matx diag (const diag_type &d)
 
static CV_NODISCARD_STD Matx eye ()
 
static CV_NODISCARD_STD Matx ones ()
 
static CV_NODISCARD_STD Matx randn (_Tp a, _Tp b)
 生成正态分布随机数。
 
static CV_NODISCARD_STD Matx randu (_Tp a, _Tp b)
 生成均匀分布随机数。
 
static CV_NODISCARD_STD Matx zeros ()
 

公共属性

_Tp val [m *n]
 矩阵元素
 

详细描述

template<typename _Tp, int m, int n>
class cv::Matx< _Tp, m, n >

用于在编译时已知类型和大小的小型矩阵的模板类。

如果你需要更灵活的类型,请使用 Mat 。矩阵 M 的元素可以通过 M(i,j) 记法访问。大多数常见的矩阵操作(另请参见 矩阵表达式 )都可用。要执行 Matx 未实现的某个操作,你可以轻松地将矩阵转换为 Mat 再转换回来。

Matx33f m(1, 2, 3,
4, 5, 6,
7, 8, 9);
cout << sum(Mat(m*m.t())) << endl;
n 维密集数组类
定义 mat.hpp:830
Scalar sum(InputArray src)
计算数组元素的和。

除了接受元素列表的普通构造函数外,Matx 还可以通过 C 数组初始化。

float values[] = { 1, 2, 3};
Matx31f m(values);

如果 C++11 特性可用,std::initializer_list 也可以用于初始化 Matx

Matx31f m = { 1, 2, 3};

成员 Typedef 文档

◆ diag_type

template<typename _Tp , int m, int n>
Matx<_Tp, shortdim, 1> cv::Matx< _Tp, m, n >::diag_type

◆ mat_type

template<typename _Tp , int m, int n>
Matx<_Tp, m, n> cv::Matx< _Tp, m, n >::mat_type

◆ value_type

template<typename _Tp , int m, int n>
_Tp cv::Matx< _Tp, m, n >::value_type

成员枚举文档

◆ 匿名枚举

template<typename _Tp , int m, int n>
匿名枚举
枚举器
rows 
cols 
channels 
shortdim 

构造函数 & 析构函数文档

◆ Matx() [重载 1/23]

template<typename _Tp , int m, int n>
cv::Matx< _Tp, m, n >::Matx ( )

默认构造函数

◆ Matx() [重载 2/23]

template<typename _Tp , int m, int n>
cv::Matx< _Tp, m, n >::Matx ( 包装自定义类型的辅助函数。 v0)
显式

1x1 矩阵

◆ Matx() [重载 3/23]

template<typename _Tp , int m, int n>
cv::Matx< _Tp, m, n >::Matx ( 包装自定义类型的辅助函数。 v0,
包装自定义类型的辅助函数。 v1 )

1x2 或 2x1 矩阵

◆ Matx() [重载 4/23]

1x3 或 3x1 矩阵

◆ Matx() [重载 5/23]

◆ Matx() [重载 6/23]

◆ Matx() [重载 7/23]

◆ Matx() [重载 8/23]

◆ Matx() [重载 9/23]

◆ Matx() [重载 10/23]

◆ Matx() [重载 11/23]

◆ Matx() [重载 12/23]

◆ Matx() [重载 13/23]

◆ Matx() [重载 14/23]

◆ Matx() [重载 15/23]

template<typename _Tp , int m, int n>
cv::Matx< _Tp, m, n >::Matx ( const _Tp * vals)
显式

从普通数组初始化

◆ Matx() [重载 16/23]

template<typename _Tp , int m, int n>
cv::Matx< _Tp, m, n >::Matx ( std::initializer_list< _Tp > )

从初始化列表初始化

◆ Matx() [重载 17/23]

template<typename _Tp , int m, int n>
cv::Matx< _Tp, m, n >::Matx ( const Matx< _Tp, m, n > & a,
const Matx< _Tp, m, n > & b,
Matx_AddOp  )

◆ Matx() [重载 18/23]

template<typename _Tp , int m, int n>
cv::Matx< _Tp, m, n >::Matx ( const Matx< _Tp, m, n > & a,
const Matx< _Tp, m, n > & b,
Matx_SubOp  )

◆ Matx() [重载 19/23]

template<typename _Tp , int m, int n>
template<typename _T2 >
cv::Matx< _Tp, m, n >::Matx ( const Matx< _Tp, m, n > & a,
_T2 alpha,
Matx_ScaleOp  )

◆ Matx() [重载 20/23]

template<typename _Tp , int m, int n>
cv::Matx< _Tp, m, n >::Matx ( const Matx< _Tp, m, n > & a,
const Matx< _Tp, m, n > & b,
Matx_MulOp  )

◆ Matx() [重载 21/23]

template<typename _Tp , int m, int n>
cv::Matx< _Tp, m, n >::Matx ( const Matx< _Tp, m, n > & a,
const Matx< _Tp, m, n > & b,
Matx_DivOp  )

◆ Matx() [重载 22/23]

template<typename _Tp , int m, int n>
template<int l>
cv::Matx< _Tp, m, n >::Matx ( const Matx< _Tp, m, l > & a,
const Matx< _Tp, l, n > & b,
Matx_MatMulOp  )

◆ Matx() [重载 23/23]

template<typename _Tp , int m, int n>
cv::Matx< _Tp, m, n >::Matx ( const Matx< _Tp, n, m > & a,
Matx_TOp  )

成员函数文档

◆ all()

template<typename _Tp , int m, int n>
static CV_NODISCARD_STD Matx cv::Matx< _Tp, m, n >::all ( 包装自定义类型的辅助函数。 alpha)
static

◆ col()

template<typename _Tp , int m, int n>
Matx< _Tp, m, 1 > cv::Matx< _Tp, m, n >::col ( int i) const

提取矩阵列

◆ ddot()

template<typename _Tp , int m, int n>
double cv::Matx< _Tp, m, n >::ddot ( const Matx< _Tp, m, n > & v) const

以双精度算法计算点积

◆ diag() [重载 1/2]

template<typename _Tp , int m, int n>
_Tp cv::Matx< _Tp, m, n >::diag ( ) const

提取矩阵对角线

◆ diag() [重载 2/2]

template<typename _Tp , int m, int n>
static CV_NODISCARD_STD Matx cv::Matx< _Tp, m, n >::diag ( const diag_type & d)
static

◆ div()

template<typename _Tp , int m, int n>
Matx< _Tp, m, n > cv::Matx< _Tp, m, n >::div ( const Matx< _Tp, m, n > & a) const

逐元素除法

◆ dot()

template<typename _Tp , int m, int n>
_Tp cv::Matx< _Tp, m, n >::dot ( const Matx< _Tp, m, n > & v) const

使用默认精度计算点积

◆ eye()

template<typename _Tp , int m, int n>
static CV_NODISCARD_STD Matx cv::Matx< _Tp, m, n >::eye ( )
static

◆ get_minor()

template<typename _Tp , int m, int n>
template<int m1, int n1>
Matx< _Tp, m1, n1 > cv::Matx< _Tp, m, n >::get_minor ( int base_row,
int base_col ) const

提取矩阵的一部分

◆ inv()

template<typename _Tp , int m, int n>
Matx< _Tp, n, m > cv::Matx< _Tp, m, n >::inv ( int method = DECOMP_LU,
bool * p_is_ok = NULL ) const

矩阵求逆

◆ mul()

template<typename _Tp , int m, int n>
Matx< _Tp, m, n > cv::Matx< _Tp, m, n >::mul ( const Matx< _Tp, m, n > & a) const

逐元素乘法

◆ ones()

template<typename _Tp , int m, int n>
static CV_NODISCARD_STD Matx cv::Matx< _Tp, m, n >::ones ( )
static

◆ operator Matx< T2, m, n >()

template<typename _Tp , int m, int n>
template<typename T2 >
cv::Matx< _Tp, m, n >::operator Matx< T2, m, n > ( ) const

转换为另一种数据类型

◆ operator()() [重载 1/4]

template<typename _Tp , int m, int n>
_Tp & cv::Matx< _Tp, m, n >::operator() ( int i)

◆ operator()() [重载 2/4]

template<typename _Tp , int m, int n>
const _Tp & cv::Matx< _Tp, m, n >::operator() ( int i) const

1D 元素访问

◆ operator()() [重载 3/4]

template<typename _Tp , int m, int n>
_Tp & cv::Matx< _Tp, m, n >::operator() ( int row,
int col )

◆ operator()() [重载 4/4]

template<typename _Tp , int m, int n>
const _Tp & cv::Matx< _Tp, m, n >::operator() ( int row,
int col ) const

元素访问

◆ randn()

template<typename _Tp , int m, int n>
static CV_NODISCARD_STD Matx cv::Matx< _Tp, m, n >::randn ( 包装自定义类型的辅助函数。 a,
包装自定义类型的辅助函数。 b )
static

生成正态分布随机数。

参数
a均值。
b标准差。

◆ randu()

template<typename _Tp , int m, int n>
static CV_NODISCARD_STD Matx cv::Matx< _Tp, m, n >::randu ( 包装自定义类型的辅助函数。 a,
包装自定义类型的辅助函数。 b )
static

生成均匀分布随机数。

参数
a范围边界。
b另一个范围边界(边界无需有序,下边界包含,上边界不包含)。

◆ reshape()

template<typename _Tp , int m, int n>
template<int m1, int n1>
Matx< _Tp, m1, n1 > cv::Matx< _Tp, m, n >::reshape ( ) const

改变矩阵形状

◆ row()

template<typename _Tp , int m, int n>
Matx< _Tp, 1, n > cv::Matx< _Tp, m, n >::row ( int i) const

提取矩阵行

◆ solve() [重载 1/2]

template<typename _Tp , int m, int n>
template<int l>
Matx< _Tp, n, l > cv::Matx< _Tp, m, n >::solve ( const Matx< _Tp, m, l > & rhs,
int flags = DECOMP_LU ) const

求解线性系统

◆ solve() [重载 2/2]

template<typename _Tp , int m, int n>
Vec< _Tp, n > cv::Matx< _Tp, m, n >::solve ( const Vec< _Tp, m > & rhs,
int method ) const

◆ t()

template<typename _Tp , int m, int n>
Matx< _Tp, n, m > cv::Matx< _Tp, m, n >::t ( ) const

转置矩阵

◆ zeros()

template<typename _Tp , int m, int n>
static CV_NODISCARD_STD Matx cv::Matx< _Tp, m, n >::zeros ( )
static

成员数据文档

◆ val

template<typename _Tp , int m, int n>
_Tp cv::Matx< _Tp, m, n >::val[m *n]

矩阵元素


此类的文档生成自以下文件