Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

ERROR using opencv_contrib with Python 3.x

Whenever I try to use something from the opencv_contrib I get an error:


Ex1: In the command line

python
>>> import cv2
>>> help(cv2.xfeatures2d)
AttributeError: module 'cv2' has no attribute 'xfeatures2d'

Ex2: Trying to run the following code

import cv2
import sys

if __name__ == '__main__' :

        tracker = cv2.Tracker_create("BOOSTING")

I Get

Traceback (most recent call last):
  File "tracking.py", line 6, in <module>
    tracker = cv2.Tracker_create("BOOSTING")
AttributeError: module 'cv2' has no attribute 'Tracker_create'

My seetings for the cmake were:

cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D OPENCV_EXTRA_MODULES_PATH= /Users/MatheusTorquato/opencv/opencv_contrib/modules \
-D PYTHON3_LIBRARY=/usr/local/Cellar/python3/3.6.0_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/config-3.6m-darwin/libpython3.6.dylib \
-D PYTHON3_INCLUDE_DIR=/usr/local/Cellar/python3/3.6.0_1/Frameworks/Python.framework/Versions/3.6/include/python3.6m/ \
-D PYTHON3_EXECUTABLE=$VIRTUAL_ENV/bin/python \
-D BUILD_opencv_python2=OFF \
-D BUILD_opencv_python3=ON \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D INSTALL_C_EXAMPLES=OFF \
-D BUILD_EXAMPLES=ON \
-D BUILD_opencv_cvv=OFF\
-D BUILD_opencv_adas=OFF ..

Everything looks fine.

  • Configuring: Ok - File
  • Making: Ok - File
  • Installing: Ok - File

  • Python Version – 3.6.0
  • OpenCV Version – ‘3.2.0-dev’
  • Operating System - macOS Sierra

I've installed everything using this tutorial

Any ideas?

Regards,

Matheus Torquato

ERROR using opencv_contrib with Python 3.x

Whenever I try to use something from the opencv_contrib I get an error:


Ex1: In the command line

python
>>> import cv2
>>> help(cv2.xfeatures2d)
AttributeError: module 'cv2' has no attribute 'xfeatures2d'

Ex2: Trying to run the following codecode (just the first few lines)

import cv2
import sys

if __name__ == '__main__' :

        tracker = cv2.Tracker_create("BOOSTING")

I Get

Traceback (most recent call last):
  File "tracking.py", line 6, in <module>
    tracker = cv2.Tracker_create("BOOSTING")
AttributeError: module 'cv2' has no attribute 'Tracker_create'

My seetings for the cmake were:

cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D OPENCV_EXTRA_MODULES_PATH= /Users/MatheusTorquato/opencv/opencv_contrib/modules \
-D PYTHON3_LIBRARY=/usr/local/Cellar/python3/3.6.0_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/config-3.6m-darwin/libpython3.6.dylib \
-D PYTHON3_INCLUDE_DIR=/usr/local/Cellar/python3/3.6.0_1/Frameworks/Python.framework/Versions/3.6/include/python3.6m/ \
-D PYTHON3_EXECUTABLE=$VIRTUAL_ENV/bin/python \
-D BUILD_opencv_python2=OFF \
-D BUILD_opencv_python3=ON \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D INSTALL_C_EXAMPLES=OFF \
-D BUILD_EXAMPLES=ON \
-D BUILD_opencv_cvv=OFF\
-D BUILD_opencv_adas=OFF ..

Everything looks fine.

  • Configuring: Ok - File
  • Making: Ok - File
  • Installing: Ok - File

  • Python Version – 3.6.0
  • OpenCV Version – ‘3.2.0-dev’
  • Operating System - macOS Sierra

I've installed everything using this tutorial

Any ideas?

Regards,

Matheus Torquato

ERROR using opencv_contrib with Python 3.x

Whenever I try to use something from the opencv_contrib I get an error:


Ex1: In the command line

python
>>> import cv2
>>> help(cv2.xfeatures2d)
AttributeError: module 'cv2' has no attribute 'xfeatures2d'

Ex2: Trying to run the following code (just the first few lines)

import cv2
import sys

if __name__ == '__main__' :

        tracker = cv2.Tracker_create("BOOSTING")

I Get

Traceback (most recent call last):
  File "tracking.py", line 6, in <module>
    tracker = cv2.Tracker_create("BOOSTING")
AttributeError: module 'cv2' has no attribute 'Tracker_create'

My seetings for the cmake were:

cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D OPENCV_EXTRA_MODULES_PATH= /Users/MatheusTorquato/opencv/opencv_contrib/modules /Users/MatheusTorquato/OpenCV/opencv_contrib/modules \
-D PYTHON3_LIBRARY=/usr/local/Cellar/python3/3.6.0_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/config-3.6m-darwin/libpython3.6.dylib \
-D PYTHON3_INCLUDE_DIR=/usr/local/Cellar/python3/3.6.0_1/Frameworks/Python.framework/Versions/3.6/include/python3.6m/ \
-D PYTHON3_EXECUTABLE=$VIRTUAL_ENV/bin/python \
-D BUILD_opencv_python2=OFF \
-D BUILD_opencv_python3=ON \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D INSTALL_C_EXAMPLES=OFF \
-D BUILD_EXAMPLES=ON \
-D BUILD_opencv_cvv=OFF\
-D BUILD_opencv_adas=OFF ..

Everything looks fine.

  • Configuring: Ok - File
  • Making: Ok - File
  • Installing: Ok - File

  • Python Version – 3.6.0
  • OpenCV Version – ‘3.2.0-dev’
  • Operating System - macOS Sierra

I've installed everything using this tutorial

Any ideas?

Regards,

Matheus Torquato