将3D模型投影到2D平面上 [英] Projecting 3D Model onto 2d plane

查看:156
本文介绍了将3D模型投影到2D平面上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个3d对象,并希望向各个方向导出它。假设我有家庭图片,如果我将其投影到2d平面上,它只会显示出类似正方形的东西,但是如果我改变角度,它会给我不同的视图(在简而言之,我想要同一个3d对象的不同2d投影以实现更好的可视化)。我正在寻找能够做到这一点的python库或算法。请参考图以清楚地知道我想要什么。



右侧的矢量是3D模型的许多3D顶点之一。矩阵[r_11 ... t_3]是一个刚性变换,表示飞机的位置和方向(有人称其为相机姿态或外部相机参数)。您将针对每个单独的投影更改此矩阵。矩阵[f_x ... 1]定义了投影本身,通常保持不变。对于您的应用程序,可能仅使用身份矩阵(因此,您可以忽略它)。最后一步是以这种方式缩放变换后的矢量,即它以z = 1的距离放置在图像平面上。u_x和u_y是您对应的2D坐标。


I have a 3d object, and wish to export it in all direction.Suppose I have home picture and if I project it on 2d plane it only show me something like square but if I change angle it give me different view(In short I want different 2d projection of same 3d object for better visualization).I am looking for python library or algorithm which able to do that.Please ref diagram to get clear idea what i want.enter image description here

解决方案

This can be done with the projective transformation. This are actually just two matrix multiplication and one division. Might be written in one line of Python.

The vector on the right is one of your many 3D vertices of the 3D model. The matrix [r_11 ... t_3] is a rigid transformation and represents the location and orientation of your plane (some people call it camera pose or extrinsic camera parameters). This matrix you are going to change for each individual projection. The matrix [f_x ... 1] defines the projection itself and remains usually unchanged. With your application, it might be possible to just use the identity matrix (therefore, you could ignore it). The last step is scaling the transformed vector in the way, that it lays on the image plane in a distance of z = 1. u_x and u_y are your corresponding 2D coordinates.

这篇关于将3D模型投影到2D平面上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆