奇异值分解。 更多...
#include <opencv2/core.hpp>
|
| 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) |
| | 求解欠定奇异线性系统
|
| |
奇异值分解。
用于计算浮点矩阵的奇异值分解的类。奇异值分解用于解决最小二乘问题、欠定线性系统、矩阵求逆、计算条件数等。
如果您想计算矩阵的条件数或其行列式的绝对值,则不需要 u 和 vt。您可以传递 flags=SVD::NO_UV|...。另一个标志 SVD::FULL_UV 表示必须计算全尺寸的 u 和 vt,但这在大多数情况下并非必要。
- 另请参见
- invert、solve、eigen、determinant
◆ 标志
| 枚举器 |
|---|
| MODIFY_A | 允许算法修改已分解的矩阵;这可以节省空间并加快处理速度。当前已忽略。
|
| NO_UV | 指示只处理奇异值向量 w,而 u 和 vt 将设置为空矩阵。
|
| FULL_UV | 当矩阵不是方阵时,默认情况下算法会生成足够大的 u 和 vt 矩阵以用于后续的 A 重构;但是,如果指定了 FULL_UV 标志,u 和 vt 将是全尺寸的方正交矩阵。
|
◆ SVD() [1/2]
◆ SVD() [2/2]
这是一个重载成员函数,为方便起见而提供。它与上述函数的唯一区别在于它接受的参数。初始化一个空的 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]
执行奇异值回代。
该方法为指定的右侧计算回代
\[\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]
◆ 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]
这是一个重载成员函数,为方便起见而提供。它与上述函数的唯一区别在于它接受的参数。计算矩阵的奇异值
- 参数
-
| src | 已分解的矩阵。深度必须是 CV_32F 或 CV_64F。 |
| w | 计算得到的奇异值 |
| flags | 操作标志 - 参见 SVD::Flags。 |
◆ compute() [4/4]
分解矩阵并将结果存储到用户提供的矩阵中
这些方法/函数执行矩阵的 SVD。与 SVD::SVD 构造函数和 SVD::operator() 不同,它们将结果存储到用户提供的矩阵中
static void compute(InputArray src, OutputArray w, OutputArray u, OutputArray vt, int flags=0)
分解矩阵并将结果存储到用户提供的矩阵中
- 参数
-
| src | 已分解的矩阵。深度必须是 CV_32F 或 CV_64F。 |
| w | 计算得到的奇异值 |
| u | 计算得到的左奇异向量 |
| vt | 右奇异向量的转置矩阵 |
| flags | 操作标志 - 参见 SVD::Flags。 |
◆ operator()()
执行 SVD 的运算符。先前分配的 u、w 和 vt 被释放。
该运算符执行给定矩阵的奇异值分解。u、vt 以及奇异值向量 w 都存储在该结构中。相同的 SVD 结构可以多次与不同的矩阵一起重复使用。每次需要时,都会回收先前的 u、vt 和 w,并创建新的矩阵,所有这些都由 Mat::create 处理。
- 参数
-
| src | 已分解的矩阵。深度必须是 CV_32F 或 CV_64F。 |
| flags | 操作标志 (SVD::Flags) |
◆ solveZ()
求解欠定奇异线性系统
该方法找到奇异线性系统 A*x = 0 的单位长度解 x。根据 A 的秩,可能没有解、单个解或无限多个解。通常,该算法解决以下问题
\[dst = \arg \min _{x: \| x \| =1} \| src \cdot x \|\]
- 参数
-
◆ vt
此类的文档由以下文件生成