简体   繁体   English

OpenCV AttributeError 模块“cv2.cv2”没有属性“TrackerBoosting_create”

[英]OpenCV AttributeError module 'cv2.cv2' has no attribute 'TrackerBoosting_create'

I am tried to create trackers but not a single tracker is creating.我试图创建跟踪器,但没有创建一个跟踪器。 Any help would be greatly appreciated.任何帮助将不胜感激。

Current version of opencv that installed :- opencv version = 4.4.0当前安装的 opencv 版本:- opencv 版本 = 4.4.0

opencv-contrib-python = 4.4.0 opencv-contrib-python = 4.4.0

Code that i am using to create tracker :-我用来创建跟踪器的代码:-

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() 

OUTPUT输出


Welcome! What Tracker API would you like to use?
Enter 0 for BOOSTING: 
Enter 1 for MIL: 
Enter 2 for KCF: 
Enter 3 for TLD: 
Enter 4 for MEDIANFLOW: 
Please select your tracker: 0
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-8-956dbed87488> in <module>
     23     return tracker
     24 
---> 25 tracker = ask_for_tracker()

<ipython-input-8-956dbed87488> in ask_for_tracker()
     10 
     11     if choice == '0':
---> 12         tracker = cv2.TrackerBoosting_create()
     13     if choice == '1':
     14         tracker = cv2.TrackerMIL_create()

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

My code run successfully.我的代码运行成功。 I run above code in jupyter notebook and when i run this notebook using anaconda prompt it shows above error, but when i run notebook with cmd then it run successfully.我在 jupyter notebook 中运行上面的代码,当我使用 anaconda 提示符运行这个 notebook 时,它显示了上面的错误,但是当我用 cmd 运行 notebook 时,它运行成功。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 OpenCV AttributeError 模块 'cv2.cv2' 没有属性 'Tracker_create' - OpenCV AttributeError module 'cv2.cv2' has no attribute 'Tracker_create' AttributeError:模块&#39;cv2.cv2&#39;没有属性&#39;rectange&#39; - AttributeError: module 'cv2.cv2' has no attribute 'rectange' 接收错误:AttributeError:尝试调用openCV方法时,模块&#39;cv2.cv2&#39;没有属性&#39;CompareHist&#39; - Receiving error: AttributeError: module 'cv2.cv2' has no attribute 'CompareHist' when trying to call a openCV method AttributeError: 模块 &#39;cv2.cv2&#39; 没有属性 &#39;release&#39; - AttributeError: module 'cv2.cv2' has no attribute 'release' 模块 &#39;cv2.cv2&#39; 没有属性 &#39;sift&#39; - module 'cv2.cv2' has no attribute 'sift' 模块“cv2.cv2”没有属性“PutText” - module 'cv2.cv2' has no attribute 'PutText' 模块“cv2.cv2”没有属性“xfeatures2d”,模块“cv2.cv2”没有属性“SIFT” - module 'cv2.cv2' has no attribute 'xfeatures2d' and module 'cv2.cv2' has no attribute 'SIFT' AttributeError: 模块 &#39;cv2.cv2&#39; 没有属性 &#39;CAP_PROP_ORIENTATION_META&#39; - AttributeError: module 'cv2.cv2' has no attribute 'CAP_PROP_ORIENTATION_META' 模块“cv2.cv2”没有属性“xfeatures2d”(Opencv 3.4.2.17) - module 'cv2.cv2' has no attribute 'xfeatures2d'(Opencv 3.4.2.17) 模块“cv2.cv2”没有属性“dnn_superres” - module 'cv2.cv2' has no attribute 'dnn_superres'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM