AttributeError: module cv2.cv2 has no attribute ximgproc

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

你可能感兴趣的:(OpenCV,2,-,OpenCV,3,-,OpenCV,4,AttributeError,module,'cv2.cv2',has,no,attribute,'ximgproc')