0
def askForTracker():
    choice = input("Select tracker: ")

    if choice == '0':
        tracker = cv2.TrackerBoosting_create()
    if choice == '1':
        tracker = cv2.TrackerMIL_create()
    if choice == '2':
        tracker = cv2.TrackerKCF_create()
    if choice == '3':
        tracker = cv2.TrackerTLD_create()
    if choice == '4':
        tracker = cv2.TrackerMedianFlow_create()

    return tracker

tracker = askForTracker()

I got this error:

"AttributeError: module 'cv2' has no attribute 'TrackerMedianFlow_create"

I installed opencv-contrib-python but I can't solve this problem

Install opencv-contrib-python

Markus
  • 5,976
  • 5
  • 6
  • 21
Dai
  • 1
  • 2
  • Does this answer your question? [Python says that "TrackerMedianFlow\_create()" is no longer an attribute of cv2, Has the Library been updated?](https://stackoverflow.com/questions/56581577/python-says-that-trackermedianflow-create-is-no-longer-an-attribute-of-cv2) – Markus Mar 16 '23 at 17:33
  • Which version of OpenCV do you have? – Eljas Hyyrynen Mar 16 '23 at 20:45
  • I use openCV version 4.7.0 and I installed opencv-contrib-python, but I still cann't solve this problem – Dai Mar 17 '23 at 02:44

0 Answers0