Hello ı tried to use tracker algorithms but ı couldn't use also ı tried to install API's
pip install opencv-contrib-python
and here is my code
import cv2
def ask_for_tracker():
print("Welcome! What Tracker API would you like to use?")
print("Enter 0 for BOOSTING: ")
print("Enter 1 for MIL: ")
print("Enter 2 for KCF: ")
print("Enter 3 for TLD: ")
print("Enter 4 for MEDIANFLOW: ")
choice = input("Please select your 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 = ask_for_tracker()
here is my error thanks for help

the
opencv-contrib-pythonlibrary has been updated. Here's how your code should look like according to the updated OpenCV documentation:I tested this code for every choice with the latest
opencv-contrib-pythonversion: 4.8.0.76. Just dopip install -U opencv-contrib-pythonHere's the code I tested for every tracker:
Output:
Hope it helps!