Last active
October 18, 2022 00:22
-
-
Save heethesh/38174476c8fb721c4cc59b1e2e18bba8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import open3d as o3d | |
from tqdm import tqdm | |
def visualize_sequence(args): | |
# Setup for Open3D visualization. | |
first = True | |
pcd = o3d.geometry.PointCloud() | |
visualizer = o3d.visualization.Visualizer() | |
visualizer.create_window('Point Cloud Visualizer') | |
visualizer.get_render_option().point_size = 2 | |
visualizer.get_render_option().background_color = [0, 0, 0] | |
# Display point cloud. | |
for i in tqdm(data, desc='Frame', leave=False): | |
# TODO: Load Nx3 data here. | |
points = np.array(data[i]['xyz']) | |
colors = np.array(data[i]['colors']) | |
# Visualize using Open3D. | |
pcd.points = o3d.utility.Vector3dVector(points.astype('float64')) | |
pcd.colors = o3d.utility.Vector3dVector(colors.astype('float64')) | |
if first: | |
first = False | |
visualizer.add_geometry(pcd) | |
else: | |
visualizer.update_geometry(pcd) | |
visualizer.poll_events() | |
visualizer.update_renderer() | |
time.sleep(args.delay) | |
visualizer.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment