Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the simply-static domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/html/wp-includes/functions.php on line 6121
树莓派通过usb摄像头定时拍照

树莓派通过usb摄像头定时拍照

树莓派使用usb摄像头需要安装fswebcam,具体如下:

1、sudo apt-get install fswebcam

2、sudo nano capture.sh

#!/bin/bash
#DATE=$(TZ=UTC-8 date +%Y-%m-%d" "%H:%M:%S)
DATE=$(date +%Y-%m-%H-%M)
fswebcam -d /dev/video0 --no-banner -r 1024X768 -S 60 -D 2 -F 2 /home/pi/$DATE.jpg

3、chmod +x capture.sh

4、crontab -e

* * * * * /home/pi/capture.sh >/dev/null 2>&1

5、记得重启crontab

#重启crontab程序
sudo /etc/init.d/cron restart

fswebcam参数详解
-? –help 显示此帮助页面并退出
-c –config <文件名> 从文件加载配置
-q –quiet 隐藏所有消息(错误除外)
-v –verbose 捕获时显示额外的消息
–version 显示版本并退出
-l –loop <秒> 循环运行
-b –background 在后台运行
-o –output <文件名> 将日志输出到文件
-d –device <摄像头> 设置要使用的摄像头
-i –input 选择要使用的输入
-t –tuner 选择要使用的调谐器
-f –frequency 选择频率使用
-p –palette 选择要使用的调色板格式
-D –delay 设置预捕获延迟时间(秒)
-r –resolution <宽x高> 设置拍摄分辨率
–fps <帧率> 设置捕获帧率
-F –frames 设置要拍摄的帧数
-S –skip 设置要跳过的帧数
–dumpframe 将原始帧转储到文件
-s –set = 设定参数值
–revert 恢复原始捕获的图像
–flip 翻转图像
–crop [,] 裁剪图像的一部分
–scale 缩放图像
–rotate 垂直旋转图像
–deinterlace 减少隔行失真
–invert 反转图像颜色
–greyscale 去除图像的颜色
–swapchannels 交换c1和c2的通道
–no-banner 隐藏横幅
–top-banner 将横幅放在顶部
–bottom-banner 将横幅放在底部(默认)
–banner-colour 设置横幅颜色(#AARRGGBB)
–line-colour 设置横幅线条颜色
–text-colour 设置文字颜色
–font <[name][:size]> 设置字体和和大小
–no-shadow 禁用文字阴影
–shadow 启用文字阴影
–title 设置主标题(左上方)
–no-title 清除主标题
–subtitle 设置字幕 (左下方)
–no-subtitle 清除字幕
–timestamp 设置时间戳格式(右上)
–no-timestamp 清除时间戳记
–gmt 使用GMT代替本地时区
–info 设置信息文本(右下)
–no-info 清除信息文本
–underlay 设置参考图像
–no-underlay 清除底衬
–overlay 设置覆盖图像
–no-overlay 清除覆盖
–jpeg 输出JPEG图像
–png 输出PNG图像(-1, 0 – 10)
–save <文件名> 将图像保存到文件
–exec <命令> 执行命令并等待其完成