Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: module 'cv2.cv2' has no attribute 'TrackerKCF_create' #15723

Closed
HangJie720 opened this issue Oct 17, 2019 · 18 comments
Closed

AttributeError: module 'cv2.cv2' has no attribute 'TrackerKCF_create' #15723

HangJie720 opened this issue Oct 17, 2019 · 18 comments
Labels
question (invalid tracker) ask questions and other "no action" items here: https://forum.opencv.org

Comments

@HangJie720
Copy link

No description provided.

@HangJie720
Copy link
Author

HangJie720 commented Oct 17, 2019

    if tracker_type == 'BOOSTING':
        tracker = cv2.TrackerBoosting_create()
    if tracker_type == 'MIL':
        tracker = cv2.TrackerMIL_create()
    if tracker_type == 'KCF':
        tracker = cv2.TrackerKCF_create()
    if tracker_type == 'TLD':
        tracker = cv2.TrackerTLD_create()
    if tracker_type == 'MEDIANFLOW':
        tracker = cv2.TrackerMedianFlow_create()
    if tracker_type == 'GOTURN':
        tracker = cv2.TrackerGOTURN_create()

,these api are not found, that's why?
my opencv-python version is 3.4.5.20
opencv-contrib-python version is also 3.4.5.20.

python interface not support?

@berak
Copy link
Contributor

berak commented Oct 17, 2019

my opencv-python version is 3.4.5.20
opencv-contrib-python version is also 3.4.5.20.

if you use pip, please ONLY install opencv-contrib-python , not both.

@HangJie720
Copy link
Author

HangJie720 commented Oct 17, 2019 via email

@HangJie720
Copy link
Author

I have pip uninstall opencv-python, only the opencv-contrib-python, why still have not 'Tracker_create' interface. My device is MacOS 10.13.5.

import cv2 >> cv2.Tracker_create()
Traceback (most recent call last): File "", line 1, in AttributeError: module 'cv2.cv2' has no attribute 'Tracker_create'

------------------ 原始邮件 ------------------ 发件人: "berak"notifications@github.com; 发送时间: 2019年10月17日(星期四) 下午4:24 收件人: "opencv/opencv"opencv@noreply.github.com; 抄送: "JackHay"1339327861@qq.com;"Author"author@noreply.github.com; 主题: Re: [opencv/opencv] AttributeError: module 'cv2.cv2' has no attribute'TrackerKCF_create' (#15723) my opencv-python version is 3.4.5.20 opencv-contrib-python version is also 3.4.5.20. if you use pip, please ONLY install opencv-contrib-python , not both. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

Thank you very much, problem have been solved.

@gopalkalpande
Copy link

I'm using opencv 4.1.1 and encountered the same error... if anyone knows please help.

@gopalkalpande
Copy link

pip3 install opencv-contrib-python

This solved the error for me.

@BitbeyHub
Copy link

my opencv-python version is 3.4.5.20
opencv-contrib-python version is also 3.4.5.20.

if you use pip, please ONLY install opencv-contrib-python , not both.

You are really awesome dude!

@kamalojasv181
Copy link

Hi, I need to import cv2 as well in a project and if i uninstall opencv-python, I can no longer import cv2. Keeping both opencv-python and opencv-contrib-python still shows the same error

versions
opencv-python-4.2.0.34
opencv-contrib-python 1.18.1

@Alien-X717
Copy link

Hi, I need to import cv2 as well in a project and if i uninstall opencv-python, I can no longer import cv2. Keeping both opencv-python and opencv-contrib-python still shows the same error

versions
opencv-python-4.2.0.34
opencv-contrib-python 1.18.1

uninstall both ("opencv-python" and "opencv-contrib-python" ) and then install "opencv-contrib-python"

@VoNhatVinh
Copy link

I uninstall opencv-contrib-python==3.4.14.51 and reinstall it. Works for me!

@AliKJaber
Copy link

First, pip uninstall opencv-contrib-python, and then, pip install opencv-contrib-python. Its work fine for me and solved all related Tracker issues.

@Saugatkafley
Copy link

Uninstalling the both opencv-python and opencv-contrib-python ==4.5.5.62 and re-installing only the contrib didn't solved the issue ..

@Saugatkafley
Copy link

I just downgraded to opencv-contrib-python ==4.4.0.46 and it resolved it.

@SIDDHARTH-S-001
Copy link

uninstall opencv-python
uninstall opencv-contrib-python
then do
pip3 install opencv-contrib-python
this worked for me

@Surajj4837-th
Copy link

I just downgraded to opencv-contrib-python ==4.4.0.46 and it resolved it.

This worked for me.

@luoxue-star
Copy link

首先,pip 卸载 opencv-contrib-python,然后,pip 安装 opencv-contrib-python。它对我来说工作正常,并解决了所有相关的 Tracker 问题。

Yes,it also helps me.Thank you.

@ilkin94
Copy link

ilkin94 commented Jul 6, 2022

Delete opencv-python and opencv-contrib. Then install opencv-contrib. This worked for me.

@Curious-Utkarsh
Copy link

Delete opencv-python and opencv-contrib. Then install opencv-contrib.

tracker = cv2.legacy_TrackerMOSSE.create()

this worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question (invalid tracker) ask questions and other "no action" items here: https://forum.opencv.org
Projects
None yet
Development

No branches or pull requests