D430点云是x,y,z.将realsense D430保存的点云文件.pcd,需要对数据进行处理,废话不多说,直接上代码
#coding=utf-8
import pyrealsense2 as rs
import numpy as np
import cv2
import os
# 创建一个管道
pipeline = rs.pipeline()
# Create a config并配置要流式传输的管道
# 颜色和深度流的不同分辨率
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.bgr8, 30)
# 开始流式传输
profile = pipeline.start(config)
# 获取深度传感器的深度标尺(参见rs - align示例进行说明)
depth_sensor = profile.get_device().first_depth_sensor()
depth_scale = depth_sensor.get_depth_scale()
print("Depth Scale is: ", depth_scale)
# 创建对齐对象
# rs.align允许我们执行深度帧与其他帧的对齐
# “align_to”是我们计划对齐深度帧的流类型。
align_to = rs.stream.color
align = rs.align(align_to)
index = 0
color_path = 'color_img'
depth_path = 'E:\python310\Lib\site-packages\open3d'
# Streaming循环
try:
while True:
index += 1
# 获取颜色和深度的框架集
frames = pipeline.wait_for_frames()
# frames.get_depth_frame()是640x360深度图像
# 将深度框与颜色框对齐
aligned_frames = align.process(frames)
# 获取对齐的帧
aligned_d