目标跟踪中的遮挡处理

2024-03-29 02:32:14 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用背景减法、卡尔曼滤波和匈牙利算法实现基于运动的目标跟踪程序。除了遮挡外,一切正常。当两个对象彼此足够接近时,背景减法将其识别为这两个对象之一。分割后,程序将正确识别这两个对象。我正在寻找解决方案/算法来检测遮挡,如下面示例中的点c)所示enter image description here

当使用背景减法时,我将非常感谢任何引用或代码示例,以解决遮挡检测问题


Tags: 对象代码程序算法示例目标解决方案背景
1条回答
网友
1楼 · 发布于 2024-03-29 02:32:14

使用机器学习算法的对象检测应该能够可靠地区分这些对象,即使有明显的遮挡。您没有分享任何关于您的环境的信息,所以我不知道您有什么样的约束,但是使用ML方法,下面是我将如何解决您的问题

import cv2
from sort import *

tracker = Sort() # Create instance of tracker (see link below for repo)

cap = cv2.VideoCapture(0)
while(True):
    ret, frame = cap.read()

    # Not sure what your environment is, 
    #but get your objects bounding boxes like this
    detected_objects = detector.detect(frame) #pseudo code
    
    # Get tracking IDs for objects and bounding boxes
    detected_objects_with_ids = tracker.update(detected_objects)
...

上面的示例使用这个Kalman Filter and Hungarian algorithm,它可以实时跟踪多个对象

同样,不确定您的环境,但您可以找到pre-built object detection algorithms on the Tensorflow site

相关问题 更多 >