首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Intel Realsense -无法读取bag文件

Intel Realsense -无法读取bag文件
EN

Stack Overflow用户
提问于 2021-02-11 17:04:08
回答 1查看 330关注 0票数 0

在英特尔Realsense摄像头D435i上,我录制了一个bag文件,现在尝试读取它以获取帧,但收到以下错误消息:

代码语言:javascript
复制
RuntimeError: Couldn't Resolve requests

我使用的是python read_bag_example.py文件的例子。

代码语言:javascript
复制
try:
    # Create pipeline
    pipeline = rs.pipeline()

    # Create a config object
    config = rs.config()
    # Tell config that we will use a recorded device from filem to be used by the pipeline through playback.
    rs.config.enable_device_from_file(config, args.input)
    # Configure the pipeline to stream the depth stream
    config.enable_stream(rs.stream.color, 1280, 720, rs.format.bgr8, 6)

    # Start streaming from file
    pipeline.start(config)

    # Create opencv window to render image in
    cv2.namedWindow("Color Stream", cv2.WINDOW_AUTOSIZE)
    

    # Streaming loop
    while True:
        # Get frameset of depth
        frames = pipeline.wait_for_frames()

        # Get depth frame
        color_frame = frames.get_color_frame()
        
        # convert frame to numpy array
        color_image = np.asanyarray(color_frame.get_data())
        cv2.imshow('Color Stream', color_image)
        key = cv2.waitKey(1)
        if key == 27:
           cv2.destroyAllWindows()
           break
finally:
   pass

注意:我录制的bag文件有6fps的深度和颜色流。在上面的代码中,我只对颜色流感兴趣。我假设,获取它应该不是问题。

任何帮助都是非常感谢的。谢谢。

EN

回答 1

Stack Overflow用户

发布于 2021-10-06 05:47:49

您可以改用rs.format.bgr8。像这样

代码语言:javascript
复制
config.enable_stream(rs.stream.color, rs.format.rgb8, 30)

欲了解更多信息,请访问https://github.com/IntelRealSense/librealsense/issues/2652

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66151659

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档