1

I am getting this error while running a simple Python3 with opencv program on 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
/io/opencv/modules/highgui/src/window.cpp, line 583 Traceback (most
recent call last):   File "samplecv.py", line 3, in <module>
    cv2.imshow('image',img) 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

The program I ran is:

  import cv2
    img = cv2.imread('my.jpg',0)
    cv2.imshow('image',img)

I have already checked similar questions this and this. And have re-installed opencv but it didnt help.

2
  • 1
    If you installed OpenCV through Python PIP, it's well known that the Python wrappers are not compiled with GTK support, so you are not able to show an image on the screen and hence those errors. The only choice you have is to compile the source to generate the right Python packages so that you can show images. These directions from PyImageSearch are quite good: pyimagesearch.com/2015/07/20/…. Be prepared to spend between 30 minutes to an hour depending on your system configuration and setup. Commented Aug 14, 2017 at 7:12
  • thanks its done now. Commented Aug 14, 2017 at 14:08

2 Answers 2

1

It took more than 2 hours but its done now! I went to this documentation of opencv and followed the step to install opencv 3.3.0-dev. After complete installation it was still not working so i uninstalled the opencv-python using

sudo pip3 uninstall opencv-python

now errors were not showing up but still the image was not displayed until i added

cv2.waitKey()

at the end of the program. Now its working fine!!!

Sign up to request clarification or add additional context in comments.

1 Comment

Yes you must use waitKey. A lot of users forget to do this.
0

What you had tried is more suitable for python2. You are using python3 (as I can see from your question). I guess you're installing cv module using pip3 install command. It works but provides the module with decreased functionality: as you see for one from highgui module 'The function is not implemented.'

The solution: try the 1st answer from here and install opencv module manually step-by-step as described.

1 Comment

the cmake -D CMAKE_BUILD_TYPE=RELEASE \ -D CMAKE_INSTALL_PREFIX=/usr/local \ -D INSTALL_C_EXAMPLES=ON \ -D INSTALL_PYTHON_EXAMPLES=ON \ -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \ -D BUILD_EXAMPLES=ON .. was giving error . Anyways i sorted it out thank you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.