Opencv 3.1 project on GR-PEACH board
Fork of gr-peach-opencv-project by
Diff: main.cpp
- Revision:
- 169:bdaa9537e072
- Parent:
- 168:3efe7c3d1dd7
diff -r 3efe7c3d1dd7 -r bdaa9537e072 main.cpp --- a/main.cpp Fri Jun 30 11:14:05 2017 +0000 +++ b/main.cpp Tue Jul 04 06:16:34 2017 +0000 @@ -8,6 +8,11 @@ #include "graphicFramework/myImage.h" #include "graphicFramework/mGraphic.hpp" +// Define for store facial xml file +#include "haar_cascade.h" +#include "FATFileSystem.h" +#include "HeapBlockDevice.h" + // Include for opencv #include "cProcess/cProcess.hpp" #include "opencv_3_1/opencv2/core.hpp" @@ -833,7 +838,7 @@ Mat smallImage = Mat::zeros(face_size, CV_8UC1); CascadeClassifier haar_cascade; vector<Rect> faces; - if (!haar_cascade.load("/SD/lbpcascade_frontalface.xml")) + if (!haar_cascade.load(HAAR_CASCADE_FACE_PATH)) { // load failed togle_led(LED_RED); @@ -1042,7 +1047,7 @@ bool isFirstTrain = true; bool changeApp = false; - if (!haar_cascade.load("/SD/lbpcascade_frontalface.xml")) + if (!haar_cascade.load(HAAR_CASCADE_FACE_PATH)) { // load failed togle_led(LED_RED); @@ -1729,19 +1734,42 @@ dcache_clean(user_buf_draw_action_888, sizeof(user_buf_draw_action_888)); } - } +/* Init a block on RAM to store file */ +HeapBlockDevice myBd(2*128 * 512, 512);// ~128 Kb + /****** main image process here******/ int main(void) { + + /* Format block on RAM */ + if(FATFileSystem::format(&myBd)) + { + togle_led(LED_RED); + } + else + { + togle_led(LED_GREEN); + } + FATFileSystem myFs(STORAGE_NAME,&myBd); /* Start the block*/ + + /* Create file .xml*/ + if(arr2File(haar_cascafe_frontal_face,HAAR_FILE_SIZE,HAAR_CASCADE_FACE_PATH)) + { + togle_led(LED_BLUE); + } + else + { + togle_led(LED_RED); + } + /* Init SD card*/ - myStorage = new cStorage(SDCARD_NAME); + /*myStorage = new cStorage(SDCARD_NAME); if( initSdCard() == false) { while(1); - } - togle_reset(LED_RED,LED_BLUE); - + }*/ + /* Initialization of LCD */ Init_LCD_Display(); /* When using LCD, please call before than Init_Video(). */