[RBP]RaspberryPi系列之二:RBP+OpenCV-FaceRecognition

1. 前言

之所以选RBP而不是Beaglebone Black主要原因就是看到有针对RBP的很详细的教程,比如

Facial recognition: OpenCV on the camera board 和

a seven-part tutorial 

2. 一点背景知识

2.1 rpi-update

在一个教程上偶遇这个软件,其实就是更新firmware的。另外这里解释的非常清楚:

  • rpi-update is a tool to upgrade the firmware for your Raspberry Pi. Firmware is a small package of code that usually lives on a special chip of a computer that helps the software know how to talk to the hardware. However, in the case of the Raspberry Pi, the firmware will live on thefirst partition of the SD card.

  • Raspbian is an operating system or the core software for your Raspberry Pi. Software (including the OS) lives on second partition of the SD card and is all the stuff that gets executed when you use your device.


2.2 Camera Serial Interface (CSI)

看到a seven-part tutorial 把Pi camera叫csi webcam, 才知道现今大多数手机/tablets上都用的是这种camera

Camera Interface Specifications

Camera Serial Interface MIPI IP Solutions

Camera Serial Interface (CSI-2) sensors in embedded designs

 The majority of cameras in high volume consumer products, such as smartphones and tablets, use MIPI (Mobile Industry Processor Interface)-based sensors. The most commonly used interface for this type of image sensor is the CSI-2 specification (Camera Serial Interface). 


3. 安装

仔细看了下那个教程,才发现还是用的OpenCV2.3。因为没有facerec的API, 还要去安装libfacerec---从2.4起已经彻底移植进OpenCV了。

马上看看RBP的repository---赫然依然竟然还是2.3!!!

2.4肯定是有人装过了的,很容易就google到,

Raspberry Pi Rasbian + OpenCV

不过,开门见山就当头棒喝,

building OpenCV on Raspbian (Raspberry Pi) will take at least 4 hours

应该还不算之前几十个dependency的时间---我还是待续吧。。。


(Continued)

3.1 Dependencies

根据上面的文章,先要装一大堆dependency。

有问题的包:

sudo apt-get -y install libpnglite-dev libpngwriter0-dev libpngwriter0c2
E: Unable to locate package libpngwriter0-dev
E: Unable to locate package libpngwriter0c2


sudo apt-get -y install libjpeg8 libjpeg8-dev libjpeg8-dbg libjpeg-prog

E: Unable to locate package libjpeg-prog

但是下面又装了一遍就好了!(?)

sudo apt-get -y install libjpeg-progs libjpeg-dev

libjpeg-dev就是libjpeg8-dev的virtual package,

Unpacking libjpeg-progs (from .../libjpeg-progs_8d-1_armhf.deb) ...

Unpacking libjpeg8-dbg (from .../libjpeg8-dbg_8d-1_armhf.deb) ...

晕死~~~上面的libjpeg-prog最后少了个s !!!


3.2 OpenCV 2.4.6.1

接下来三个包要手动安装,不过看到都比较老了,有点犹豫。最后虽然下载了下来,还是决定先用repository里自带的。

一则OpenCV最新的版本也许有些更新,二则就算不行从repository里删除也很容易,不像手动安装的可能比较麻烦---虽然其实也就是删除文件就好了


cmake找不到linux/videodev.h的问题也没有管,实际上在UbuntuPC上和网上随手找到的文章看,到处都是

-- Looking for linux/videodev.h
-- Looking for linux/videodev.h - not found
-- Looking for linux/videodev2.h
-- Looking for linux/videodev2.h - found
-- Looking for sys/videoio.h
-- Looking for sys/videoio.h - not found

先这样编,有问题再说吧


3.3 screen

最后是这个GNU screen工具,真是好用!最近半年做了很多remote ssh的事情,早知道这个工具可以省很多事情!

Using Linux Screen for Session Management

基本上,每次运行screen就新开一个session。而每个session里又可以开多个windows。同时可以detatch/re-attach回任意session


3.4 (X)小时后。。。

网上有说4个小时,有说6,7个小时,我先去睡了。。。。




你可能感兴趣的:([RBP]RaspberryPi系列之二:RBP+OpenCV-FaceRecognition)