import numpy as np import cv2
img = cv2.imread('messi5.jpg',0) cv2.imshow('image',img) k = cv2.waitKey(0) if k == 27: # wait for ESC key to exit cv2.destroyAllWindows() elif k == ord('s'): # wait for 's' key to save and exit cv2.imwrite('messigray.png',img) cv2.destroyAllWindows()
Traceback (most recent call last): File "C:\Users\DEBASISH\AppData\Local\Programs\Python\Python36\Projects\read_image.py", line 5, in <module> cv2.imshow('image',img) cv2.error: OpenCV(4.1.0) C:\projects\opencv-python\opencv\modules\highgui\src\window.cpp:627: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa 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'
(While running this code I am getting this error , I am using windows10 Pro 6bit OS)