繁体   English   中英

运行后的命令 cv2.imshow()、waitKey()、destroyAllWindows() 关闭镜像后继续运行

[英]The commands cv2.imshow(), waitKey(), destroyAllWindows() after running continues to run even after closing the image

当我使用 imshow() function 运行并打开图像时,它运行正常并且图像打开,但即使我退出图像,单元格(突出显示)仍会继续运行并且不会停止(你可以看到一颗星)。 当我运行其他命令时,仍然会加载单元格并且不运行。 我重新启动了 kernel 但没有任何变化。 问题仅在运行 imshow() 和单元格加载的单元格内容时出现。 在此处输入图像描述

不要在 jupyter notebook 中使用任何基于窗口/框架的代码。

cv2.waitKey() 的 API 文档说明了以下内容:

    This function is the only method in HighGUI that can fetch and handle events, so it needs to be called periodically for normal event processing unless HighGUI is used within an environment that takes care of event processing.

所以,它只是挂起。

以下是有关如何使用它的一些详细信息: https://medium.com/@mrdatainsight/how-to-use-opencv-imshow-in-a-jupyter-notebook-quick-tip-ce83fa32b5ad

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM