Create depth map from 3d points

徘徊边缘 提交于 2019-12-13 16:12:41

问题


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?


回答1:


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)


来源:https://stackoverflow.com/questions/24307057/create-depth-map-from-3d-points

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!