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

查看:52
本文介绍了将 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天全站免登陆