Leaper Vision Toolkit
中文 / English 2.x
Public 成员函数 | 属性
ILTransform接口 参考

该接口对应一个 2D 坐标系。 更多...

类 ILTransform 继承关系图:
ILObject LTransform

Public 成员函数

double Build (ILPoints *srcPoints, ILPoints *dstPoints, LPVTransformType type)
 
ILTransformInvert ()
 
ILTransformRotate (double da, LPVAxis axis)
 
ILTransformScale (double factorX, double factorY)
 
ILTransformTransform (ILTransform *tf)
 
ILTransformTranslate (double offsetX, double offsetY)
 
ILTransformTranspose ()
 
- Public 成员函数 继承自 ILObject
ILObjectCopy ()
 
LPVErrorCode Load (LString filename)
 
void Reset ()
 
LPVErrorCode Save (LString filename)
 
BOOL Valid ()
 

属性

LMatrix33 Matrix [get, set]
 \( 3 \times 3 \) 变换矩阵。默认为单位矩阵。
 
- 属性 继承自 ILObject
LString Name [get, set]
 对象的名称,默认为空。
大多数情况下,LPV 算法类并不使用这个名称。
ILDrawable::SetDrawName() 启用,该名称将被绘制在对象的附近 更多...
 

详细描述

该接口对应一个 2D 坐标系。

该接口用于定义 2D 坐标系的平移、缩放或旋转等变换以及坐标映射,其内部包含了一个完整的 \( 3 \times 3 \) 变换矩阵。

该变换矩阵可以通过 Scale(), Rotate()Translate() 等函数构建,也可直接修改 LMatrix33 的数据。 或者,也可以基于多个一一对应的点对,通过 Build() 函数计算最优的映射矩阵。

使用这个接口,需要创建一个 LTransform 对象。

示例代码

成员函数说明

◆ Build()

double Build ( ILPoints srcPoints,
ILPoints dstPoints,
LPVTransformType  type 
)

基于给定的来源和目标点,构建变换矩阵:

\[ dst \sim H src \]

使得来源点通过变换得到的点与目标点的平均距离误差最小。
推荐使用至少 4 个点对。

参数
[in]srcPoints来源点
[in]dstPoints目标点,与来源点的数量相同
[in]type变换矩阵的类型,通常配置为 LPVTransformHomography .
返回值
mapError返回变换误差,即目标点与变换结果点之间的距离的均值。若构造变换矩阵失败,返回 -1

◆ Invert()

ILTransform* Invert ( )

求逆得到一个新的变换矩阵。

返回值
result返回新的变换矩阵
自从
2.10.0

◆ Rotate()

ILTransform* Rotate ( double  da,
LPVAxis  axis 
)

将当前的坐标系按指定比例缩放,得到一个新的变换矩阵。 对于在图像坐标系下的旋转,旋转轴为 LPVAxisZ(即默认值),旋转角度为顺时针(因为图像的 Y 坐标轴朝下)。

参数
[in]da旋转角度
[in]axis旋转轴
返回值
result返回新的变换矩阵

◆ Scale()

ILTransform* Scale ( double  factorX,
double  factorY 
)

将当前的坐标系按指定比例缩放,得到一个新的变换矩阵

参数
[in]factorXx 方向的缩放比例
[in]factorYy 方向的缩放比例。默认设置为 0,即与 x 方向的缩放系数相同,也就是等比缩放。
返回值
result返回新的变换矩阵

◆ Transform()

ILTransform* Transform ( ILTransform tf)

应用指定变换矩阵到当前的坐标系,得到一个新的变换矩阵

参数
[in]tf变换矩阵
返回值
result返回新的变换矩阵

◆ Translate()

ILTransform* Translate ( double  offsetX,
double  offsetY 
)

将当前的坐标系按指定量平移,得到一个新的变换矩阵

参数
[in]offsetXx 方向的平移量
[in]offsetYy 方向的平移量
返回值
result返回新的变换矩阵

◆ Transpose()

ILTransform* Transpose ( )

转置得到一个新的变换矩阵。

返回值
result返回新的变换矩阵
自从
2.10.0