OpenCV 4.12.0
开源计算机视觉
加载中...
搜索中...
无匹配项
cv::SVD 类参考

奇异值分解。 更多...

#include <opencv2/core.hpp>

cv::SVD 协作图

公共类型

枚举  标志 {
  MODIFY_A = 1 ,
  NO_UV = 2 ,
  FULL_UV = 4
}
 

公共成员函数

 SVD ()
 默认构造函数
 
 SVD (InputArray src, int flags=0)
 
void backSubst (InputArray rhs, OutputArray dst) const
 执行奇异值回代。
 
SVDoperator() (InputArray src, int flags=0)
 执行 SVD 的运算符。先前分配的 u、w 和 vt 被释放。
 

静态公共成员函数

template<typename _Tp , int m, int n, int nm, int nb>
static void backSubst (const Matx< _Tp, nm, 1 > &w, const Matx< _Tp, m, nm > &u, const Matx< _Tp, n, nm > &vt, const Matx< _Tp, m, nb > &rhs, Matx< _Tp, n, nb > &dst)
 
static void backSubst (InputArray w, InputArray u, InputArray vt, InputArray rhs, OutputArray dst)
 执行回代
 
template<typename _Tp , int m, int n, int nm>
static void compute (const Matx< _Tp, m, n > &a, Matx< _Tp, nm, 1 > &w)
 
template<typename _Tp , int m, int n, int nm>
static void compute (const Matx< _Tp, m, n > &a, Matx< _Tp, nm, 1 > &w, Matx< _Tp, m, nm > &u, Matx< _Tp, n, nm > &vt)
 
static void compute (InputArray src, OutputArray w, int flags=0)
 
static void compute (InputArray src, OutputArray w, OutputArray u, OutputArray vt, int flags=0)
 分解矩阵并将结果存储到用户提供的矩阵中
 
static void solveZ (InputArray src, OutputArray dst)
 求解欠定奇异线性系统
 

公共属性

Mat u
 
Mat vt
 
Mat w
 

详细描述

奇异值分解。

用于计算浮点矩阵的奇异值分解的类。奇异值分解用于解决最小二乘问题、欠定线性系统、矩阵求逆、计算条件数等。

如果您想计算矩阵的条件数或其行列式的绝对值,则不需要 uvt。您可以传递 flags=SVD::NO_UV|...。另一个标志 SVD::FULL_UV 表示必须计算全尺寸的 u 和 vt,但这在大多数情况下并非必要。

另请参见
invertsolveeigendeterminant

成员枚举文档

◆ 标志

枚举器
MODIFY_A 

允许算法修改已分解的矩阵;这可以节省空间并加快处理速度。当前已忽略。

NO_UV 

指示只处理奇异值向量 w,而 u 和 vt 将设置为空矩阵。

FULL_UV 

当矩阵不是方阵时,默认情况下算法会生成足够大的 u 和 vt 矩阵以用于后续的 A 重构;但是,如果指定了 FULL_UV 标志,u 和 vt 将是全尺寸的方正交矩阵。

构造函数 & 析构函数文档

◆ SVD() [1/2]

cv::SVD::SVD ( )

默认构造函数

初始化一个空的 SVD 结构

◆ SVD() [2/2]

cv::SVD::SVD ( InputArray src,
int flags = 0 )

这是一个重载成员函数,为方便起见而提供。它与上述函数的唯一区别在于它接受的参数。初始化一个空的 SVD 结构,然后调用 SVD::operator()

参数
src已分解的矩阵。深度必须是 CV_32F 或 CV_64F。
flags操作标志 (SVD::Flags)

成员函数文档

◆ backSubst() [1/3]

template<typename _Tp , int m, int n, int nm, int nb>
static void cv::SVD::backSubst ( const Matx< _Tp, nm, 1 > & w,
const Matx< _Tp, m, nm > & u,
const Matx< _Tp, n, nm > & vt,
const Matx< _Tp, m, nb > & rhs,
Matx< _Tp, n, nb > & dst )
static
待办
文件

◆ backSubst() [2/3]

void cv::SVD::backSubst ( InputArray rhs,
OutputArray dst ) const

执行奇异值回代。

该方法为指定的右侧计算回代

\[\texttt{x} = \texttt{vt} ^T \cdot diag( \texttt{w} )^{-1} \cdot \texttt{u} ^T \cdot \texttt{rhs} \sim \texttt{A} ^{-1} \cdot \texttt{rhs}\]

使用这种技术,您可以获得一个方便的线性系统的非常精确的解,或者一个超定线性系统的最佳(在最小二乘意义上)伪解。

参数
rhs待求解线性系统 (u*w*v')*dst = rhs 的右侧,其中 A 已被先前分解。
dst找到的系统解。
注意
显式 SVD 以及进一步的回代仅在需要求解许多具有相同左侧(例如 src)的线性系统时才有意义。如果您只需要求解一个系统(可能立即有多个 rhs 可用),只需调用 solve 并传入 DECOMP_SVD 即可。它们的作用完全相同。

◆ backSubst() [3/3]

static void cv::SVD::backSubst ( InputArray w,
InputArray u,
InputArray vt,
InputArray rhs,
OutputArray dst )
static

执行回代

◆ compute() [1/4]

template<typename _Tp , int m, int n, int nm>
static void cv::SVD::compute ( const Matx< _Tp, m, n > & a,
Matx< _Tp, nm, 1 > & w )
static
待办
文件

◆ compute() [2/4]

template<typename _Tp , int m, int n, int nm>
static void cv::SVD::compute ( const Matx< _Tp, m, n > & a,
Matx< _Tp, nm, 1 > & w,
Matx< _Tp, m, nm > & u,
Matx< _Tp, n, nm > & vt )
static
待办
文件

◆ compute() [3/4]

static void cv::SVD::compute ( InputArray src,
OutputArray w,
int flags = 0 )
static

这是一个重载成员函数,为方便起见而提供。它与上述函数的唯一区别在于它接受的参数。计算矩阵的奇异值

参数
src已分解的矩阵。深度必须是 CV_32F 或 CV_64F。
w计算得到的奇异值
flags操作标志 - 参见 SVD::Flags

◆ compute() [4/4]

static void cv::SVD::compute ( InputArray src,
OutputArray w,
OutputArray u,
OutputArray vt,
int flags = 0 )
static

分解矩阵并将结果存储到用户提供的矩阵中

这些方法/函数执行矩阵的 SVD。与 SVD::SVD 构造函数和 SVD::operator() 不同,它们将结果存储到用户提供的矩阵中

Mat A, w, u, vt;
n 维密集数组类
定义 mat.hpp:830
Mat w
定义 core.hpp:2863
static void compute(InputArray src, OutputArray w, OutputArray u, OutputArray vt, int flags=0)
分解矩阵并将结果存储到用户提供的矩阵中
Mat vt
定义 core.hpp:2863
Mat u
定义 core.hpp:2863
参数
src已分解的矩阵。深度必须是 CV_32F 或 CV_64F。
w计算得到的奇异值
u计算得到的左奇异向量
vt右奇异向量的转置矩阵
flags操作标志 - 参见 SVD::Flags

◆ operator()()

SVD & cv::SVD::operator() ( InputArray src,
int flags = 0 )

执行 SVD 的运算符。先前分配的 u、w 和 vt 被释放。

该运算符执行给定矩阵的奇异值分解。u、vt 以及奇异值向量 w 都存储在该结构中。相同的 SVD 结构可以多次与不同的矩阵一起重复使用。每次需要时,都会回收先前的 u、vt 和 w,并创建新的矩阵,所有这些都由 Mat::create 处理。

参数
src已分解的矩阵。深度必须是 CV_32F 或 CV_64F。
flags操作标志 (SVD::Flags)

◆ solveZ()

static void cv::SVD::solveZ ( InputArray src,
OutputArray dst )
static

求解欠定奇异线性系统

该方法找到奇异线性系统 A*x = 0 的单位长度解 x。根据 A 的秩,可能没有解、单个解或无限多个解。通常,该算法解决以下问题

\[dst = \arg \min _{x: \| x \| =1} \| src \cdot x \|\]

参数
src左侧矩阵。
dst找到的解。

成员数据文档

◆ u

Mat cv::SVD::u

◆ vt

Mat cv::SVD::vt

◆ w

Mat cv::SVD::w

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