【问题标题】:Translate Region of Interest from RGB video to Depth video using OpenCV使用 OpenCV 将感兴趣区域从 RGB 视频转换为深度视频
【发布时间】:2021-03-04 18:51:21
【问题描述】:

我最近购买了 L515 实感摄像头,它具有 RGB 传感器和 深度(激光雷达) 传感器。我还有一个预训练模型,它仅在 RGB 图像中检测手,但我想将此感兴趣区域转换为深度图像。不幸的是,由于两个传感器之间存在偏移,图像输入并没有完全对齐,这使得翻译变得困难。

我编写了一个简单的 GUI 脚本,允许我在每个图像馈送中选择 3 个点(白色)并计算一个仿射变换矩阵,然后可以应用该矩阵来排列图像。

但是,结果并不成功。

我的猜测是这与两台相机的焦距不同有关。我想知道我是否可以在 OpenCV 中做些什么来更好地对齐图像。

【问题讨论】:

    标签: python numpy opencv lidar realsense


    【解决方案1】:

    到目前为止,最简单的方法是使用 librealsense API 中的“对齐”过程,例如:https://github.com/IntelRealSense/librealsense/blob/master/wrappers/python/examples/align-depth2color.py 重要部分:

    align = rs.align(rs.stream.color)
    
    # Streaming loop
    try:
        while True:
            # Get frameset of color and depth
            frames = pipeline.wait_for_frames()
            # frames.get_depth_frame() is a 640x360 depth image
    
            # Align the depth frame to color frame
            aligned_frames = align.process(frames)
    
            # Get aligned frames
            aligned_depth_frame = aligned_frames.get_depth_frame()
            color_frame = aligned_frames.get_color_frame()
    

    完成此操作后,颜色和深度图像将在空间上对齐且分辨率相同,因此彩色图像中的 (i,j) 像素坐标将直接映射到深度图像中的 (i,j),但不会所有色点都有有效的深度数据。

    【讨论】:

    • 非常感谢!这正是我一直在寻找的。就像你说的,有些区域的深度数据无效,但对于我的应用来说已经足够了。
    猜你喜欢
    • 1970-01-01
    • 2012-04-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-03
    • 1970-01-01
    • 2013-02-28
    • 2017-09-28
    相关资源
    最近更新 更多