[英]Using Raspberry Pi + Webcam to record video in python, but sometimes camera does not turn on/off as I expected
I am trying to using Raspberry Pi + webcam (logitech) to record video, but there is a problem at the first step... I would like to male the webcam turned on when needed, and turned off otherwise, however when I try 我正在尝试使用Raspberry Pi +网络摄像头(logitech)录制视频,但是第一步存在问题...我想在需要时打开网络摄像头的电源,然后在尝试时关闭网络摄像头的电源。
cap = cv2.VideoCapture(0)
if cap.isOpened() != True:
cap.open(0)
the webcam still didn't turn on sometimes... so I would like to know if someone knows the solution, I will appreciate you! 网络摄像头有时仍然无法打开...所以我想知道是否有人知道解决方案,我将不胜感激! Thanks!
谢谢!
try releasing it first, before opening it: 尝试先释放它,然后再打开它:
cap = cv2.VideoCapture(0)
if cap.isOpened() != True:
cap.release()
cap.open(0)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.