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.

No comments:

Post a Comment