简体   繁体   English

如何在Matlab中将3D空间中的一组点投影到2D平面上?

[英]How can I project a group of points in 3D space onto a 2D plane in Matlab?

I'm making an animation in Matlab: I have 15 dots moving around in a 3D space. 我在Matlab制作动画:我在3D空间中有15个点移动。 Their XYZ co-ordinates and movement are taken from motion-capture data. 他们的XYZ坐标和运动取自运动捕捉数据。 I need to show how the dots are moving from the perspective of an observer "in front" of the motion. 我需要展示点是如何从运动“前方”的观察者的角度移动的。 What I'm trying right now is to create a 2D plane and to move it towards the dots so that they end up "projected" onto it. 我现在正在尝试的是创建一个2D平面并将其移向点,以便它们最终“投射”到它上面。 However, it's not a standard XY or YZ plane, so I'm having trouble figuring out how to make this work. 但是,它不是标准的XY或YZ平面,所以我无法弄清楚如何使这项工作。

How can I make this plane do what I want - or is there another way I should be trying? 我怎样才能让这架飞机做我想做的事 - 或者我应该尝试另一种方式?

What you're aiming for is basically implementing an ideal pinhole camera, where the pinhole becomes a point in space. 你的目标是基本上实现一个理想的针孔相机,其中针孔成为空间中的一个点。 Each of your 3D points plus the "pinhole" defines a line in 3D space, which intersects with your projection plane at some point. 每个3D点加上“针孔”在3D空间中定义一条线,该线在某个点与投影平面相交。 It looks somewhat like this: 看起来有点像这样: pinhole camera

x_1 and y_1 should have the same length, ie 1, so "x" in 3D space is defined as x = o_1 + a * x_1 + b * y_1. x_1和y_1应具有相同的长度,即1,因此3D空间中的“x”定义为x = o_1 + a * x_1 + b * y_1。 In your 2D projection, a and b become your coordinates for plotting. 在2D投影中,a和b成为绘图的坐标。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM