OpenCV 4.13.0
開源計算機視覺庫 (Open Source Computer Vision)
正在載入...
正在搜尋...
未找到匹配項
cv::SVD 類參考

奇異值分解. 更多...

#include <opencv2/core.hpp>

cv::SVD 的協作圖

公開型別

enum  標誌 {
  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 尺寸,這在大多數情況下是不必要的.

另請參閱
invert, solve, eigen, determinant

成員列舉文件

◆ 標誌

列舉值 (Enumerator)
MODIFY_A 

允許演算法修改被分解的矩陣; 這可以節省空間並加快處理速度. 當前被忽略.

NO_UV 

表示只處理奇異值向量w,而u和vt將被設定為空矩陣

FULL_UV 

當矩陣不是方陣時,預設情況下演算法會生成足夠大的 u 和 vt 矩陣以供後續重建 A; 但是,如果指定了 FULL_UV 標誌,則 u 和 vt 將是完整大小的方正交矩陣.

建構函式與解構函式說明

◆ solveZ()

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:840
Mat w
定義 core.hpp:2866
static void compute(InputArray src, OutputArray w, OutputArray u, OutputArray vt, int flags=0)
分解矩陣並將結果儲存到使用者提供的矩陣中
Mat vt
定義 core.hpp:2866
Mat u
定義 core.hpp:2866
引數
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

該類的文件由以下檔案生成: