通过 cv2.imshow() 显示的图像窗口弹出窗口对我来说关闭得非常快
只是一个示例代码
import cv2 as cv
img = cv.imread('book.jpg')
cv.imshow('img', img)
cv.waitKey(0)
窗口打开后关闭,我什至无法正确看到图像。
我认为发生这种情况是因为我使用的是 WSL (Linux),但在 Windows 中我也发生了同样的事情。
同样的事情在我朋友的电脑上运行得很好。这里可能有什么问题?
Just a sample code
import cv2 as cv
img = cv.imread('book.jpg')
cv.imshow('img', img)
cv.waitKey(0)
As soon as the window opens, it closes, I am not able to even see the images properly.
I thought it was happening because I was using WSL (Linux) but the same thing is happening for me in windows too.
The same thing works fine on my friends computer. What could be the issue here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
因此,解决此问题的方法是将 destroyAllWindows 任务添加到队列中并延迟它。
新代码将
感谢 @AbhinavMathur 评论
So a workaround for this is to add destroyAllWindows task to the queue and delay it.
the new code would be then
thanks to @AbhinavMathur comment