0

I want to use python package cv2 version 4.5.5 for object tracking. The examples on the web using an older cv2 version have many possible algorithms but in my version I only see this

cv2.TrackerMIL_create()

How do I access the rest of the algorithms like cv2.TrackerMOSSE_create(),cv2.TrackerCSRT_create()

Also I want to track multiple objects. Do I need to create a tracker for each object or is there a way to pass a list of bounding boxes to the algorithm for tracking?

Sanjeev Singh
  • 141
  • 1
  • 10

1 Answers1

0

I found the answer from Stack Overlflow thread

Needed to do

pip install opencv-contrib-python --user
pip install opencv-contrib-python-headless --user

Then I could do

OPENCV_OBJECT_TRACKERS = {
        "csrt": cv2.legacy.TrackerCSRT_create,
        "kcf": cv2.legacy.TrackerKCF_create,
        "boosting": cv2.legacy.TrackerBoosting_create,
        "mil": cv2.legacy.TrackerMIL_create,
        "tld": cv2.legacy.TrackerTLD_create,
        "medianflow": cv2.legacy.TrackerMedianFlow_create,
        "mosse": cv2.legacy.TrackerMOSSE_create
    }
Sanjeev Singh
  • 141
  • 1
  • 10