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)
...
使用机器学习算法的对象检测应该能够可靠地区分这些对象,即使有明显的遮挡。您没有分享任何关于您的环境的信息,所以我不知道您有什么样的约束,但是使用ML方法,下面是我将如何解决您的问题
上面的示例使用这个Kalman Filter and Hungarian algorithm,它可以实时跟踪多个对象
同样,不确定您的环境,但您可以找到pre-built object detection algorithms on the Tensorflow site
相关问题 更多 >
编程相关推荐