Python3 bindings ubuntu 16.04

asked 2017-05-30 11:13:39 -0600

I'm having problems running python3 with cv2. When I try to run an script with cv2.namedWindow I get "OpenCV Error: Unspecified error (The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script) in cvNamedWindow, file /io/opencv/modules/highgui/src/window.cpp, line 565"

I have configure opencv 3.2 with this flags:

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_GTK=ON -D WITH_OPENGL=ON ..

But allwais fail.

I think that I have a problem in the installation.

sudo -H pip3 install cv2

In the summary of the cmake I can read:

    -- General configuration for OpenCV 3.2.0-dev =====================================
    --   Version control:               3.2.0-373-gf109c01
    -- 
    --   Platform:
    --     Timestamp:                   2017-05-30T15:50:58Z
    --     Host:                        Linux 4.4.0-77-generic x86_64
    --     CMake:                       3.5.1
    --     CMake generator:             Unix Makefiles
    --     CMake build tool:            /usr/bin/make
    --     Configuration:               RELEASE
    ....
    --   GUI: 
    --     QT 5.x:                      YES (ver 5.5.1)
    --     QT OpenGL support:           YES (Qt5::OpenGL 5.5.1)
    --     OpenGL support:              YES (/usr/lib/x86_64-linux-gnu/libGLU.so /usr/lib/x86_64-linux-gnu/libGL.so)
    --     VTK support:                 NO
....
    --   Python 3:
    --     Interpreter:                 /usr/bin/python3 (ver 3.5.2)
    --     Libraries:                   /usr/lib/x86_64-linux-gnu/libpython3.5m.so (ver 3.5.2)
    --     numpy:                       /usr/local/lib/python3.5/dist-packages/numpy/core/include (ver 1.12.1)
    --     packages path:               lib/python3.5/dist-packages

But inside python3 with

>>> import cv2
>>> print(cv2.getBuildInformation())

I get:

General configuration for OpenCV 3.2.0 =====================================
  Version control:               3.2.0

 GUI: 
    QT:                          NO
    GTK+:                        NO
    GThread :                    YES (ver 2.12.3)
    GtkGlExt:                    NO
    OpenGL support:              NO
    VTK support:                 NO

I dont know how to tell python3 to use my opencv compilation. I did make; make install and I have opcencv2.4 installed with apt-get.

edit retag flag offensive close merge delete