import cv2
webcam = cv2.VideoCapture(1) # Number which capture webcam in my machine
# try either VideoCapture(0) or (1) based on your camera availability
# in my desktop it works with (1)
check, frame = webcam.read()
cv2.imwrite(filename=r'<Your Directory>\saved_img.jpg', img=frame)
webcam.release()
使用opencv python包,下面的代码瞬间捕获网络摄像头信息并将图像保存在指定的目录中。注意:网络摄像头指示灯会亮几秒钟。到目前为止,我还不知道怎样才能避免这种情况。你知道吗
这段代码可以写在一个bat文件中,你可以为任何你想要的事件触发它(比如启动安全性)
相关问题 更多 >
编程相关推荐