@SiberiaBear
2015-05-11T03:22:41.000000Z
字数 1657
阅读 3558
raspberryPi
固定地址:https://www.zybuluo.com/SiberiaBear/note/51383
注:由于最近不再搞树莓派摄像头,本文已停止更新 2015年5月11日
这里的函数非常的不全面,旨作为我学习时学过的笔记,详细信息请参见树莓派官方指南-摄像头篇,更多情况下,请man一下就好,我对man的内容进行了简单的翻译
说明:
Runs camera for specific time, and take JPG capture at end if requested
使用基本指令:
raspistill -o image.jpg
参数:
-o --output: Output filename (to write to stdout, use '-o -'). If not specified, no file is saved
-w --width: Set image width
-h --height: Set image height
-t --timeout: Time (in ms) before takes picture and shuts down (if not specified, set to 5s)minimum 30ms, setting to 0 waits forever. 注:如果你设置成0,你会后悔的,相信我。
已知现在我还没有找到可以支持simpleCV支持CSI接口的资料,不排除我没好好找的原因,也由于个人能力问题,这样只能采取一种绕弯的方法来实现。
我是用树莓派做的,由上边我们知道一个函数raspistill,用这个函数就可以实现。
方法是:首先用该函数拍下一张照片(用subprocess调用),然后将照片读入。
该程序出现的问题有:
1. 图像拍照速度过慢
2. 脸部识别失败率高
以下例程是我参考资料编写的实现面部识别返回面部中部坐标的Python程序
1 import subprocess2 from SimpleCV import Camera, Image3 from time import sleep45 filename = "face.jpg"6 cmd = 'raspistill -w 960 -h 720 -o ' + filename + ' -t 100'7 pid = subprocess.call(cmd, shell=True)891011 captureImg = Image(filename)1213 faces = captureImg.findHaarFeatures('face')14 if faces:15 for face in faces:16 print "Face at: " + str(face.coordinates())17 face.draw()18 else:19 print "No faces detected."2021 captureImg.save(filename)
| S5 Pin | Name | Purpose |
|---|---|---|
| 1 | Ground | Ground |
| 2 | CAM1_DN0 | DataLane0 |
| 3 | CAM1_DP0 | DataLane0 |
| 4 | Ground | Ground |
| 5 | CAM1_DN1 | DataLane1 |
| 6 | CAM1_DP1 | DataLane1 |
| 7 | Ground | Ground |
| 8 | CAM1_CN | MIPIClock |
| 9 | CAM1_CP | MIPIClock |
| 10 | Ground | Ground |
| 11 | CAM_GPIO | |
| 12 | CAM_CLK | |
| 13 | SCL0 | I2C Bus |
| 14 | SDA0 | I2C Bus |
| 15 | +3.3V | Power |