http://v.eepw.com.cn/video/play/id/14049 我是根据这个来做的,源代码就在github上https://github.com/codelast/raspberry-pi。
1.刷系统以及安装opencv: 我是参照视频教程安装了archlinuxarm。其实系统无所谓,用raspbian的安装opencv请参照http://www.jb51.net/article/63103.html
2.把代码都下载到树莓派里面就可以拍照,录视频了。
3.人脸识别: 进行到人脸识别的时候卡住了。在树莓派与face++服务器通讯时(也就是代码中需要用到rapidjson ),所以就安装咯。根据网上搜索后能快速安装,https://code.google.com/archive/p/rapidjson/wikis/UserGuide.wiki 一开始我是下载了Google code里面的库文件,然后按照
1.2. Installation
Download the released packages or getting the latest source from SVN repository.
rapidjson is a header-only library. That means, the only thing to be done is to copy rapidjson/include/rapidjson
and its sub-directories to your project or other include paths.
#find / -name stdio.h
然后编译
raspberry-pi
/
webcam
/
face-recognition
/
prepare-data
/
get-image-face-ids
/compile-and-run.sh
./compile-and-run.sh
结果出现以下rapidjson问题:
error: no matching function for call to 'rapidjson::GenericDocument<rapidjson::UTF8<> >::Parse(const char*)' if (document.Parse(retData.c_str()).HasParseError()) {
error: ambiguous overload for 'operator[]' (operand types are 'const Value {aka const rapidjson::GenericValue<rapidjson::UTF8<> >}' and 'int') cout << faces[0]["face_id"].GetString() << endl;
上面说到的两个error ,就是rapidjson库文件过旧的问题 。下图google code上的说明。去github上下载新的库文件代码就没问题了END
This repository has been moved tohttps://github.com/miloyip/rapidjson