my code:
import cv2
img = cv2.imread("dU4fHDw-Ho.jpg", cv2.IMREAD_GRAYSCALE)
cv2.imshow('image', img)
k = cv2.waitKey(0)
if k == 27:
cv2.destroyWindow()
And i get this error:
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 "simpleopencv.py", line 4, 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
I'm using linux mint KDE What might be the problem?
Update1: Opencv works fine with python2.7 but not working for python3.5
Update2: As it turns out running the script as Jack Gold suggested actually worked but since i already had cv2 folder in my /usr/local/lib/python3.5/dist-packages/ (which was installed using PIP i think) conflicted with the one install using the script and python3 kept using the PIP version so, I deleted that cv2 folder and restarted and everything worked fine.