Ask Your Question
0

OpenCV in Anaconda imshow crash (Kubuntu)

asked 2017-05-04 03:33:13 -0600

On Kubuntu LTS 16.04 I have installed Anaconda 4.3.14 with Spyder 3.1.2 and have tried for days to get OpenCV to install and work correctly. Finally I installed it using the following command:

conda install -c https://conda.binstar.org/menpo opencv

When I tried to run a script though, while Python (3.6) imports the cv2 library correctly, and cv2.imshow() outputs the image in a window as intended, but when I try to close the image window (either by key or by X button) it stops responding and the kernel dies.

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

There used to be two messages when the kernel tried to reboot (even though I had both of these libraries):

  • (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

  • Gtk‑WARNING *: Unable to locate theme engine in module_path: "adwaita"

But now I've installed some packages / libraries and no message appears any more, just the kernel dies

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2017-05-04 03:41:58 -0600

berak gravatar image

updated 2017-05-04 03:47:30 -0600

opencv does not maintain any python binaries, what you downloaded from 3rd party menpo, might not fit your system (e.g. it was built without any gui support, as your message hints, or against a different gtk version)

note, that even if you have the correct gtk version installed, - the opencv libs in cv2.so must have been build with it before (there's the trouble, i guess).

rather try to build from src so it uses exactly the libs available on your system.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-05-04 03:31:31 -0600

Seen: 2,281 times

Last updated: May 04 '17