1

python duke.py

Traceback (most recent call last): File "duke.py", line 5, in cv2.imshow('ktm',img)

cv2.error: OpenCV(3.4.2) /opt/conda/conda-bld/opencv-suite_1535678557175/work/modules/highgui/src/window.cpp:632: error: (-2: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 function 'cvShowImage'

here is my code

import cv2
img = cv2.imread('Downloads/404615.jpg',1)

while True:

    cv2.imshow('ktm',img)

    if cv2.waitkey(1) & 0*FF == 27:
        break

cv2.destroyAllWindows()
AzyCrw4282
  • 7,222
  • 5
  • 19
  • 35
Dev
  • 11
  • 1
  • 3

4 Answers4

1

I had the same issue. Solved it by doing the following:

pip uninstall opencv-python
pip install opencv-python
AZ123
  • 156
  • 2
  • 11
0

This error happen because of conda. Follow the commands below and should solve your problem:

conda remove opencv
conda install -c menpo opencv
pip install --upgrade pip
pip install opencv-contrib-python

There are also other possible solutions here

AzyCrw4282
  • 7,222
  • 5
  • 19
  • 35
0

It back to normal after I try to reinstall the opencv

pip install --upgrade opencv-python
0

uninstalling and reinstalling opencv seems to work for some people. Though, if you want to understand want happened, the answer is here;

https://stackoverflow.com/a/68975495/4838973

jsfa11
  • 483
  • 7
  • 19