Showing posts with label 얼굴인식. Show all posts
Showing posts with label 얼굴인식. Show all posts

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



Sep 14, 2015

[ Raspberry Pi2 ] OpenCV using Picam Final



This posting is final.

We will face detect and recognize.


OpenCV Download



Extract file and move folder OpenCV-2.3.1/data/harrcascades to
usr/share/opencv/haarcascades



new camcv file download


Editing cmakelists.txt
  1. sudo nano CMakeLists.txt

remove camcv.c and add camcv_vid1.cpp

Editing camcv_vid1.cpp

  1. sudo nano camcv_vid1.cpp

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



Downloading for test sample image


Copy to /home/pi/camcv/others/


You can see 400's image file and  1 txt file.

open csv.txt 


left ';' is image file name, right is id number.


opencv compare this image file and getting id number.


open camcv_vid1.cpp Line 65

define ID number.

go to Line 661

You can see display name.


build

  1. sudo cmake .
  2. sudo make

If you see below error

copy contrib.hpp file.



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



RUN


1
/camcv others/csv.txt l 5500
cs


Many image file is need long time.



If not display id name, reduce parameter

1
/camcv others/csv.txt l 3000
cs



but, lower the recognition rate.