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

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

问题描述

我已经给出了一个场景的三维点或这些点的一个子集,它们构成了场景的一个对象。我想从这些点创建一个深度图像,也就是图像中的像素值将相应3d点的距离编码到相机。



我找到了以下类似的问题



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



但有答案不帮我,因为我想用MATLAB。要获得图像值并不困难(例如,简单地计算每个3d点到相机原点的距离),但是我不知道如何计算出二维图像中的相应位置。



我只能想象你在一架飞机上投影所有的3d点,并将它们在飞机上的位置放在离散的,很好的矩形平面上。然后,您可以平均每个垃圾箱的深度值。
然而,我可以想象这样一个程序的结果是一个非常像素化的图像,不是很平滑。
如何解决这个问题?解析方案

假设你已经校正了相机倾斜(一个简单的矩阵乘法如果你知道角度),你可以按照这个例子

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

%//这个位需要你做一些选择,比如开始的X和Z,结束的X和Z以及你想要的深度图的分辨率(X和Z)
[Xi,Zi ] = meshgrid(X_start:X_res:X_end,Z_start:Z_res:Z_end);

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


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

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.

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天全站免登陆