树莓派3B+(09):摄像头拍照

摄像头拍照

继上次装了宝塔面板后,桌面登不进,只好把系统重刷了,花费了一个半小时重新进行配置,接着搞一下摄像头。


一、安装摄像头

注意:一定不要热拔插摄像头!!会坏掉的!!

这里写图片描述


二、使能摄像头

sudo raspi-config

进入软件配置页面,使能摄像头接口,配置完成后会提示重启,重启完成即可使用摄像头拍照。


三、拍照

两秒钟(时间单位为毫秒)延迟后拍摄一张照片,并保存为 image.jpg(保存在当前目录下!)命令如下:

raspistill -t 2000 -o image.jpg

-t, –timeout : 拍照和关闭时的延时指定,未指定时默认是5s
-o, –output : 输出文件名 <文件名>,如果要写到stdout,使用-o -,如果不特别指定,图像文件不会被保存
这里写图片描述


四、raspistill的使用

各项参数与命令:https://www.cnblogs.com/jikexianfeng/p/7130843.html
官方帮助文档:https://www.raspberrypi.org/app/uploads/2013/07/RaspiCam-Documentation.pdf
下载好的文档:https://pan.baidu.com/s/17WCyMThQXYpkl7iWv_-Sdw

常用命令:

常用命令:
# 两秒钟(时间单位为毫秒)延迟后拍摄一张照片,并保存为 image.jpg
raspistill -t 2000 -o image.jpg

# 拍摄一张自定义大小的照片。
raspistill -t 2000 -o image.jpg -w 640 -h 480

# 降低图像质量,减小文件尺寸
raspistill -t 2000 -o image.jpg -q 5

# 强制使预览窗口出现在坐标为 100,100 的位置,并且尺寸为宽 300 和高 200 像素。
raspistill -t 2000 -o image.jpg -p 100,100,300,200

# 禁用预览窗口
raspistill -t 2000 -o image.jpg -n

# 将图像保存为 PNG 文件(无损压缩格式,但是要比 JPEG 速度慢)。注意,当选择图像编码时,文件扩展名将被忽略。
raspistill -t 2000 -o image.png –e png

# 向 JPEG 文件中添加一些 EXIF 信息。该命令将会把作者名称标签设置为 Dreamcolor,GPS 海拔高度为 123.5米。
raspistill -t 2000 -o image.jpg -x IFD0.Artist=Dreamcolor -x GPS.GPSAltitude=1235/10

# 设置浮雕风格图像特效
raspistill -t 2000 -o image.jpg -ifx emboss

# 设置 YUV 图像的 U 和 V 通道为指定的值(128:128 为黑白图像)
raspistill -t 2000 -o image.jpg -cfx 128:128

# 仅显示两秒钟预览图像,而不对图像进行保存。
raspistill -t 2000

# 间隔获取图片,在 10 分钟(10 分钟 = 600000 毫秒)的时间里,每 10 秒获取一张,并且命名为 image_number_1_today.jpg,image_number_2_today.jpg... 的形式。
raspistill -t 600000 -tl 10000 -o image_num_%d_today.jpg

# 获取一张照片并发送至标准输出设备
raspistill -t 2000 -o -

# 获取一张照片并保存为一个文件
raspistill -t 2000 -o - > my_file.jpg

猜你喜欢

转载自blog.csdn.net/meteor_s/article/details/81037959