System information (version)
OpenCV => 4.2.0
Operating System / Platform => Windows 10
Compiler => Juypter Hub
I am getting an error while running this code:
img = cv2.imread("Screenshot.png")
cv2.imshow(" ", img)
Error: OpenCV(4.2.0) /io/opencv/modules/highgui/src/window.cpp:634: 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 'cvNamedWindow'
Installation process was:
pip install opencv-python-headless
By going through this issue it seems that I cannot use cv2.imshow()on a remotely hosted jupyter. Is there any workaround except for switching compiler?
The issue is not related to this repository. It's related to your environment and how you use opencv-python. There are questions regarding this at Stack Overflow, see for example https://stackoverflow.com/questions/55231943/how-to-use-opencv-in-a-remote-jupyter-notebook-execution
opencv-python-headless does not include GUI support (as explained by berak in the linked issue). Please read the README file and do as it suggests: uninstall opencv-python-headless and install opencv-python and you will get support for cv2.imshow etc.
BUT as your code runs on a remote machine, you'll need X11 forwarding to see the remote system GUI windows on your local machine. Please seek help for example at Stack Overflow. This repository is just an automated build toolchain which creates pre-built OpenCV packages for Python.
Most helpful comment
The issue is not related to this repository. It's related to your environment and how you use
opencv-python. There are questions regarding this at Stack Overflow, see for example https://stackoverflow.com/questions/55231943/how-to-use-opencv-in-a-remote-jupyter-notebook-executionopencv-python-headlessdoes not include GUI support (as explained by berak in the linked issue). Please read the README file and do as it suggests: uninstallopencv-python-headlessand installopencv-pythonand you will get support forcv2.imshowetc.BUT as your code runs on a remote machine, you'll need X11 forwarding to see the remote system GUI windows on your local machine. Please seek help for example at Stack Overflow. This repository is just an automated build toolchain which creates pre-built OpenCV packages for Python.