什么是透视图投射矩阵perspective projective matrix?
空间物体的坐标乘以投射矩阵,那么就可以把空间的物体投射到屏幕上。
大体是这样的矩阵:
这里探讨一个问题:为什么乘以这个矩阵就可以把空间物体投射到屏幕上了呢?
看看下面的图:
其中的Projection Window就是我们的屏幕位置。
我们需要把所有两条斜边和Near Plane 和Far Plane之中的所有物体影像投影到Projection Window中显示出来。
如下图:
就是要把y投影到Projection Window成为y`
这个时候要计算y`的位置。如果是三维空间,那么原y的坐标点是(x,y,z),那么在平面上的点的坐标就为(x`,y`,d)
为什么最后是d。因为Projection Window平面的方程就是z = d,这个平面上的所有点的z轴都为d。
这样需要使用稍微复杂一点的数学知识计算,就会得到从坐标点(x,y,z)到(x`,y`,d)的计算公式,然后这个公式使用矩阵的形式表示出来,就得到了这里所要说的perspective projective matrix.(这里省去其中的数学知识讨论)。
最后就利用这一个矩阵就会神奇地把空间坐标投影到屏幕上了。
对应的directx代码:
XMMATRIX P = XMMatrixPerspectiveFovLH(0.25f*XM_PI,AspectRatio(), 10.0f, 100.0f);
掌握了这个知识点,就不会觉得这个函数是那么神秘的了,自己也能写出来。
当然恶补一下其中的数学知识,并加以练习应该理解会更加深。
毕竟这些数学的知识加上三维空间的东西,我觉得就构成了计算机学科中最难理解的方向(之一?)了。
分享到:
相关推荐
计算双目视觉模型下投影矩阵的vs2008平台下c++程序代码
Richardson-Lucy Deblurring for Scenes under a Projective Motion Path
Shape-Preserving Half-Projective Warps for Image Stitching.pdf
该文件中包含了Adaptive as-natural-as-possible image stitching论文以及As-Projective-As-Possible Image Stitching with Moving DLT这两种较为经典的图像拼接方法。具体包含了ransac算法、multi-GSsampling算法、...
基于射影几何相关的内容,在摄像机标定的分布算法中计算射影矩阵和仿射矩阵
投影矩阵的教程 Introduction Projective texture mapping is a method of texture mapping described by Segal [3] that allows the texture image to be projected onto the scene as if by a slide projector. ...
描述使用纹理映射做Shadow渲染的好文,PDF格式
computer vision projective ambiguitycomputer vision projective ambiguitycomputer vision projective ambiguitycomputer vision projective ambiguity
Meaning of Elementary Matrices in Projective Geometry and Its applications Perspective projection and elementary matrices
As-Projective-As-Possible Image Stitching with Moving DLT
投射平面,GTM006.Projective.Planes,.Daniel.R..Hughes,.Fred.C..Piper,数学
mdlt.zip——As-Projective-As-Possible Image Stitching with Moving DLT(APAP) AANAP-master.zip——Adaptive As-Natural-As-Possible Image Stitching(AANAP) SPHP_Image_Stitching-master1.zip——Shape-...
The goal of this project is to explore the ...Facilities such as flat shading, diffuse lighting, projective textures, and mipmapping can be used to replace traditional numerical solutions for radiosity.
讲述了分层重构的原理和相关实验,是学习分层重建不可或缺的经典论文。
此函数使用 DLT、RANSAC 和 Lev-Mar 优化估计两个图像之间的 2D-2D 投影单应性。 函数调用格式如下: [h wim] = homography...im1 -> 第一张图片im2 -> 第二张图片h -> 返回的单应矩阵wim -> im1 wrt im2 的变形版本
相机自标定的经典论文,作者是Sturm和Triggs
这是关于投影几何的电子书,高清,最新版本,经典著作,英文版
一本讲解投影机和在计算机图形学中应用的书籍。希望对需要的朋友有所帮助。
射影几何的书,不错的入门教程,不过是外文版的,非常不错