2D运动模型

2D运动模型


image-20240328140629841

其中相应的运动可以通过变换矩阵实现

基本运算

平移

image-20240331170404167

[ x ′ y ′ 1 ] = [ 1 0 t x 0 1 t y 0 0 1 ] [ x y 1 ] = [ I t 0 T 1 ] [ x y 1 ] \begin{aligned} \begin{bmatrix}x'\\y'\\1\end{bmatrix} &=\begin{bmatrix}1&0&t_x\\0&1&t_y\\0&0&1\end{bmatrix}\begin{bmatrix}x\\y\\1\end{bmatrix}\\ &=\begin{bmatrix}I&t\\0^T&1\end{bmatrix}\begin{bmatrix}x\\y\\1\end{bmatrix} \end{aligned} xy1 = 100010txty1 xy1 =[I0Tt1] xy1

I : 2 × 2 的单位矩阵 I:2\times2的单位矩阵 I:2×2的单位矩阵
t = [ t x , t y ] T : 2 t=\begin{bmatrix}t_x,t_y\end{bmatrix}^T:2 t=[tx,ty]T:2D平移向量

缩放

缩放:坐标系的每个轴乘以一个标量/缩放因子

均匀缩放:所有轴的缩放因子相同

image-20240331170326969
[ x ′ y 1 ] = [ s 0 0 0 s 0 0 0 1 ] [ x y 1 ] = [ s I 0 0 T 1 ] [ x y 1 ] \begin{aligned}\begin{bmatrix}x^{\prime}\\y\\1\end{bmatrix}&=\begin{bmatrix}s&0&0\\0&s&0\\0&0&1\end{bmatrix}\begin{bmatrix}x\\y\\1\end{bmatrix}\\&=\begin{bmatrix}sI&0\\0^{\mathrm{T}}&1\end{bmatrix}\begin{bmatrix}x\\y\\1\end{bmatrix}\end{aligned} xy1 = s000s0001 xy1 =[sI0T01] xy1
非均匀缩放:不同轴的缩放因子不同

image-20240331170310241
[ x ′ y ′ 1 ] = [ s x 0 0 0 s y 0 0 0 1 ] [ x y 1 ] \begin{bmatrix}x^{\prime}\\y^{\prime}\\1\end{bmatrix}=\begin{bmatrix}{s_x}&0&0\\0&{s_y}&0\\0&0&1\end{bmatrix}\begin{bmatrix}x\\y\\1\end{bmatrix} xy1 = sx000sy0001 xy1

错切

方形变平行四边形,

x轴不变,沿y轴方向错切

image-20240331170220765
[ x ′ y ′ 1 ] = [ 1 0 0 β y 1 0 0 0 1 ] [ x y 1 ] \begin{bmatrix}x^{\prime}\\y^{\prime}\\1\end{bmatrix}=\begin{bmatrix}1&0&0\\\beta_y&1&0\\0&0&1\end{bmatrix}\begin{bmatrix}x\\y\\1\end{bmatrix} xy1 = 1βy0010001 xy1
y轴不变,沿x轴方向错切

image-20240331170239838
[ x ′ y ′ 1 ] = [ 1 β x 0 0 1 0 0 0 1 ] [ x y 1 ] \begin{bmatrix}x^{\prime}\\y^{\prime}\\1\end{bmatrix}=\begin{bmatrix}1&{\beta_x}&0\\0&1&0\\0&0&1\end{bmatrix}\begin{bmatrix}x\\y\\1\end{bmatrix} xy1 = 100βx10001 xy1
任意一边都可以被拉长

image-20240331170142794
[ x ′ y ′ 1 ] = [ 1 β x 0 β y 1 0 0 0 1 ] [ x y 1 ] \begin{bmatrix}x^{\prime}\\y^{\prime}\\1\end{bmatrix}=\begin{bmatrix}1&{\beta_x}&0\\{\beta_y}&1&0\\0&0&1\end{bmatrix}\begin{bmatrix}x\\y\\1\end{bmatrix} xy1 = 1βy0βx10001 xy1

旋转

image-20240331170715129
[ x ′ y ′ 1 ] = [ cos ⁡ ( θ ) − sin ⁡ ( θ ) 0 sin ⁡ ( θ ) cos ⁡ ( θ ) 0 0 0 1 ] [ x y 1 ] \begin{bmatrix}x^{\prime}\\y^{\prime}\\1\end{bmatrix}=\begin{bmatrix}\cos(\theta)&-\sin(\theta)&0\\\sin(\theta)&\cos(\theta)&0\\0&0&1\end{bmatrix} \begin{bmatrix} x\\y\\1 \end{bmatrix} xy1 = cos(θ)sin(θ)0sin(θ)cos(θ)0001 xy1
综上所述

平移 缩放 错切 旋转
[ x ′ y ′ 1 ] = [ 1 0 t x 0 1 t y 0 0 1 ] [ x y 1 ] \begin{bmatrix}x^{\prime}\\y^{\prime}\\1\end{bmatrix}=\begin{bmatrix}1&0&\color{red}{t_x}\\0&1&\color{red}{t_y}\\0&0&1\end{bmatrix}\begin{bmatrix}x\\y\\1\end{bmatrix} xy1 = 100010txty1 xy1 [ x ′ y ′ 1 ] = [ s x 0 0 0 s y 0 0 0 1 ] [ x y 1 ] \begin{bmatrix}x^{\prime}\\y^{\prime}\\1\end{bmatrix}=\begin{bmatrix}\color{red}{s_x}&0&0\\0&\color{red}{s_y}&0\\0&0&1\end{bmatrix}\begin{bmatrix}x\\y\\1\end{bmatrix} xy1 = sx000sy0001 xy1 [ x ′ y ′ 1 ] = [ 1 β x 0 β y 1 0 0 0 1 ] [ x y 1 ] \begin{bmatrix}x^{\prime}\\y^{\prime}\\1\end{bmatrix}=\begin{bmatrix}1&\color{red}{\beta_x}&0\\\color{red}{\beta_y}&1&0\\0&0&1\end{bmatrix}\begin{bmatrix}x\\y\\1\end{bmatrix} xy1 = 1βy0βx10001 xy1 [ x ′ y ′ 1 ] = [ cos ⁡ ( θ ) − sin ⁡ ( θ ) 0 sin ⁡ ( θ ) cos ⁡ ( θ ) 0 0 0 1 ] [ x y 1 ] \begin{bmatrix}x^{\prime}\\y^{\prime}\\1\end{bmatrix}=\begin{bmatrix}\cos({\color{red}\theta})&-\sin({\color{red} \theta})&0\\\sin({\color{red} \theta})&\cos({\color{red}\theta})&0\\0&0&1\end{bmatrix}\begin{bmatrix}x\\y\\1\end{bmatrix} xy1 = cos(θ)sin(θ)0sin(θ)cos(θ)0001 xy1

复合运算

可以通过矩阵乘法得到复杂变换,矩阵乘法的顺序不同,可能会得到不同的变换。

欧式(刚体)变化

欧式(刚体)变换:(先)旋转+(后)平移
[ r 11 r 12 t x r 21 r 22 t y 0 0 1 ] = [ R ( θ ) t 0 T 1 ] = [ cos ⁡ ( θ ) − sin ⁡ ( θ ) t x sin ⁡ ( θ ) cos ⁡ ( θ ) t y 0 0 1 ] = [ 1 0 t x 0 1 t y 0 0 1 ] [ cos ⁡ ( θ ) − sin ⁡ ( θ ) 0 sin ⁡ ( θ ) cos ⁡ ( θ ) 0 0 0 1 ] \begin{aligned}&\quad\begin{bmatrix}r_{11}&r_{12}&t_x\\r_{21}&r_{22}&t_y\\0&0&1\end{bmatrix}\\&=\begin{bmatrix}\boldsymbol{R}(\theta)&\boldsymbol{t}\\\boldsymbol{0}^\mathrm{T}&1\end{bmatrix}\\&=\begin{bmatrix}\cos(\theta)&-\sin(\theta)&t_x\\\sin(\theta)&\cos(\theta)&t_y\\0&0&1\end{bmatrix}\\&=\begin{bmatrix}1&0&\boldsymbol{t}_x\\0&1&\boldsymbol{t}_y\\0&0&1\end{bmatrix}\begin{bmatrix}\cos(\theta)&-\sin(\theta)&0\\\sin(\theta)&\cos(\theta)&0\\0&0&1\end{bmatrix}\end{aligned} r11r210r12r220txty1 =[R(θ)0Tt1]= cos(θ)sin(θ)0sin(θ)cos(θ)0txty1 = 100010txty1 cos(θ)sin(θ)0sin(θ)cos(θ)0001
其中自由度为3

等距变换

[ x ′ y ′ w ′ ] = [ ε c o s θ − s i n θ t x ε s i n θ c o s θ t y 0 0 1 ] [ x y 1 ] \begin{bmatrix}x^{\prime}\\y^{\prime}\\w^{\prime}\end{bmatrix}=\begin{bmatrix}{\varepsilon}\mathrm{cos}\theta&-\mathrm{sin}\theta&{t}_x\\\varepsilon\mathrm{sin}\theta&\mathrm{cos}\theta&{t}_y\\0&0&1\end{bmatrix}\begin{bmatrix}x\\y\\1\end{bmatrix} xyw = εcosθεsinθ0sinθcosθ0txty1 xy1

其中 ε \varepsilon ε​为1或-1

不变量:(绝对)长度、角度、面积

相似变换

相似变换:均匀缩放+旋转+平移
[ a − b t x b a t y 0 0 1 ] = [ s R ( θ ) t 0 T 1 ] = [ s cos ⁡ ( θ ) − s sin ⁡ ( θ ) t x s sin ⁡ ( θ ) s cos ⁡ ( θ ) t x 0 0 1 ] = [ 1 0 t x 0 1 t y 0 0 1 ] [ cos ⁡ ( θ ) − sin ⁡ ( θ ) 0 sin ⁡ ( θ ) cos ⁡ ( θ ) 0 0 0 1 ] [ s 0 0 0 s 0 0 0 1 ] \begin{aligned} &\quad\begin{bmatrix}a&-b&t_x\\b&a&t_y\\0&0&1\end{bmatrix}\\&=\begin{bmatrix}sR(\theta)&t\\0^\mathrm{T}&1\end{bmatrix}\\&=\begin{bmatrix}s\cos(\theta)&-s\sin(\theta)&t_x\\s\sin(\theta)&s\cos(\theta)&t_x\\0&0&1\end{bmatrix} \\ &=\begin{bmatrix}1&0&{t_x}\\0&1&{t_y}\\0&0&1\end{bmatrix}\begin{bmatrix}\cos(\theta)&-\sin(\theta)&0\\\sin(\theta)&\cos(\theta)&0\\0&0&1\end{bmatrix}\begin{bmatrix}{s}&0&0\\0&{s}&0\\0&0&1\end{bmatrix} \end{aligned} ab0ba0txty1 =[sR(θ)0Tt1]= scos(θ)ssin(θ)0ssin(θ)scos(θ)0txtx1 = 100010txty1 cos(θ)sin(θ)0sin(θ)cos(θ)0001 s000s0001
自由度为4

不变量: 长度的比例(相对长度)、角度、面积的比例、平行线

在刚体变换中:a2+b2=1

仿射变换

仿射变换:错切+均匀缩放+旋转+平移
[ a 11 a 12 t x a 21 a 22 t y 0 0 1 ] = [ s cos ⁡ ( θ ) − s sin ⁡ ( θ ) β y s cos ⁡ ( θ ) β x − s sin ⁡ ( θ ) t x s sin ⁡ ( θ ) + s cos ⁡ ( θ ) β y s sin ⁡ ( θ ) β x + s cos ⁡ ( θ ) t y 0 0 1 ] = [ 1 0 t x 0 1 t y 0 0 1 ] [ cos ⁡ ( θ ) − sin ⁡ ( θ ) 0 sin ⁡ ( θ ) cos ⁡ ( θ ) 0 0 0 1 ] [ s 0 0 0 s 0 0 0 1 ] [ 1 β x 0 β y 1 0 0 0 1 ] \begin{aligned} &\quad\begin{bmatrix}a_{11}&a_{12}&t_x\\a_{21}&a_{22}&t_y\\0&0&1\end{bmatrix}\\ &=\begin{bmatrix}s\cos(\theta)-s\sin(\theta)\beta_y&s\cos(\theta)\beta_x-s\sin(\theta)&t_x\\s\sin(\theta)+s\cos(\theta)\beta_y&s\sin(\theta)\beta_x+s\cos(\theta)&t_y\\0&0&1\end{bmatrix} \\ &=\begin{bmatrix}1&0&{t_x}\\0&1&{t_y}\\0&0&1\end{bmatrix}\begin{bmatrix}\cos(\theta)&-\sin(\theta)&0\\\sin(\theta)&\cos(\theta)&0\\0&0&1\end{bmatrix}\begin{bmatrix}{s}&0&0\\0&{s}&0\\0&0&1\end{bmatrix}\begin{bmatrix}1&{\beta_x}&0\\{\beta_y}&1&0\\0&0&1\end{bmatrix} \end{aligned} a11a210a12a220txty1 = scos(θ)ssin(θ)βyssin(θ)+scos(θ)βy0scos(θ)βxssin(θ)ssin(θ)βx+scos(θ)0txty1 = 100010txty1 cos(θ)sin(θ)0sin(θ)cos(θ)0001 s000s0001 1βy0βx10001
自由度为6

保持了图像的“平行性”和“平直性”,即图像中原来的直线和平行线,变换后仍然保持原来的直线和平行线

不变量: 平行线、平行长度的比例、面积比例

射影变换

[ x ′ y ′ w ′ ] = [ h 11 h 12 h 13 h 21 h 22 h 23 h 31 h 32 h 33 ] [ x y 1 ] \begin{bmatrix}x'\\y'\\w'\end{bmatrix}=\begin{bmatrix}h_{11}&h_{12}&h_{13}\\h_{21}&h_{22}&h_{23}\\h_{31}&h_{32}&h_{33}\end{bmatrix}\begin{bmatrix}x\\y\\1\end{bmatrix} xyw = h11h21h31h12h22h32h13h23h33 xy1

不变量:线上4点的交比(比例的比例),直线仍然是直的

综上所述

矩阵 失真 不变性质
射影(8DOF) [ h 11 h 12 h 13 h 21 h 22 h 23 h 31 h 32 h 33 ] \begin{bmatrix}h_{11}&h_{12}&h_{13}\\h_{21}&h_{22}&h_{23}\\h_{31}&h_{32}&h_{33}\end{bmatrix} h11h21h31h12h22h32h13h23h33 image-20240331175520244 共点、共线、接触的阶:相交(1阶接触)、相切(二阶接触)、拐点(3阶接触)、交比
仿射(6DOF) [ a 11 a 12 t x a 21 a 22 t y 0 0 1 ] \begin{bmatrix}a_{11}&a_{12}&t_x\\a_{21}&a_{22}&t_y\\0&0&1\end{bmatrix} a11a210a12a220txty1 image-20240331175530194 平行、面积比、平行线的长度比(如中点)、向量的线性组合(如形心)、无穷远直线l_∞_
相似(4DOF) [ s r 11 s r 12 t x s r 21 s r 22 t y 0 0 1 ] \begin{bmatrix}sr_{11}&sr_{12}&t_x\\sr_{21}&sr_{22}&t_y\\0&0&1\end{bmatrix} sr11sr210sr12sr220txty1 image-20240331175537986 长度比、角度、虚圆点 I,J
欧氏(3DOF) [ r 11 r 12 t x r 21 r 22 t y 0 0 1 ] \begin{bmatrix}r_{11}&r_{12}&t_x\\r_{21}&r_{22}&t_y\\0&0&1\end{bmatrix} r11r210r12r220txty1 image-20240331175546595 长度、面积

[!CAUTION]

给定同一条直线上的4个点 x 1 , x 2 , x 3 , x 4 x_1,x_2,x_3,x_4 x1,x2,x3,x4, 交比定义为:
cos ⁡ ( x 1 , x 2 , x 3 , x 4 ) = ∥ x 1 x 3 ∥ ∥ x 1 x 4 ∥ ∥ x 2 x 3 ∥ ∥ x 2 x 4 ∥ \cos(x_1,x_2,x_3,x_4)=\frac{\|x_1x_3\|\|x_1x_4\|}{\|x_2x_3\|\|x_2x_4\|} cos(x1,x2,x3,x4)=x2x3∥∥x2x4x1x3∥∥x1x4
其中 ∥ x i x j ∥ = det ⁡ [ x i 1 x j 1 x i 2 x j 2 ] \|x_{i}x_{j}\|=\det\begin{bmatrix}x_{i1}&x_{j1}\\x_{i2}&x_{j2}\end{bmatrix} xixj=det[xi1xi2xj1xj2]

相关推荐

  1. Vue-live2d在项目中展示Live2D 模型

    2024-04-09 22:02:05       43 阅读
  2. 3D人体运动重建

    2024-04-09 22:02:05       67 阅读
  3. 李沐深度学习-d2lzh_pytorch模块实现

    2024-04-09 22:02:05       45 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-04-09 22:02:05       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-04-09 22:02:05       100 阅读
  3. 在Django里面运行非项目文件

    2024-04-09 22:02:05       82 阅读
  4. Python语言-面向对象

    2024-04-09 22:02:05       91 阅读

热门阅读

  1. 数据驱动决策的秘密武器:一探FineBI的核心功能

    2024-04-09 22:02:05       40 阅读
  2. 边界框转化

    2024-04-09 22:02:05       38 阅读
  3. Istio-learning-note-about-Traffic Shifting(三)

    2024-04-09 22:02:05       41 阅读
  4. 从0开始复习python~

    2024-04-09 22:02:05       32 阅读
  5. InfluxDB2的数据查询示例

    2024-04-09 22:02:05       33 阅读
  6. Redis数据倾斜

    2024-04-09 22:02:05       36 阅读
  7. [设计模式]命令模式(Command)

    2024-04-09 22:02:05       33 阅读
  8. R语言基础

    2024-04-09 22:02:05       33 阅读
  9. OneFlow深度学习框架介绍

    2024-04-09 22:02:05       29 阅读
  10. OneFlow深度学习框架介绍

    2024-04-09 22:02:05       35 阅读
  11. OneFlow深度学习框架介绍

    2024-04-09 22:02:05       30 阅读
  12. OneFlow深度学习框架介绍

    2024-04-09 22:02:05       42 阅读
  13. 探索下一代深度学习框架:OneFlow

    2024-04-09 22:02:05       37 阅读