2
votes

I see problem unsolvable.I get this error when I try to import numpy

import cv2
import numpy as np

img=cv2.imread('image.jpg',1)
cv2.imshow('image', img)
cv2.waitkey()
cv2.destroyAllWwindows()

when I run attribute imread is not working

cv2.error: OpenCV(3.4.1) C:\projects\opencv-python\opencv\modules\highgui\src\window.cpp:636: 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

Please help, Python version 3.6

OpenCV version :3.4.1

matplotlib version : 2.2.2

2
cv2.imshow is not implemented. Print the output of function cv2.getBuildInformation() and in the result search for GUI. - zindarod
If you look under the heading GUI, you'll see VTK support: NO. This means your OpenCV was not built with GUI support. Follow an online guide and build opencv from source with GUI support. - zindarod

2 Answers

14
votes

I had the same issue too. Despite they were installed before, I've installed them again via:

pip install opencv-python 
pip install opencv-contrib-python 

and problem solved.

2
votes

I was having the same problem under python v3.7.9

I typed pip list and I had opencv-python-headless version 4.4.0.44

I looked under GUI tag and VTK support: NO

I typed the command @Samet suggested and now I have

opencv-contrib-python           4.4.0.46
opencv-python                   4.4.0.46
opencv-python-headless          4.4.0.44

It is working now but I don't know if I should leave 'opencv-python-headless'. As @Fabio Baldissera said he only installed opencv-contrib-python and it worked but I don't know if you would want to end up with opencv-python and opencv-contrib from two different versions, I would not recommend it.

I'm able to show a RTSP stream now.