AttributeError: module ‘cv2‘ has no attribute ‘TrackerBoosting_create的解决方法!

Traceback (most recent call last):
File “h:/BaiduNetdiskDownload/opencv-objecttracking/crack-tracking.py”, line 17, in
tracker = cv2.TrackerBoosting_create()
AttributeError: module ‘cv2’ has no attribute 'TrackerBoosting_create

第一种:卸载重装

pip install opencv-python -i https://mirrors.aliyun.com/pypi/simple/
pip install --user -i https://mirrors.aliyun.com/pypi/simple/ opencv-contrib-python

第二种:opencv版本包括4.5.1以上,都不支持这些函数。通过cv2.legacy来调用这些函数。
例如 ‘cv2.TrackerBoosting_create’ 改成 ‘**cv2.legacy.**TrackerBoosting_create’;其它也类似改动即可!

你可能感兴趣的:(python,opencv,开发语言)