OpenCV not working properly with python on Linux with anaconda. Getting error that cv2.imshow() is not implemented
1.The easiest way:
conda remove opencv
conda update conda
conda install --channel menpo opencv
or (for OpenCV 3.1) :
conda install -c menpo opencv3
2.And if u don't want to do this, you can try to use matplotlib .
import cv2
import matplotlib.pyplot as plt
img = cv2.imread('img.jpg',0)
plt.imshow(img, cmap='gray')
plt.show()
3.Or try to build library by your own with option WITH_GTK=ON
, or smth like that.
Update - 18th Jun 2019
I got this error on my Ubuntu(18.04.1 LTS) system for openCV 3.4.2, as the method call to cv2.imshow was failing. I am using anaconda. Just the below 2 steps helped me resolve:
conda remove opencv
conda install -c conda-forge opencv=4.1.0
If you are using pip, you can try
pip install opencv-contrib-python
I have had to deal with this issue a couple of times, this is what has worked consistently thus far:
conda remove opencv
conda install -c menpo opencv
pip install --upgrade pip
pip install opencv-contrib-python
If you installed OpenCV using the opencv-python pip package at any point in time, be aware of the following note, taken from https://pypi.python.org/pypi/opencv-python
IMPORTANT NOTE MacOS and Linux wheels have currently some limitations:
- video related functionality is not supported (not compiled with FFmpeg)
- for example
cv2.imshow()
will not work (not compiled with GTK+ 2.x or Carbon support)
Also note that to install from another source, first you must remove the opencv-python package