isl-org / isl-org/Open3D

[Open3D Python] Extremely slow visualization of streamed 3D point cloud

Open
#5,065 4 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
C++
Stars
14k
Forks
2.6k
Avg merge
5d 18h
Merged PRs (30d)
6

Description

### Checklist

- [X] I have searched for [similar issues](https://github.com/isl-org/Open3D/issues).
- [X] For Python issues, I have tested with the [latest development wheel](http://www.open3d.org/docs/latest/getting_started.html#development-version-pip).
- [X] I have checked the [release documentation](http://www.open3d.org/docs/release/) and the [latest documentation](http://www.open3d.org/docs/latest/) (for `master` branch).

### My Question

I'm trying to visualize a 3D point cloud from a ROS bag file in a for loop with pyrealsense and open3d. What I've noticed, however, is the following:

1) Visualizing the 3D point cloud with open3d is excruciatingly slow, where the loop runs at about 0.2 Hz
2) Even though the loop runs, it doesn't look like the open3d visualizer is updating the 3D point cloud

I know it's not an issue with pyrealsense, since when I visualize depth frames with opencv's `imshow` it can run at up to 90 Hz in the loop. However, the moment I add in the open3d point cloud visualization the framerate drop to about 0.2 Hz.

Here is a basic working example of the code I'm using (I tested it on a bag file recording from an Intel RealSense D435i camera):

```
import pyrealsense2 as rs
import numpy as np
import open3d as o3d

def depth_to_pointcloud(depth_frame):
pc = rs.pointcloud()
points = pc.calculate(depth_frame)
verts = np.asanyarray(points.get_vertices()).view(np.float32).reshape(-1, 3) # xyz

return verts

def main():
file_path = "path/to/bag/file"

config = rs.config()
config.enable_device_from_file(file_path, repeat_playback=False)

pipeline = rs.pipeline()
pipeline.start(config)

point_cloud = o3d.geometry.PointCloud()
vis = o3d.visualization.Visualizer()
vis.create_window()

i = 0
while True:
print(i)
frames = pipeline.wait_for_frames()

depth_frame = frames.get_depth_frame()
verts = depth_to_pointcloud(depth_frame)
point_cloud = o3d.geometry.PointCloud(o3d.utility.Vector3dVector(verts))

if(i == 0):
vis.add_geometry(point_cloud)
vis.update_geometry(point_cloud)
vis.poll_events()
vis.update_renderer()

i += 1

if __name__ == "__main__":
main()
```

Is there anything I'm doing wrong? I'd love to be able to visualize a 3D point cloud with open3d.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.