Projective geometry (投影几何)(一) 之 2D project plane (2D投影平面)

2023-10-20 03:59

本文主要是介绍Projective geometry (投影几何)(一) 之 2D project plane (2D投影平面),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

2D projectie plane

  • Points and lines
    • Homogeneous representation of points
    • 两条直线的交点 (intersection of two lines)
  • Ideal points and the line at infinity
    • 平行直线的交点
    • Ideal points and the line at infinity
    • Model for the projective plane
    • Duality
  • Conics and dual conics
    • Tangent lines to conics
    • Dual conics
    • Degenerate conics

Row and column vector 通常情况向量 x \boldsymbol{x} x代表着列向量, 行向量使用 x T \boldsymbol{x^T} xT

一个读者的感悟。
所有的知识点都是来源于书Multiple View of Geometry in Computer Vision 。读书的过程中觉得数学是一个很奇妙的东西。高中学习的知识在projective geometry中莫名被串了起来,形成了新的知识和新的系统。每一个定义和证明都非常巧妙有趣。受益匪浅。
PS 写博客过程中被导师提醒用英语写作可以锻炼research writing 的能力,所以博客后半段用英语写了。难以理解的地方尽量用中文注解。

Points and lines

在投影机和中点和线如何表示。通常情况下一条直线的表示方式为 a x + b y + c = 0 ax + by + c = 0 ax+by+c=0, 于是一条直线的向量我们可以表示为 ( a , b , c ) T (a, b, c)^T (a,b,c)T。然而这个表示并不是唯一的, 因为 ( k a ) x + ( k b ) y + ( k c ) = 0 (ka)x + (kb)y + (kc) = 0 (ka)x+(kb)y+(kc)=0对于任意 k k k, 表示的都是同一条直线, 所以向量可以表示为 k ( a , b , c ) T k(a, b, c)^T k(a,b,c)T。于是这里我们引用 Homogeneous representation of points.

Homogeneous representation of points

x = ( x , y ) T \boldsymbol{x}=(x,y)^T x=(x,y)T 在直线 l = ( a , b , c ) T \boldsymbol{l}=(a,b,c)^T l=(a,b,c)T上的条件为 a x + b y + c = 0 ax + by + c = 0 ax+by+c=0. 可以表示为 ( x , y , 1 ) ( a , b , c ) T = ( x , y , 1 ) l = ( k x , k y , k ) l = 0 (x,y,1)(a,b,c)^T = (x,y,1)\boldsymbol{l}= (kx,ky,k)\boldsymbol{l} = 0 (x,y,1)(a,b,c)T=(x,y,1)l=(kx,ky,k)l=0 这里的 ( k x , k y , k ) (kx,ky,k) (kx,ky,k)就是Homogeneous representation,所以投影空间的点可以表示为 ( x 1 , x 2 , x 3 ) (x_1, x_2, x_3) (x1,x2,x3),与之对应的二维空间的点应当表示为$(x_1/x_3, x_2/x_3).

Result2.1. The point x lies on the line l if and only if x T l = 0 x^Tl = 0 xTl=0.
Note that x T l = l T x = x . l x^Tl = l^Tx = x.l xTl=lTx=x.l.

两条直线的交点 (intersection of two lines)

两条直线 l = ( a , b , c ) T l = (a,b,c)^T l=(a,b,c)T and l ′ = ( a ′ , b ′ , c ′ ) T l' = (a',b',c')^T l=(a,b,c)T. x = l × l ′ x = l\times l' x=l×l(叉乘)。因为 l . ( l × l ′ ) = l ′ . ( l × l ′ ) l.( l\times l') = l'.(l \times l') l.(l×l)=l.(l×l), 所以 l T x = l ′ T x = 0 l^Tx = l'^Tx = 0 lTx=lTx=0。因此,如果点 x x x属于直线 l l l l ′ l' l x x x就是 l l l l ′ l' l的焦点。

Result2.2. The intersection of two lines l and l’ is the point x = l × l ′ x = l\times l' x=l×l

例如:直线x = 1 可以被写成-1x + 1 = 0, l = ( − 1 , 0 , 1 ) T l = (-1,0,1)^T l=(1,0,1)T同理直线y = 1可以被写作 l ′ = ( 0 , − 1 , 1 ) T l' = (0,-1,1)^T l=(0,1,1)T.
x = l × l ′ = ∣ i j k − 1 0 1 0 − 1 1 ∣ = ( 1 1 1 ) x = l \times l' = \begin{vmatrix} i &j &k \\-1 & 0 & 1 \\ 0 & -1 & 1 \end{vmatrix} = \begin{pmatrix} 1 \\ 1 \\1 \end{pmatrix} x=l×l=i10j01k11=111

Result 2.4. The line through two points x and x’ is l = x × x ′ l = x\times x' l=x×x

Ideal points and the line at infinity

理想点和无穷远处的线的定义。

平行直线的交点

两条直线 l = ( a , b , c ) T l = (a,b,c)^T l=(a,b,c)T l ′ = ( a , b , c ′ ) T l' = (a,b,c')^T l=(a,b,c)T。两条直线互相平行。交点 l × l ′ = ( c ′ − c ) ( b , − a , 0 ) T l\times l' = (c' - c)(b, -a, 0)^T l×l=(cc)(b,a,0)T,由于
( c ′ − c ) (c' - c) (cc)是常数,所以交点为 ( b , − a , 0 ) T (b, -a, 0)^T (b,a,0)T。当我们想要将这个点表示为2D的点的时候,我们发现这个点在无穷远处。所以在投影几何中,我们认为平行的直线相较于无穷远点。

例如:直线x = 1 可以被写成-1x + 1 = 0, l = ( − 1 , 0 , 1 ) T l = (-1,0,1)^T l=(1,0,1)T同理直线x = 2可以被写作 l ′ = ( − 1 , 0 , 2 ) T l' = (-1,0,2)^T l=(1,0,2)T.
x = l × l ′ = ∣ i j k − 1 0 1 − 1 0 2 ∣ = ( 0 1 0 ) x = l \times l' = \begin{vmatrix} i &j &k \\-1 & 0 & 1 \\ -1 & 0 & 2 \end{vmatrix} = \begin{pmatrix} 0 \\ 1 \\0 \end{pmatrix} x=l×l=i11j00k12=010

Ideal points and the line at infinity

For the homogeneous points, 如果向量 x = ( x 1 , x 2 , x 3 ) x = (x_1, x_2, x_3) x=(x1,x2,x3)中, x 3 = 0 x_3 = 0 x3=0, 那么这个点被称为ideal points or points at infinity。这一系列ideal points 是位于一条直线上的 叫做line at infinity l ∞ = ( 0 , 0 , 1 ) l_\infty = (0,0,1) l=(0,0,1),因为 ( 0 , 0 , 1 ) ( x 1 , x 2 , 0 ) T = 0 (0,0,1)(x_1, x_2, 0)^T = 0 (0,0,1)(x1,x2,0)T=0.
Note that l = ( a , b , c ) l = (a,b,c) l=(a,b,c) and l ′ = ( a , b , c ′ ) l' = (a,b,c') l=(a,b,c) l ∞ l_\infty l相交于同一点 ( b , − a , 0 ) T (b, -a, 0)^T (b,a,0)T。在普通几何学中, ( b , − a ) (b,-a) (b,a)是一个与直线相切的向量,所以与直线互相垂直的向量可以表示为 ( a , b ) (a,b) (a,b),可以表示直线的方向。Consequently, the direction of the lines varies as the coordinate of the ideal point ( b , − a , 0 ) T (b, -a, 0)^T (b,a,0)T so the line at infinity can be regarded as a set of direction of the lines in the plane.

Model for the projective plane

Duality

The results above have duality. The equation l T x = 0 l^Tx = 0 lTx=0 for the line and point is symmetric since l T x = 0 l^Tx = 0 lTx=0 implies x T l = 0 x^Tl = 0 xTl=0. Similarly, the results 2.2 and 2.4 have duality as well. So we can get the result of Duality principle.

Result 2.6. Duality principle To any theroem of 2-dimensional projective geometry there corresponds a dual theorem, which may be derived by interchanging the role of points and lines in the original theorem.

Conics and dual conics

Conic is a curve (这里的conic是指圆锥曲线) described by second-degree equation. Conics: hyperbola, ellipse and parabola (non-degenerate conics).

Note that: 在这里插入图片描述

The equation of conic can be written as:

a x 2 + b x y + c y 2 + d x + e y + f = 0 ax^2 +bxy+cy^2+dx+ey+f = 0 ax2+bxy+cy2+dx+ey+f=0

We can rewrite it with homogeous coordinate by replacement: x = x 1 / x 3 x = x_1/x_3 x=x1/x3, y = x 2 / x 3 y = x_2/x_3 y=x2/x3, so that the equation is:
a x 1 2 + b x 1 x 2 + c x 2 2 + d x 1 x 3 + e x 2 x 3 + f x 3 2 = 0 ax_1^2 +bx_1x_2+cx_2^2+dx_1x_3+ex_2x_3+fx_3^2 = 0 ax12+bx1x2+cx22+dx1x3+ex2x3+fx32=0
or formula x T C x = 0 x^TCx = 0 xTCx=0, where the conic coeffieient matrix C C C is given by:
C = ( a b / 2 d / 2 b / 2 c e / 2 d / 2 e / 2 f ) C = \begin{pmatrix} a&b/2 & d/2 \\ b/2 &c&e/2 \\d/2&e/2&f \end{pmatrix} C=ab/2d/2b/2ce/2d/2e/2f

It is symmetric and has 5 degree of freedom (五个未知数).

Thus, 5 points can define a conic.

Tangent lines to conics

Result 2.7. The line l l l tangent to C C C at point x x x on C C C is given by l = C x l = Cx l=Cx

Proof: (需添加proof)

Dual conics

The description in Reuslt 2.7 is defined by points. We can change it to lines which we denote as C ∗ C^* C. A line tangent to conic C C C satisfied l T C ∗ l = 0 l^TC^*l = 0 lTCl=0. C ∗ C^* C is the adjoint matrix of C C C. For non-singular symmetric matrix C ∗ = C − 1 C^* = C^{-1} C=C1.

What’s more, from Reuslt 2.7, at the point x, the tangent line is l = C x l = Cx l=Cx, which indicates that the points x at the line l l l which intersects the C as x = C − 1 l x = C^{-1}l x=C1l. Since x T C x = 0 x^TCx = 0 xTCx=0, we obtain ( C − 1 l ) T C ( C − 1 l ) = l T C ∗ l = 0 (C^{-1}l)^TC(C^{-1}l) = l^TC^*l = 0 (C1l)TC(C1l)=lTCl=0 (because C is symmetric matrix, we can get C T = C − 1 C^T = C^{-1} CT=C1).

Similarly, 5 lines can define a dual conic.

Degenerate conics

When the matrix C does not have full rank, then the conic is degenerate. Degenerate point conics include two lines (rank 2), and a repeated line (rank 1).

(需添加example)

这篇关于Projective geometry (投影几何)(一) 之 2D project plane (2D投影平面)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/244512

相关文章

uva 10387 Billiard(简单几何)

题意是一个球从矩形的中点出发,告诉你小球与矩形两条边的碰撞次数与小球回到原点的时间,求小球出发时的角度和小球的速度。 简单的几何问题,小球每与竖边碰撞一次,向右扩展一个相同的矩形;每与横边碰撞一次,向上扩展一个相同的矩形。 可以发现,扩展矩形的路径和在当前矩形中的每一段路径相同,当小球回到出发点时,一条直线的路径刚好经过最后一个扩展矩形的中心点。 最后扩展的路径和横边竖边恰好组成一个直

poj 1113 凸包+简单几何计算

题意: 给N个平面上的点,现在要在离点外L米处建城墙,使得城墙把所有点都包含进去且城墙的长度最短。 解析: 韬哥出的某次训练赛上A出的第一道计算几何,算是大水题吧。 用convexhull算法把凸包求出来,然后加加减减就A了。 计算见下图: 好久没玩画图了啊好开心。 代码: #include <iostream>#include <cstdio>#inclu

uva 1342 欧拉定理(计算几何模板)

题意: 给几个点,把这几个点用直线连起来,求这些直线把平面分成了几个。 解析: 欧拉定理: 顶点数 + 面数 - 边数= 2。 代码: #include <iostream>#include <cstdio>#include <cstdlib>#include <algorithm>#include <cstring>#include <cmath>#inc

XTU 1237 计算几何

题面: Magic Triangle Problem Description: Huangriq is a respectful acmer in ACM team of XTU because he brought the best place in regional contest in history of XTU. Huangriq works in a big compa

poj 3304 几何

题目大意:给出n条线段两个端点的坐标,问所有线段投影到一条直线上,如果这些所有投影至少相交于一点就输出Yes!,否则输出No!。 解题思路:如果存在这样的直线,过投影相交点(或投影相交区域中的点)作直线的垂线,该垂线(也是直线)必定与每条线段相交,问题转化为问是否存在一条直线和所有线段相交。 若存在一条直线与所有线段相交,此时该直线必定经过这些线段的某两个端点,所以枚举任意两个端点即可。

POJ 2318 几何 POJ 2398

给出0 , 1 , 2 ... n 个盒子, 和m个点, 统计每个盒子里面的点的个数。 const double eps = 1e-10 ;double add(double x , double y){if(fabs(x+y) < eps*(fabs(x) + fabs(y))) return 0 ;return x + y ;}struct Point{double x , y

poj 2653 几何

按顺序给一系列的线段,问最终哪些线段处在顶端(俯视图是完整的)。 const double eps = 1e-10 ;double add(double x , double y){if(fabs(x+y) < eps*(fabs(x) + fabs(y))) return 0 ;return x + y ;}struct Point{double x , y ;Point(){}Po

Debugging Lua Project created in Cocos Code IDE creates “Waiting for debugger to connect” in Win-7

转自 I Installed Cocos Code IDE and created a new Lua Project. When Debugging the Project(F11) the game window pops up and gives me the message waiting for debugger to connect and then freezes. Also a

Matter.js:Web开发者的2D物理引擎

Matter.js:Web开发者的2D物理引擎 前言 在现代网页开发中,交互性和动态效果是提升用户体验的关键因素。 Matter.js,一个专为网页设计的2D物理引擎,为开发者提供了一种简单而强大的方式,来实现复杂的物理交互效果。 无论是模拟重力、碰撞还是复杂的物体运动,Matter.js 都能轻松应对。 本文将带你深入了解 Matter.js ,并提供实际的代码示例,让你一窥其强大功能

求空间直线与平面的交点

若直线不与平面平行,将存在交点。如下图所示,已知直线L过点m(m1,m2,m3),且方向向量为VL(v1,v2,v3),平面P过点n(n1,n2,n3),且法线方向向量为VP(vp1,vp2,vp3),求得直线与平面的交点O的坐标(x,y,z): 将直线方程写成参数方程形式,即有: x = m1+ v1 * t y = m2+ v2 * t