AttributeError: module ‘cv2‘ has no attribute ‘TrackerCSRT_create‘ ,‘TrackerBoosting_create‘

1、module ‘cv2’ has no attribute ‘TrackerCSRT_create’

Traceback (most recent call last):
File “C:\all\code\pycharm\pytorch\openCV\项目实战\19目标追踪\multi-object-tracking\multi_object_tracking.py”, line 16, in < module>
“csrt”: cv2.TrackerCSRT_create,
AttributeError: module ‘cv2’ has no attribute ‘TrackerCSRT_create’

在这里插入图片描述

注意 opencv-pythonopencv-contrib-python 的版本一致

pip install opencv-contrib-python

可以通过 pip list 进行查看安装库的版本

在这里插入图片描述

2、module ‘cv2’ has no attribute ‘TrackerBoosting_create’

在这里插入图片描述

新版本中,一些函数被取消

通过cv2.legacy来调用这些函数

cv2.TrackerBoosting_create改为cv2.legacy.TrackerBoosting_create即可

在这里插入图片描述

就可以正常运行了

猜你喜欢

转载自blog.csdn.net/weixin_44635198/article/details/128136642