我正在尝试运行此处提到的 Tesseract Ocr 代码
https://www.pyimagesearch.com/2018/09/17/opencv-ocr-and-text-recognition-with-tesseract/
在 ec2 ubuntu 服务器 20.0.
我面临以下错误:
cv2.imshow("Text Detection", output)
错误如下: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.
Available platform plugins are: xcb, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc.
Aborted (core dumped)
我知道这行代码会打开一个窗口来显示检测到的输出图像,但是那个窗口没有出现。请帮助解决错误。
最佳答案
您收到此错误是因为没有 UI 可以打开窗口并显示图像。
快速修复将是保存和下载图像。并在本地查看。
另一种方法是设置 XServer 并通过 SSH 启用 X11 转发。
关于opencv - qt.qpa.xcb : could not connect to displayerror while using OpenCV on ec2 ubuntu server 20. 0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64784315/