最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Saving a point cloud from docker container with open3d - Stack Overflow

programmeradmin4浏览0评论

I'm trying to make a pointcloud visualization. I was able to display the visualization using open3d, but I can't save it due to docker issues with display.

How can I make a plot very similar to how open3d makes it in the code below? But instead of display, save it?

The code below displays correctly in my docker container, but when saved it saves as a completely black image.

I also see this error: error: XDG_RUNTIME_DIR not set in the environment.

Assuming you have a point cloud as points:

pcd = o3d.geometry.PointCloud()
pcd.points = o3d.utility.Vector3dVector(points)
# Create coordinate frame for reference
coordinate_frame = o3d.geometry.TriangleMesh.create_coordinate_frame(size=0.3)

# Create visualization window
vis = o3d.visualization.Visualizer()
vis.create_window(width=1024, height=768)
vis.add_geometry(pcd)
vis.add_geometry(coordinate_frame)

# Set the camera position for a better view
ctr = vis.get_view_control()
ctr.set_front([0, 0, -1])   # Look toward the scene (forward)
ctr.set_up([0, -1, 0])      # Y is up
ctr.set_zoom(0.7)

# Improve the rendering quality
opt = vis.get_render_option()
opt.point_size = 3.0
opt.background_color = np.array([0.1, 0.1, 0.1])  # Dark gray background

# Render the visualization
vis.poll_events()
vis.update_renderer()

# Display for a while
time.sleep(20)

vis.capture_screen_image(save_path)

# Clean up
vis.destroy_window()

I setup my docker container with access to the screen so it can display but I dont know why it wont save. These are my container settings. I also run xhost +local:root before running the code because for some reason it makes display work.

  default_test:
    privileged: true
    ipc: host # for dds shared memory transport
    environment:
      - QT_X11_NO_MITSHM=1
      - QT_DEBUG_PLUGINS=1
    volumes:
      - /tmp/.X11-unix:/tmp/.X11-unix
      - /dev/shm:/dev/shm 
    network_mode: host
    runtime: nvidia
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities: [ gpu ]

Just trying to visualize the point cloud but yeah its crazy I have been trying for about 7 hours to get a good visualization to save as a png. I'm willing to use any library as long as I can get the point of view to be the same.

发布评论

评论列表(0)

  1. 暂无评论