IntelRealSense / librealsense

Intel® RealSense™ SDK
https://www.intelrealsense.com/
Apache License 2.0
7.6k stars 4.83k forks source link

How to get textured point cloud? #9005

Closed JimXu1989 closed 3 years ago

JimXu1989 commented 3 years ago
Required Info
Camera Model { D400 }
Firmware Version (Open RealSense Viewer --> Click info)
Operating System & Version { Linux (Ubuntu 20.04)
Kernel Version (Linux Only) (e.g. 4.14.13)
Platform PC
SDK Version { legacy / 2.<45>.<?> }
Language {python}

Issue Description

How to get textured point cloud? Texture form color image. the comment says: We'll use the colorizer to generate texture for our PLY (alternatively, texture can be obtained from color or infrared stream)

colorizer = rs.colorizer()

try:

Wait for the next set of frames from the camera

frames = pipe.wait_for_frames()
color_frame = frames.get_color_frame()
colorized = colorizer.process(frames)

# Create save_to_ply object
ply = rs.save_to_ply("1.ply")
MartyG-RealSense commented 3 years ago

Hi @JimXu1989 As you quote "We'll use the colorizer to generate texture for our PLY", it sounds as though you are referring to the SDK Python example program export_ply_example.

https://github.com/IntelRealSense/librealsense/blob/master/wrappers/python/examples/export_ply_example.py

Historically, there have been difficulties in past cases with exporting color to a ply using Python.

The case below has Python scripting shared by a RealSense user whose code exported color to a ply, though without vertex normals. If lack of normals is not a problem for you then the script may be helpful if it works for you. It uses the export_to_ply export method instead of save_to_ply.

https://github.com/IntelRealSense/librealsense/issues/6194#issuecomment-608371293

JimXu1989 commented 3 years ago

Hi @JimXu1989 As you quote "We'll use the colorizer to generate texture for our PLY", it sounds as though you are referring to the SDK Python example program export_ply_example.

https://github.com/IntelRealSense/librealsense/blob/master/wrappers/python/examples/export_ply_example.py

Historically, there have been difficulties in past cases with exporting color to a ply using Python.

The case below has Python scripting shared by a RealSense user whose code exported color to a ply, though without vertex normals. If lack of normals is not a problem for you then the script may be helpful if it works for you. It uses the export_to_ply export method instead of save_to_ply.

#6194 (comment)

Thanks a lot for your reply

MartyG-RealSense commented 3 years ago

Hi @JimXu1989 Do you require further assistance with this case, please? Thanks!

MartyG-RealSense commented 3 years ago

Case closed due to no further comments received.