AttributeError: module cv2.cv2 has no attribute ximgproc

1. AttributeError: module ‘cv2.cv2’ has no attribute ‘ximgproc’

Traceback (most recent call last):
  File "superpixel-inceptionV1OnFire.py", line 92, in <module>
    slic = cv2.ximgproc.createSuperpixelSLIC(small_frame, region_size=22)
AttributeError: module 'cv2.cv2' has no attribute 'ximgproc'

2. pip list | grep opencv

(venv) strong@foreverstrong:~/venv/tensorflow_work/fire-detection-cnn$ pip list | grep opencv
opencv-python                 3.3.1.11              
WARNING: You are using pip version 19.1.1, however version 19.2.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
(venv) strong@foreverstrong:~/venv/tensorflow_work/fire-detection-cnn$ 

3. 安装 opencv-contrib-python

安装 opencv-contrib-python,pip3 install opencv-contrib-python==3.3.1.11
命令中 == 左右没有空格。

(venv) strong@foreverstrong:~/venv/tensorflow_work/fire-detection-cnn$ pip list | grep opencv
opencv-contrib-python         3.3.1.11              
opencv-python                 3.3.1.11              
WARNING: You are using pip version 19.1.1, however version 19.2.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
(venv) strong@foreverstrong:~/venv/tensorflow_work/fire-detection-cnn$ 

4. opencv-contrib-python and opencv-python

a. Packages for standard desktop environments (Windows, macOS, almost any GNU/Linux distribution) (桌面环境)

  • run pip install opencv-python if you need only main modules
  • run pip install opencv-contrib-python if you need both main and contrib modules (check extra modules listing from OpenCV documentation)

b. Packages for server (headless) environments (服务器环境)
These packages do not contain any GUI functionality. They are smaller and suitable for more restricted environments.
这些包不包含任何 GUI 功能。它们更小,适用于更受限制的环境。

  • run pip install opencv-python-headless if you need only main modules
  • run pip install opencv-contrib-python-headless if you need both main and contrib modules (check extra modules listing from OpenCV documentation)

References

[1] Yongqiang Cheng, https://yongqiang.blog.csdn.net/

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Yongqiang Cheng

梦想不是浮躁,而是沉淀和积累。

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值