OpenCV 4.12.0
開源計算機視覺
載入中...
搜尋中...
無匹配項
cv::Affine3< T > 類模板參考

仿射變換。更多...

#include <opencv2/core/affine.hpp>

cv::Affine3< T > 的協作圖

公共型別

typedef T float_type
 
typedef Matx< float_type, 3, 3 > Mat3
 
typedef Matx< float_type, 4, 4 > Mat4
 
typedef Vec< float_type, 3 > Vec3
 

公共成員函式

 Affine3 ()
 預設建構函式。它表示一個 4x4 單位矩陣。
 
 Affine3 (const float_type *vals)
 從 16 元素陣列建立。
 
 Affine3 (const Mat &data, const Vec3 &t=Vec3::all(0))
 
 Affine3 (const Mat3 &R, const Vec3 &t=Vec3::all(0))
 
 Affine3 (const Mat4 &affine)
 增廣仿射矩陣。
 
 Affine3 (const Vec3 &rvec, const Vec3 &t=Vec3::all(0))
 
template<typename Y >
Affine3< Y > cast () const
 
Affine3 concatenate (const Affine3 &affine) const
 a.concatenate(affine) 等價於 affine * a;
 
Affine3 inv (int method=cv::DECOMP_SVD) const
 
Mat3 linear () const
 
void linear (const Mat3 &L)
 
template<typename Y >
 operator Affine3< Y > () const
 
Affine3 rotate (const Mat3 &R) const
 a.rotate(R) 等價於 Affine(R, 0) * a;
 
Affine3 rotate (const Vec3 &rvec) const
 a.rotate(rvec) 等價於 Affine(rvec, 0) * a;
 
Mat3 rotation () const
 
void rotation (const Mat &data)
 
void rotation (const Mat3 &R)
 
void rotation (const Vec3 &rvec)
 
Vec3 rvec () const
 
Affine3 translate (const Vec3 &t) const
 a.translate(t) 等價於 Affine(E, t) * a,其中 E 是單位矩陣
 
Vec3 translation () const
 
void translation (const Vec3 &t)
 

靜態公共成員函式

static Affine3 Identity (單位矩陣) ()
 建立一個 4x4 單位變換。
 

公共屬性

Mat4 矩陣
 

詳細描述

template<typename T>
類 cv::Affine3< T >

定義 affine.hpp:127

它表示一個 4x4 齊次變換矩陣 \(T\)

\[T = \begin{bmatrix} R & t\\ 0 & 1\\ \end{bmatrix} \]

其中 \(R\) 是一個 3x3 旋轉矩陣,\(t\) 是一個 3x1 平移向量。

你可以透過 3x3 旋轉矩陣或 3x1 旋轉向量來指定 \(R\),後者透過 Rodrigues 公式轉換為 3x3 旋轉矩陣。

要構造一個矩陣 \(T\),它首先表示繞軸 \(r\) 旋轉(旋轉角度為弧度制的 \(|r|\),遵循右手定則),然後透過向量 \(t\) 進行平移,你可以使用:

如果你已經有了旋轉矩陣 \(R\),那麼你可以使用:

要從 \(T\) 中提取旋轉矩陣 \(R\),請使用:

cv::Matx33f R = T.rotation();

要從 \(T\) 中提取平移向量 \(t\),請使用:

cv::Vec3f t = T.translation();

要從 \(T\) 中提取旋轉向量 \(r\),請使用:

cv::Vec3f r = T.rvec();

請注意,由於從旋轉向量到旋轉矩陣的對映是多對一的。返回的旋轉向量不一定是你之前用於設定矩陣的那個。

如果你有兩個變換 \(T = T_1 * T_2\),請使用:

cv::Affine3f T, T1, T2;
T = T2.concatenate(T1);
Affine3 concatenate(const Affine3 &affine) const
a.concatenate(affine) 等價於 affine * a;

要獲取 \(T\) 的逆變換,請使用:

cv::Affine3f T, T_inv;
T_inv = T.inv();
Affine3 inv(int method=cv::DECOMP_SVD) const

成員 Typedef 文件

◆ float_type

template<typename T >
T cv::Affine3< T >::float_type

◆ Mat3

template<typename T >
Matx<float_type, 3, 3> cv::Affine3< T >::Mat3

◆ Mat4

template<typename T >
Matx<float_type, 4, 4> cv::Affine3< T >::Mat4

◆ Vec3

template<typename T >
Vec<float_type, 3> cv::Affine3< T >::Vec3

建構函式 & 解構函式文件

◆ Affine3() [1/6]

template<typename T >
cv::Affine3< T >::Affine3 ( )

預設建構函式。它表示一個 4x4 單位矩陣。

◆ Affine3() [2/6]

template<typename T >
cv::Affine3< T >::Affine3 ( const Mat4 & affine)

增廣仿射矩陣。

◆ Affine3() [3/6]

template<typename T >
cv::Affine3< T >::Affine3 ( const Mat3 & R,
const Vec3 & t = Vec3::all(0) )

結果的 4x4 矩陣為

\[ \begin{bmatrix} R & t\\ 0 & 1\\ \end{bmatrix} \]

引數
R3x3 旋轉矩陣。
t3x1 平移向量。

◆ Affine3() [4/6]

template<typename T >
cv::Affine3< T >::Affine3 ( const Vec3 & rvec,
const Vec3 & t = Vec3::all(0) )

Rodrigues 向量。

當前矩陣的最後一行被設定為 [0,0,0,1]。

引數
rvec3x1 旋轉向量。其方向表示旋轉軸,其長度表示以弧度為單位的旋轉角度(遵循右手定則)。
t3x1 平移向量。

◆ Affine3() [5/6]

template<typename T >
cv::Affine3< T >::Affine3 ( const Mat & data,
const Vec3 & t = Vec3::all(0) )
顯式

結合了上述所有建構函式。支援 4x4、3x4、3x3、1x3、3x1 大小的資料矩陣。

當資料不是 4x4 時,當前矩陣的最後一行被設定為 [0,0,0,1]。

引數
data1 通道矩陣。當它是 4x4 時,它被複制到當前矩陣,並且不使用 t。當它是 3x4 時,它被複制到當前矩陣的上部 3x4 部分,並且不使用 t。當它是 3x3 時,它被複制到當前矩陣的左上角 3x3 部分。當它是 3x1 或 1x3 時,它被視為旋轉向量,並使用 Rodrigues 公式計算 3x3 旋轉矩陣。
t3x1 平移向量。僅當資料既不是 4x4 也不是 3x4 時使用。

◆ Affine3() [6/6]

template<typename T >
cv::Affine3< T >::Affine3 ( const float_type * vals)
顯式

從 16 元素陣列建立。

成員函式文件

◆ cast()

template<typename T >
template<typename Y >
Affine3< Y > cv::Affine3< T >::cast ( ) const

◆ concatenate()

template<typename T >
Affine3 cv::Affine3< T >::concatenate ( const Affine3< T > & affine) const

a.concatenate(affine) 等價於 affine * a;

◆ Identity()

template<typename T >
static Affine3 cv::Affine3< T >::Identity ( )
static

建立一個 4x4 單位變換。

◆ inv()

template<typename T >
Affine3 cv::Affine3< T >::inv ( int method = cv::DECOMP_SVD) const
返回
當前矩陣的逆。

◆ linear() [1/2]

template<typename T >
Mat3 cv::Affine3< T >::linear ( ) const
返回
左上角 3x3 部分

◆ linear() [2/2]

template<typename T >
void cv::Affine3< T >::linear ( const Mat3 & L)

將 3x3 矩陣 L 複製到當前矩陣的左上角部分

它設定矩陣的左上角 3x3 部分。其餘部分不受影響。

引數
L3x3 矩陣。

◆ operator Affine3< Y >()

template<typename T >
template<typename Y >
cv::Affine3< T >::operator Affine3< Y > ( ) const

◆ rotate() [1/2]

template<typename T >
Affine3 cv::Affine3< T >::rotate ( const Mat3 & R) const

a.rotate(R) 等價於 Affine(R, 0) * a;

◆ rotate() [2/2]

template<typename T >
Affine3 cv::Affine3< T >::rotate ( const Vec3 & rvec) const

a.rotate(rvec) 等價於 Affine(rvec, 0) * a;

◆ rotation() [1/4]

template<typename T >
Mat3 cv::Affine3< T >::rotation ( ) const
返回
左上角 3x3 部分

◆ rotation() [2/4]

template<typename T >
void cv::Affine3< T >::rotation ( const Mat & data)

結合了上述旋轉方法。支援 3x3、1x3、3x1 大小的資料矩陣。

它設定矩陣的左上角 3x3 部分。其餘部分不受影響。

引數
data1 通道矩陣。當它是 3x3 矩陣時,它設定當前矩陣的左上角 3x3 部分。當它是 1x3 或 3x1 矩陣時,它被用作旋轉向量。Rodrigues 公式用於計算旋轉矩陣並設定當前矩陣的左上角 3x3 部分。

◆ rotation() [3/4]

template<typename T >
void cv::Affine3< T >::rotation ( const Mat3 & R)

旋轉矩陣。

將旋轉矩陣複製到當前矩陣的左上角 3x3 部分。當前矩陣的其餘元素保持不變。

引數
R3x3 旋轉矩陣。

◆ rotation() [4/4]

template<typename T >
void cv::Affine3< T >::rotation ( const Vec3 & rvec)

Rodrigues 向量。

它設定矩陣的左上角 3x3 部分。其餘部分不受影響。

引數
rvec3x1 旋轉向量。方向表示旋轉軸,其長度表示以弧度為單位的旋轉角度(遵循右手拇指定則)。

◆ rvec()

template<typename T >
Vec3 cv::Affine3< T >::rvec ( ) const

Rodrigues 向量。

返回
表示當前矩陣左上角 3x3 旋轉矩陣的向量。
警告
由於旋轉向量和旋轉矩陣之間的對映是多對一的,此函式僅返回一個表示當前旋轉矩陣的旋轉向量,它不一定與透過 rotation(const Vec3& rvec) 設定的向量相同。

◆ translate()

template<typename T >
Affine3 cv::Affine3< T >::translate ( const Vec3 & t) const

a.translate(t) 等價於 Affine(E, t) * a,其中 E 是單位矩陣

◆ translation() [1/2]

template<typename T >
Vec3 cv::Affine3< T >::translation ( ) const
返回
右上角 3x1 部分

◆ translation() [2/2]

template<typename T >
void cv::Affine3< T >::translation ( const Vec3 & t)

將 t 複製到當前矩陣最後一列的前三個元素

它設定矩陣的右上角 3x1 部分。其餘部分不受影響。

引數
t3x1 平移向量。

成員資料文件

◆ matrix

template<typename T >
Mat4 cv::Affine3< T >::matrix

此類的文件是從以下檔案生成的