138 Star 658 Fork 253

mktime/python-learn

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
capture-camera.py 463 Bytes
一键复制 编辑 原始数据 按行查看 历史
内部项目 提交于 2024-10-10 17:16 +08:00 . 调用opencv获取摄像头视频截图
import cv2
import datetime
# 调用摄像头,PC电脑中0为内置摄像头,1为外接摄像头
video = cv2.VideoCapture(0)
# 判断video是否打开
judge = video.isOpened()
while judge:
ret, frame = video.read()
df = datetime.datetime.now()
date = df.strftime('%Y%m%d%H%M%S')
fpath = f'/data/webdav/camera/{date}.jpg'
print('fpath', fpath)
cv2.imwrite(fpath, frame)
break
# 释放窗口
video.release()
cv2.destroyAllWindows()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/mktime/python-learn.git
git@gitee.com:mktime/python-learn.git
mktime
python-learn
python-learn
master

搜索帮助