I know there are many topics on how to install OpenCV-Python.
I went over many of them and they helped me to go through some problems installing openCV-python on Ubuntu
I managed to install openCV but is not properly working. When I try to run:
import numpy
import cv2
img= cv2.imread('image.png',0)
cv2.imshow('image',img)
I get an error
error: /io/opencv/modules/highui/src/window.cpp:583: error: (-2) The
function is not implemented. Rebuilt 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 cvSowImage
How do I do that? I suspect I should repeat cmake and somehow include these two libraries on it, but how?
EDIT March 19 2017
I followed instructions from:
http://milq.github.io/install-opencv-ubuntu-debian/
and
http://www.pyimagesearch.com/2016/10/24/ubuntu-16-04-how-to-install-opencv/
and from:
http://docs.opencv.org/trunk/d7/d9f/tutorial_linux_install.html
Everytime my script include (I am running from IDLE):
cv2.imshow('image',img
)
I got the same error message:
Traceback (most recent call last):
File "/home/dcanals/Documents/test.py", line 5, in <module>
cv2.imshow('image',img)
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 rellay do not understand what is going on. I just want to have openCV to start learning this package. I have libgtk2 and pkg-config installed. I follow step by step the instructions. Why it is not working? What should I do now to get python-openCV working? Thank you
EDIT March 21 2017
I edit this post because I think I found very important documentation in:
https://pypi.python.org/pypi/opencv-python
Where is written abouth the package 'opencv-python':
IMPORTANT NOTE:
MacOS and Linux wheels have some limitations:
video related functionality is not supported (not compiled with
FFmpeg) for example cv.imshow() will not work (not compiled with GTK+
2.x or Carbon support)
SOLVED
I managed to make it work.
The problem was I had a mix of packages, that probably were incompatible.
First time I tried to install OpenCV I used opencv-python package. It didn't work, so I tried to build the official opencv with python. Nothing worked.
The solution was to re-install Ubuntu 16.10 and re-install opencv from the official site.
See Question&Answers more detail:
os