This is the exact error that I am getting. My OS is Ubuntu 16.10.
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 /feedstock_root/build_artefacts/work/opencv-3.1.0/modules/highgui/src/window.cpp, line 545 Traceback (most recent call last): File "untitled.py", line 7, in cv2.imshow('image',img) cv2.error: /feedstock_root/build_artefacts/work/opencv-3.1.0/modules/highgui/src/window.cpp:545: 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
my code is:
import numpy as np
import cv2
# Load an color image in grayscale
img = cv2.imread('0002.png',0)
cv2.imshow('image',img)
cv2.waitKey(0)
cv2.destroyAllWindows()
0002.png is an image in the same directory as the program. I first installed anaconda with python 3.5, then I installed opencv by using the command
conda install -c conda-forge opencv
I installed libgtk2.0-dev just as the error said to but I still get the same error. Any help would be much appreciated. I've been trying to solve this for several hours.
I followed this tutorial (OpenCV GTK+2.x error) and did the following. It worked for me :
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 ..
If you installed OpenCV using the opencv-python pip package at any point in time, be aware of the following note, taken from https://pypi.python.org/pypi/opencv-python
Also note that to install from another source, first you must remove the opencv-python package
For me (Arch Linux, Anaconda with Python 3.6), installing from the suggested channels
menpo
orloopbio
did not change anything. My solution (see related question) was tosudo pacman -Syu pkg-config
),conda remove opencv
) andconda install -c conda-forge opencv
)conda list
now returnsopencv 3.3.0 py36_blas_openblas_203 [blas_openblas] conda-forge
and all windows launched using cv2 are working fine.Remove opencv from anaconda=
Then, reinstall opencv using pip:
This is working for me.
My Envirment is Win10, and I added the anaconda path to the environment variables's PATH’,the cv2.imshow worked
Then restart the windows
If you are running inside docker then you may get this error.Solution uninstall current and install the headless one
If you are writing to the image and displaying it, you may need the following
And if you are wondering how to get the display from Docker, it is possible via X11 in your host