1

What I want to do is to raycast a pointcloud to a 2D image. What I have is a 3D PointCloud and a Viewpoint which is different to the general world coordinate system. I would like to raycast from this Viewpoint to generate a 2D image of the point cloud. So, I just need a method like getintersectedvoxel which is doing the casting for the whole area and not only for a single ray.

4

1 回答 1

0

那是从 3D 到相机的投影。您可以使用针孔相机模型方程得到它(如图所示

您需要定义相机的前 3 个参数:焦距f和投影平面的中心:cxcy。这样你就可以创建一个 3x3 矩阵(我将使用 matlab 语法):

A = [ f 0 cx;
      0 f cy;
      0 0  1 ];

您可以使用类似cx = 0.5 * image_width,cy = 0.5 * image_height和一些值作为f = 800(尝试其中一些以检查图像看起来如何更好)。

然后,一个 3x4 矩阵,从相机帧到点云帧的转换(你说你有它):

T = [ r11 r12 r13 tx;
      r21 r22 r23 ty;
      r31 r32 r33 tz ];

最后,您的点云在齐次坐标中,即在具有 N 个点的点云的 4xN 矩阵中:

P = [ x1 x2 ... xN;
      y1 y2 ... yN;
      z1 z2 ... zN;
       1  1 ...  1 ];

现在您可以投影点:

S = A * T * P;

S是一个 3xN 矩阵,其中每个第 i 个 3D 点的像素坐标为:

x = S(1, i) / S(3, i);
y = S(2, i) / S(3, i);
于 2013-08-22T14:38:18.507 回答