简体   繁体   English

相机无法在我的循环中关闭

[英]Camera will not shut off in my loop

I'm following the article here but it seems that when I run this loop the camera does not shut off, and requires me to manually power down the unit to get out of the program. 我正在关注本文但似乎在运行此循环时,相机无法关闭,并且需要我手动关闭设备电源才能退出程序。 Even holding down ctrl + alt + t does not exit the program. 即使按住ctrl + alt + t也不会退出程序。

Any help would be greatly appreciated. 任何帮助将不胜感激。

camera.start_preview()
for i in range(5):
    sleep(5)
    camera.capture('/home/pi/Desktop/image%s.jpg' % i)
camera.stop_preview()

Adding camera.close() does not help. 添加camera.close()没有帮助。

camera.start_preview()
for i in range(5):
    sleep(5)
    camera.capture('/home/pi/Desktop/image%s.jpg' % i)
camera.stop_preview()
camera.close()

Have you tried to do the following without anything else? 您是否尝试过以下操作?

camera.start_preview() 
camera.close()

It should do the trick 它应该可以解决问题

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

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