问题描述
下述链接:
https://github.com/IntelRealSense/librealsense/tree/master/wrappers/python/examples
给出了使用Intel T265进行定位和拍照的Demo代码。
然而,该代码存在问题:
当读取的帧数>2500帧时,会报错无法接收到frame;
解决方案
- 参考相关cpp例程,只需要对读取fisheye的帧调用.keep()方法即可
- 具体代码如下:
for frame_index in range(60000):
# Wait for the next set of frames from the camera
frames = pipe.wait_for_frames()
# pdb.set_trace()
pose = frames.get_pose_frame()
if frame_index % 10 == 0:
fisheye_frame = frames.get_fisheye_frame(1)
# ========== 关键代码 =========
fisheye_frame.keep()
# ==============================
left_data = np.asanyarray(fisheye_frame.get_data())
Video.append(left_data)
if pose:
# Print some of the pose data to the terminal
# 保存数据 {"timestamps":, }
data = pose.get_pose_data()