I’m trying to run OpenCV in a remote Docker container and display image windows, but I’m encountering issues. Here’s my setup:
- Host: Remote server (accessed via SSH)
- Container OS: Ubuntu 20.04.3 LTS
- Python version: 3.8.10
- OpenCV version: opencv-contrib-python 4.10.0.84
When I try to display an image using the following code:
import cv2
img = cv2.imread("bd_logo1.png")
cv2.imshow("1", img)
The Python program exits automatically with the following error:
qt.qpa.xcb: could not connect to display
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/usr/local/lib/python3.8/dist-packages/cv2/qt/plugins" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
I need to be able to display image windows because I’m working on a multi-object tracking project that requires selecting targets through a GUI window.
I’ve tried using Jupyter Lab for remote control, but the same issue persists.
Any help or suggestions would be greatly appreciated. Thank you!
jianfeng Wang is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.