import pyrealsense2 as rs
import cv2
import numpy as np
# 配置深度和颜色流
pipeline = rs.pipeline()
config = rs.config()
config.enable_stream(rs.stream.fisheye, 1)
config.enable_stream(rs.stream.fisheye, 2)
# 开始流水线
pipeline.start(config)
try:
while True:
# 等待一组帧
frames = pipeline.wait_for_frames()
# 获取左右目图像帧
left_frame = frames.get_fisheye_frame(1)
right_frame = frames.get_fisheye_frame(2)
# 将图像帧转换为numpy数组
left_image = np.asanyarray(left_frame.get_data())
right_image = np.asanyarray(right_frame.get_data())
# 显示图像
cv2.imshow('Left Image', left_image)
cv2.imshow('Right Image', right_image)
# 按下“q”键退出循环
if cv2.waitKey(1) & 0xFF == ord('q'):
break
finally:
# 停止流水线
pipeline.stop()
07-18
3178
12-06
1303
03-08
8755