总所周知,树莓派上,调用摄像头的指令有raspistill和raspivid。若要使用opencv对摄像头进行调用,不少人会出现
cvCaptureFromCAM(0)函数无法找到Pi Cam的错误情况。
但是当树莓派外接USB摄像头时,该函数可以正常使用。但对于一体机器,想要把树莓派封装成一个小机器人。使用自带
摄像头,就需要花点功夫去自己编译生成可以用opencv调用自带摄像头的程序了。过程可能有些许复杂。
step 1 : install csi webcam
step 2 : installation and compilation of userland-master (including mmal and raspicam tools)
step 3 : create your own project
step 4 : link with OpenCV libraries
step 5 : basic use of OpenCV and Pi camera : display an image from camera
step 5.5 :use many snapshots to emulate a video (slow)
step 6 : capture video within OpenCV window !
Step 7 : Face recognition (magic mirror release 2 :-)