简体   繁体   English

输入窗口突然关闭 OpenCV

[英]Input Window Closing abruptly OpenCV

I want the project to open a window and detect my hand movement to form words.我希望该项目打开一个窗口并检测我的手部运动以形成单词。 The window is closing abruptly.窗户突然关闭。 Please help.请帮忙。

Link to the project:项目链接:

https://drive.google.com/drive/folders/1gQ65Su9Xk-ZCzGSmexOZfMr8662P9TsK?usp=sharing https://drive.google.com/drive/folders/1gQ65Su9Xk-ZCzGSmexOZfMr8662P9TsK?usp=sharing

Add ( & 0xFF )添加 ( & 0xFF )

    k = cv2.waitKey(1) & 0xFF

    # press e to terminate the camera
    if k == ord("e"):
        break
    cv2.destroyAllWindows()

This should help.这应该有帮助。 Make sure to close the braces properly as this new code should be inside the while loop only.确保正确关闭大括号,因为此新代码应仅在 while 循环内。

The link you posted is a google drive folder with multiple python files.您发布的链接是一个包含多个 python 文件的谷歌驱动器文件夹。 Try to specify which file you are referring to, next time.下次尝试指定您所指的文件。 I am assuming it is the Untitled notebook.我假设它是无题笔记本。 My answer is to just unindent video_capture.release() and cv2.destroyAllWindows().我的答案是取消缩进 video_capture.release() 和 cv2.destroyAllWindows()。

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

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