0

I'm running the below code in python

import numpy as np import cv2

print "hello"

img = cv2.imread('image.JPG',0) print img

cv2.imshow('sood',img)

I'm getting the below error every time - Can someone help!

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 /Users/travis/build/skvark/opencv-python/opencv/modules/highgui/src/window.cpp, line 583 Traceback (most recent call last): File "cv2ImageProcessing.py", line 9, in cv2.imshow('sood',img) cv2.error: /Users/travis/build/skvark/opencv-python/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

Saurav Sood
  • 101
  • 2
  • 12
  • I'm getting an array printed when I print "img", so image is getting probably read, but imshow is still not working. – Saurav Sood Apr 25 '17 at 12:44
  • Have a look at [THIS SO PAGE](http://stackoverflow.com/questions/40207011/opencv-not-working-properly-with-python-on-linux-with-anaconda-getting-error-th?rq=1) – Jeru Luke Apr 25 '17 at 17:39

2 Answers2

0

Why don't you install libgtk2.0-dev it seems like it is asking you to install that. Try sudo apt-get install libgtk2.0-dev.

If it doesn't work out then try installing all the dependencies mentioned in the script. I installed OpenCV on my system using this script and everything works fine.

sv_jan5
  • 1,543
  • 16
  • 42
0

This script works:

import numpy as np
import cv2

print "hello"

img = cv2.imread('image.jpg',0)
print img

cv2.imshow('sood',img)
cv2.waitKey()
cv2.destroyAllWindows()

Most likely your OpenCV3 is not properly installed. Try to reinstall it. Read this how-to. It is very easy to install Python OpenCV3 on Windows with *.whl file.

FooBar167
  • 2,721
  • 1
  • 26
  • 37