May 31, 2016

OPENCV RASPBERRY PI2 (JESSIE) 5 -face recognition




This posting is face recognition.

Download opencv-2.3.1



Extract and Copy OpenCV-2.3.1/data/harrcascades to usr/share/opencv/haarcascades

SAMBA is useful



If use Terminal 


permission


Extract and move /usr/share/opencv/haarcascades



Download camcv_vid1.cpp use below link.


Editing cmakelists.txt.

1
sudo nano CMakeLists.txt
cs

changing name camcv.c to camcv_vid1.cpp

Editing camcv_vid1.cpp

1
sudo nano camcv_vid1.cpp
cs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Line 59
----------------------------------------------------------------------------------------------
#include "/home/pi/pierre/libfacerec-0.04/include/facerec.hpp"
=>#include "/home/pi/camcv/libfacerec/include/facerec.hpp"
----------------------------------------------------------------------------------------------
face recognition API
 
Line 681
---------------------------------------------------------------------------------------------------
fn_haar = "/usr/share/opencv/haarcascades/lbpcascade_frontalface.xml";
=>fn_haar = "/usr/share/opencv/lbpcascades/lbpcascade_frontalface.xml"
---------------------------------------------------------------------------------------------------
opencv library
 
Line 764
---------------------------------------------------------------------------------------------------
else if (!raspipreview_create(&state.preview_parameters))
=>else if ( (status = raspipreview_create(&state.preview_parameters)) != MMAL_SUCCESS) 
---------------------------------------------------------------------------------------------------
cs


If difficult edit, download below link.


Download sample face image.


Extract to /home/pi/camcv/others/

1
sudo zip 100x100.zip
cs



csv.txt has face setting information.

Structure is File path and ID

Line 65 in camcv_vid1.cpp

define ID number.

Line 661 
define display name

Many image is hige accuracy but low speed.


Cmake and make

1
2
sudo cmake .
sudo make
cs

If you see below error, Download contrib.hpp




copy to /usr/include/opencv2/contrib/contrib.hpp 



cmake and make.

Run camcv (5500 is accuracy)

1
./camcv others/csv.txt l 5500
cs








If include little sample image, low accuracy.


This is low accuracy value