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

此類的文件由以下檔案生成