树莓派的定时拍照并上传到百度云
树莓派的拍照功能
树莓派自带针对camera的bash命令还是很实用的。官网有介绍如何使用。
- raspistill 捕获静态图像
raspistill -o cam.jpg
raspistill -t 30000 -tl 2000 -o image%04d.jpg
raspivid 捕获视频
raspivid -o video.h264 -t 10000
使用picamera py库
如果想在Python中调用camera功能,推荐使用这个
- 安装
sudo apt-get update
sudo apt-get install python-picamera
- 调用
import picamera camera = picamera.PiCamera() camera.capture(‘image.jpg‘)
百度云文件同步的Python模块ByPy
具体看github上的说明吧,很详细了。ReadMe
直接贴代码吧,很easy。
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()
每隔1分钟拍一次,自动上传到百度网我的应用数据/bypy文件夹下
相关推荐
LeeHDsniper 2020-11-05
橄榄 2020-11-03
wanshiyingg 2020-09-29
andonliu 2020-09-03
嵌入式开发爱好者 2020-08-28
lu00kill 2020-08-17
tianyayi 2020-08-16
LIEVEZ 2020-08-09
ohhardtoname 2020-07-25
LeeHDsniper 2020-07-19
shenxiuwen 2020-07-16
wzxxtt0 2020-06-25
mattraynor 2020-06-25
咏月东南 2020-06-10
wangz 2020-06-03
wanxuncpx 2020-06-01
tianyayi 2020-05-18
wanxuncpx 2020-05-15
mattraynor 2020-05-12
wzxxtt0 2020-05-12
LIEVEZ 2020-05-04
mattraynor 2020-05-01
LIEVEZ 2020-05-01
LIEVEZ 2020-05-01
LowisLucifer 2020-04-23
OathKeeper 2020-04-22
zcabcd 2020-04-18
wanxuncpx 2020-04-16
returnspace 2020-04-16
mattraynor 2020-04-14
tianyayi 2020-03-28
clamzxf 2020-03-28
Summer的小屋 2020-03-26
lu00kill 2020-03-17
yuancr 2020-03-04
wzxxtt0 2020-02-21
xinhao 2020-02-20
LIEVEZ 2020-02-17
wzxxtt0 2020-02-15
zhufu 2020-02-10