从 3d 点创建深度图 [英] Create depth map from 3d points

查看:40
本文介绍了从 3d 点创建深度图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经给出了场景的 3d 点或这些点的子集,包括场景的一个对象.我想从这些点创建一个深度图像,即图像中的像素值编码相应 3d 点到相机的距离.

I have given 3d points of a scene or a subset of these points comprising one object of the scene. I would like to create a depth image from these points, that is the pixel value in the image encodes the distance of the corresponding 3d point to the camera.

我发现了以下类似的问题

I have found the following similar question

http://www.mathworks.in/matlabcentral/newsreader/view_thread/319097

但是那里的答案对我没有帮助,因为我想使用 MATLAB.获取图像值并不困难(例如,简单地计算每个 3d 点到相机原点的距离),但是我不知道如何找出 2d 图像中的相应位置.

however the answers there do not help me, since I want to use MATLAB. To get the image values is not difficult (e.g. simply compute the distance of each 3d point to the camera's origin), however I do not know how to figure out the corresponding locations in the 2d image.

我只能想象您将所有 3d 点投影到一个平面上,然后将它们在平面上的位置合并到平面上的离散矩形中.然后你可以平均每个 bin 的深度值.然而,我可以想象这样一个过程的结果将是一个非常像素化的图像,不是很平滑.你会如何解决这个问题?

I could only imagine that you project all 3d points on a plane and bin their positions on the plane in discrete, well, rectangles on the plane. Then you could average the depth value for each bin. I could however imagine that the result of such a procedure would be a very pixelated image, not being very smooth. How would you go about this problem?

推荐答案

假设您已经校正了相机倾斜(如果您知道角度,则可以进行简单的矩阵乘法),您可能只需遵循 这个例子

Assuming you've corrected for camera tilt (a simple matrix multiplication if you know the angle), you can probably just follow this example

X = data(:,1);
Y = data(:,1);
Z = data(:,1);

%// This bit requires you to make some choices like the start X and Z, end X and Z and resolution (X and Z) of your desired depth map
[Xi, Zi] = meshgrid(X_start:X_res:X_end, Z_start:Z_res:Z_end);

depth_map = griddata(X,Z,Y,Xi,Zi)

这篇关于从 3d 点创建深度图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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