Search code examples
pythonattributeerroropencv

AttributeError: module 'cv2.cv2' has no attribute 'TrackerCSRT_create'


AttributeError: module 'cv2.cv2' has no attribute 'TrackerCSRT_create' is thrown.

python version: 4.1.1

opencv version: 4.1.1

OS: Linux

# init 
tracker = cv2.TrackerCSRT_create() 
success = tracker.init(image, (xmin, ymin, xmax - xmin, ymax - ymin))

The code was working fine till last week. I tried to edit my code to create flask app, and encountered this problem upon calling the flask app.


Solution

  • update opencv-python and opencv-contrib-python to the latest version via pip3. To note that in my case, both packages were required to resolve the issue.