Hello. I am trying to Map 3D point cloud of the environment using Intel RealSense D455 camera. I took this code from GitHub, but I think it is outdated since alot changed about the library. I did, however. fix much until **update_geometry()**
. This function is showing an error and I can’t solve it anyhow. Can anyone help me resolve this issue?
from datetime import datetime
import pyrealsense2 as rs
import numpy as np
from open3d import *
from open3d.visualization import Visualizer
# Create a pipeline
pipeline = rs.pipeline()
# Create a config and configure the pipeline to stream
# different resolutions of color and depth streams
config = rs.config()
config.enable_stream(rs.stream.depth, 640, 480, rs.format.z16, 30)
config.enable_stream(rs.stream.color, 640, 480, rs.format.rgb8, 30)
# Start streaming
profile = pipeline.start(config)
# Streaming loop
try:
vis = Visualizer()
vis.create_window("Tests")
pcd = open3d.geometry.PointCloud()
while True:
dt0 = datetime.now()
vis.add_geometry(pcd)
pcd.clear()
# Get frameset of color and depth
frames = pipeline.wait_for_frames()
color = frames.get_color_frame()
depth = frames.get_depth_frame()
if not color or not depth:
continue
pc = rs.pointcloud()
pc.map_to(color)
points = pc.calculate(depth)
vtx = np.asanyarray(points.get_vertices())
pcd.points = open3d.utility.Vector3dVector(vtx.tolist())
vis.update_geometry(vis)
vis.poll_events()
vis.update_renderer()
process_time = datetime.now() - dt0
print("FPS = {0}".format(1/process_time.total_seconds()))
finally:
pipeline.stop()