让树莓派变身照相机——摄像头控制

转载自:点击打开链接

1.前言

树莓派作为一台小型电脑,玩法多种多样。本文介绍树莓派控制摄像头的方法。

2.准备工作

1)连接摄像头与树莓派

2)修改树莓派配置,开启摄像头模块。

  1. sudo raspi-config  

如图所示,选择“Enable Camera”, 保存后将自动重启。

3. 拍摄与查看

接下来,可以进行拍摄了。

  1. raspistill -t 2000 -o image.jpg  

raspistill是树莓派控制摄像头拍照的命令,-t制定捕获图片等待时间,单位毫秒 -o输出文件名

查看图片命令

  1. gpicview image.jpg  

4. 常用命令

  1. 常用命令:  
  2. # 两秒钟(时间单位为毫秒)延迟后拍摄一张照片,并保存为 image.jpg  
  3. raspistill -t 2000 -o image.jpg  
  4.   
  5. # 拍摄一张自定义大小的照片。  
  6. raspistill -t 2000 -o image.jpg -w 640 -h 480  
  7.   
  8. # 降低图像质量,减小文件尺寸  
  9. raspistill -t 2000 -o image.jpg -q 5  
  10.   
  11. # 强制使预览窗口出现在坐标为 100,100 的位置,并且尺寸为宽 300 和高 200 像素。  
  12. raspistill -t 2000 -o image.jpg -p 100,100,300,200  
  13.   
  14. # 禁用预览窗口  
  15. raspistill -t 2000 -o image.jpg -n  
  16.   
  17. # 将图像保存为 PNG 文件(无损压缩格式,但是要比 JPEG 速度慢)。注意,当选择图像编码时,文件扩展名将被忽略。  
  18. raspistill -t 2000 -o image.png –e png  
  19.   
  20. # 向 JPEG 文件中添加一些 EXIF 信息。该命令将会把作者名称标签设置为 Dreamcolor,GPS 海拔高度为 123.5米。  
  21. raspistill -t 2000 -o image.jpg -x IFD0.Artist=Dreamcolor -x GPS.GPSAltitude=1235/10  
  22.   
  23. # 设置浮雕风格图像特效  
  24. raspistill -t 2000 -o image.jpg -ifx emboss  
  25.   
  26. # 设置 YUV 图像的 U 和 V 通道为指定的值(128:128 为黑白图像)  
  27. raspistill -t 2000 -o image.jpg -cfx 128:128  
  28.   
  29. # 仅显示两秒钟预览图像,而不对图像进行保存。  
  30. raspistill -t 2000  
  31.   
  32. # 间隔获取图片,在 10 分钟(10 分钟 = 600000 毫秒)的时间里,每 10 秒获取一张,并且命名为 image_number_1_today.jpg,image_number_2_today.jpg... 的形式。  
  33. raspistill -t 600000 -tl 10000 -o image_num_%d_today.jpg  
  34.   
  35. # 获取一张照片并发送至标准输出设备  
  36. raspistill -t 2000 -o -  
  37.   
  38. # 获取一张照片并保存为一个文件  
  39. raspistill -t 2000 -o - > my_file.jpg 



下面还是讲一下我自己做的一个小作品。

下面链接是自己做的一个小作品,是用来学习汉字结构的,我们将汉字的结构具体展现出来了,摆脱了以往汉字教学中的模糊概念,希望大家可以看看多提提意见。

汉字结构学习

posted on 2017-02-18 23:22  WMN7Q  阅读(1119)  评论(0编辑  收藏  举报

导航