It depends on which packages of OpenCV and the version you have installed.
I believe you need OpenCV 3.4+ to run those models. Some tracker models are available in 3.2, and 3.3. All trackers in your script are available in 3.4
OpenCV packages:
opencv-python
: This repository contains the main modules of the OpenCV library.
opencv-contrib-python
: The opencv-contrib-python repository contains both the main modules along with the contrib modules
python -m pip install opencv-contrib-python
, check to see if you have 3.4+, with pip show opencv
.
See how to install opencv for more details
Updates
As @user48956 pointed out opencv v 4.5.x
has moved some of these algorithms to cv2.legacy
. For example, to access TrackerMOSSE_create
function. You would have to get it fromcv2.legacy.TrackerMOSSE_create
.
I would recommend keeping up with opencv GitHub as some functions/algorithms will likely move around or be deleted.