树莓派的定时拍照并上传到百度云
2021-05-13 07:29
标签:doc view index nbsp delay python targe wait ati 树莓派自带针对camera的bash命令还是很实用的。官网有介绍如何使用。 raspistill -o cam.jpg raspivid 捕获视频 raspivid -o video.h264 -t 10000 如果想在Python中调用camera功能,推荐使用这个 sudo apt-get update 具体看github上的说明吧,很详细了。ReadMe 直接贴代码吧,很easy。 每隔1分钟拍一次,自动上传到百度网我的应用数据/bypy文件夹下 参考链接:https://www.codeleading.com/article/4252655950/ 树莓派的定时拍照并上传到百度云 标签:doc view index nbsp delay python targe wait ati 原文地址:https://www.cnblogs.com/lfri/p/12001404.html树莓派的拍照功能
raspistill -t 30000 -tl 2000 -o image%04d.jpg
使用picamera py库
sudo apt-get install python-picamera
import picamera
camera = picamera.PiCamera()
camera.capture(‘image.jpg‘)
百度云文件同步的Python模块ByPy
import os
from time import sleep
from datetime import datetime, timedelta
from picamera import PiCamera
from bypy import ByPy
def wait(delay_minute = 1):
next_time = (datetime.now() + timedelta(minutes=delay_minute)).replace(second=0, microsecond=0)
delay = (next_time - datetime.now()).seconds
sleep(delay)
by=ByPy()
camera = PiCamera()
camera.start_preview()
wait()
for filename in camera.capture_continuous(‘img{timestamp:%Y-%m-%d-%H-%M}.jpg‘):
print(‘capture %s‘ % filename)
by.upload(filename)
os.remove(filename)
wait()