奇異值分解. 更多...
#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
◆ 標誌
| 列舉值 (Enumerator) |
|---|
| MODIFY_A | 允許演算法修改被分解的矩陣; 這可以節省空間並加快處理速度. 當前被忽略.
|
| NO_UV | 表示只處理奇異值向量w,而u和vt將被設定為空矩陣
|
| FULL_UV | 當矩陣不是方陣時,預設情況下演算法會生成足夠大的 u 和 vt 矩陣以供後續重建 A; 但是,如果指定了 FULL_UV 標誌,則 u 和 vt 將是完整大小的方正交矩陣.
|
◆ solveZ()
◆ 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
該類的文件由以下檔案生成: