Open3d: Convert 3D point cloud to image

Created on 1 Jun 2020  路  5Comments  路  Source: intel-isl/Open3D

Hi, i have a XYZ point cloud and i want it to convert to image. For example to take all point in Z range form 0 to 0.5 m and make a image with pixel size 0,5mm. If there is no point make pixel white and is there is a point make pixel black. Is it posible to do it with Open3D (Sorry for my bad english)

question

All 5 comments

Did the upper method work for you?

Alternatively, if you need an image with a certain resolution, camera parameters, or distortion coefficients, you can use another method:

First, create an (empty or white) array of the corresponding size. Then, project your whole point cloud into uv/image coordinates by using OpenCVs cv.projectPoints(). Then you can iterate over your array and check each cell if there is a point in it. If yes: Paint that pixel black. (Also, you could average all points and create a depth map like this.)

This method should give you some more flexibility to adjust your parameters (like the pixel size). I just implemented something similar, so feel free to ask if you have any further struggles on that.

Hi,
Yes, the first answer was very helpful. The method did exactly was I asked for. However, I am still struggling with it. I need image for some operations (Hough transform) and then remove point from original point cloud. So I am need information about coordinates (which point is in which pixel). I have tried OpenCV, but I am really beginner, I cant get it working.

Do you want to create a 2D image or 3D image (volume) from point cloud?

The answer above does the job
However I could not get to fix the color in the exported rendering, so that points are not colored based on colormap along X,Y, or Z values. I would like to make all points fixed color and independent of the X,Y or X value of the point.
Here is the snippet:

pcd = o3d.io.read_point_cloud("file.pcd", format="pcd")
vis = o3d.visualization.Visualizer()
vis.create_window()
vis.get_render_option().point_color_option = o3d.visualization.PointColorOption.Color
vis.get_render_option().point_size = 3.0
vis.add_geometry(pcd)
vis.capture_screen_image("file.jpg", do_render=True)
vis.destroy_window()

Changing the options for vis.get_render_option().point_color_option cannot make it render in single color and coordinate-independent.
Does anyone have an advice? @yxlao

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mike239x picture mike239x  路  3Comments

edxsx picture edxsx  路  3Comments

mutp picture mutp  路  4Comments

martinakos picture martinakos  路  4Comments

nrj127 picture nrj127  路  4Comments