Python error Opencv imshow

I am trying to try. I am building

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_PYTH ON_EXDLE_EXDLE_EXDLE_EXDLE_EXDLE_EXDLE_EXDLE_EXDLE_EXDLE_EXDLE_TEX_NEX_DMLES_NEX_DMLES_NEX_LAM_NAME_EXD_PLAY_ON_EXPLES_NEXLY_ ONLY D WITH_GTK = ON -D WITH_OPENGL = ON ..

and if I try to use python:

import cv2

print (CV2. version )

3.2.0

my full code is: ( https://www.solarianprogrammer.com/2016/09/17/install-opencv-3-with-python-3-on-windows/ )

import cv2 image = cv2.imread("/home/reigin/Pictures/games.jpg") gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) cv2.imshow("Over the Clouds", image) cv2.imshow("Over the Clouds - gray", gray_image) cv2.waitKey(0) cv2.destroyAllWindows() 

I got an error:

 cv2.imshow("Over the Clouds", image) 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 cvShowImage, file /io/opencv/modules/highgui/src/window.cpp, line 583 Traceback (most recent call last): File "<stdin>", line 1, in <module> cv2.error: /io/opencv/modules/highgui/src/window.cpp:583: error: (-2) 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 function cvShowImage 

i install dpk-configure:

 reigin@reigin-K43SA :~$ echo $PKG_CONFIG_PATH /usr/local/lib/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig 

if I do otherwise than show my image, no problem.

can not help:

opencv 3.0 python imshow error

http://vinllen.com/solve-error-libgtk2-0-dev-and-pkg-config-when-install-opencv/

http://answers.opencv.org/question/57945/opencv-gui-with-gtk-2-solved/

https://askubuntu.com/questions/210210/pkg-config-path-environment-variable

Thank you for your attention and help ..

+6
source share
1 answer

Perhaps you are using opencv-python pip that does not support GTK. Your python bindings should come from your opencv assembly.

Check the /usr/local/lib/python2.7/site-packages/ folder and make sure that you have the cv2.so file from your compilation and opencv installation and that you are not using the package from op opvv-python in dist-packages .

See here: http://www.pyimagesearch.com/2015/06/22/install-opencv-3-0-and-python-2-7-on-ubuntu/

Here was my Cmake line to prepare for the installation:

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D WITH_GTK=ON -D WITH_V4L=ON -D WITH_OPENGL=ON -D WITH_CUBLAS=ON -DWITH_QT=OFF -DCUDA_NVCC_FLAGS="-D_FORCE_INLINES" ..

Please note that this assumes that you have installed the appropriate libgtk via sudo apt-get install libgtk2.0-dev.

This is what CMake should send:

- GUI:

- QT: NO

- GTK + 2.x: YES (version 2.24.30)

- GThread: YES (ver 2.48.2)

- GtkGlExt: YES (ver 1.2.0)

- OpenGL support: YES (/usr/lib/x86_64-linux-gnu/libGLU.so/usr/lib/x86_64-linux-gnu/libGL.so)

- VTK support: YES (ver 6.2.0)

+1
source

Source: https://habr.com/ru/post/1014351/


All Articles