[英]How convert 3d world coordinates to 3d camera coordinates
I have an input 3D vector points in world coordinate system. 我在世界坐标系中输入了3D矢量点。 Can anyone describe or provide a link to a resource that will help me understand and implement the required transformation and matrix mapping to convert into camera coordinates? 谁能描述或提供资源链接,以帮助我理解和实现所需的转换和矩阵映射以转换为相机坐标? Image for this http://www.mathworks.in/help/matlab/visualize/chview3.gif I know the viewpoint coordinates in this image in world coordinates and them convert into camera coordinates 这个图片http://www.mathworks.in/help/matlab/visualize/chview3.gif我知道这张图片中的视点坐标是世界坐标,它们会转换为相机坐标
You have to apply two math operations: 您必须应用两个数学运算:
Example (the '|' just denotes the vector parentheses) 示例(“ |”仅表示向量括号)
|x'| |x| - |x_vp|
|y'| = |y| - |y_vp|
|z'| |z| - |z_vp|
Z: Z:
|x''| | cos a -sin a 0 | |x'|
|y''| = | sin a cos a 0 | * |y'|
|z''| | 0 0 1 | |z'|
Y: Y:
|x'''| | cos b 0 -sin b | |x''|
|y'''| = | 0 1 0 | * |y''|
|z'''| | sin b 0 cos b | |z''|
For example, if your VP is at (1, 1, 1), you first shift it so that the old origin now is at (-1, -1, -1) . 例如,如果您的VP位于(1,1,1),则首先将其移位,以使旧的原点现在位于(-1,-1,-1)。 The camera is still looking into positive x direction, so you would rotate it by 225 degree around z (now spotting on the old z axis) and then by 45 degree around y to spot directly on the old origin. 相机仍在朝x的正方向看,因此您可以将其绕z旋转225度(现在在旧的z轴上定位),然后绕y旋转45度以直接在旧原点上进行定位。
However, you do not rotate the camera, but the whole space around the camera, so you have to multiply the angles by -1. 但是,您不会旋转相机,而是旋转相机的整个空间,因此必须将角度乘以-1。
You can find more infos at http://en.wikipedia.org/wiki/Rotation_matrix 您可以在http://en.wikipedia.org/wiki/Rotation_matrix中找到更多信息
If you don't know matrix multiplication, the first chapter there shows it. 如果您不知道矩阵乘法,则在那里的第一章将介绍它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.