Sample to operate omron HVC-P2 on GR-PEACH.

Dependencies:   AsciiFont

Information

Please see here for Japanese version.
日本語版はこちらを参照ください。

What is this ?

This is a sample that runs OMRON HVC-P2 with GR-PEACH. In this sample, you can try following among the functions of HVC-P2 : Human Body Detection, Face Detection, Age Estimation, Gender Estimation, Expression Estimation and Face Recognition.
Both GR-PEACH and HVC-P2 use Renesas RZ/A1H included ARM® Cortex™-A9 processor.

/media/uploads/dkato/hvcp2_demo_img3.jpg

HVC-P2 (Human Vision Components B5T-007001) is a human-sensing component that recognizes people. It is an integrated module that is built into other device and provides both the OKAO Vision's ten types of image sensing and a camera module.
For details, please refer to the following link.

In the HVCApi folder of this sample, the code of the following link destination Sample Code "SampleCode_rev.2.0.2" is used. (You can download from "Product Information" -> "Sample Code" in the middle of the following page.)
http://www.omron.com/ecb/products/mobile/hvc_p2/

Constitution

  1. HVC-P2 x 1
  2. USBA-microUSB conversion cable x 2
  3. USBA-microUSB conversion adapter x 1
  4. GR-PEACH x 1
  5. 4.3inc LCD shield x 1

/media/uploads/dkato/composition_hvcp2_demo.jpg

/media/uploads/dkato/composition_hvcp2_demo_2.jpg

Please close JP3 of GR-PEACH.
/media/uploads/RyoheiHagimoto/usb.jpg

How to use

It starts when connecting the power supply USB cable. At startup, all functions are turned off. By pressing the button on the right of the screen you can switch the function on / off.

  • Function ON : orange or green
  • Function OFF : blue or gray

Only the FACE button changes to "FACE (blue) -> FACE (orange) -> RECOGNITION (green)". When FACE (blue), following buttons are gray and can not be operated : AGE, GENDER and EXPRESSION.
"Response time" at the bottom left of the screen indicates "image processing + USB transfer time". It is not pure image processing time.

Register Data (Face Recognition)

Set the FACE button to RECOGNITION (green), and touch the screen with one person on the screen to register the face. In this sample, face registration will record up to 10 people. Delete the old registrant when registering after 11 people. Registration information is stored in the RAM on the HVC-P2 side. It is discarded by power off and reset.

/media/uploads/dkato/hvcp2_demo_img2.jpg

Change parameters

When you press Config icon at the bottom right of the screen, the parameter setting screen is displayed. You can change threshold value, detection size and face angle parameters.

/media/uploads/dkato/hvcp2_demo_config_icon.jpg
/media/uploads/dkato/hvcp2_demo_config.jpg

Change transfer image size

By pressing USER_BUTTON0 on the back of the board, the image transfer size switches in the order of "160 x 120 -> 320 x 240 -> no image".
/media/uploads/dkato/gr-peach_switch2.jpg

Files at this revision

API Documentation at this revision

Comitter:
dkato
Date:
Fri Sep 28 05:16:44 2018 +0000
Parent:
7:85ba09eb46b3
Commit message:
Supports mbed-os-5.10

Changed in this revision

GR-PEACH_video.lib Show diff for this revision Revisions of this file
GraphicsFramework.lib Show diff for this revision Revisions of this file
LCD_shield_config.lib Show diff for this revision Revisions of this file
R_BSP.lib Show diff for this revision Revisions of this file
USBHost_custom.lib Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-gr-libs.lib Show annotated file Show diff for this revision Revisions of this file
mbed-os.lib Show annotated file Show diff for this revision Revisions of this file
mbed_app.json Show annotated file Show diff for this revision Revisions of this file
recognition_proc/recognition_proc.cpp Show annotated file Show diff for this revision Revisions of this file
touch_proc/touch_proc.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 85ba09eb46b3 -r 92c19be0aced GR-PEACH_video.lib
--- a/GR-PEACH_video.lib	Tue Sep 26 09:19:48 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-https://developer.mbed.org/teams/Renesas/code/GR-PEACH_video/#aeefe5171463
diff -r 85ba09eb46b3 -r 92c19be0aced GraphicsFramework.lib
--- a/GraphicsFramework.lib	Tue Sep 26 09:19:48 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-https://developer.mbed.org/teams/Renesas/code/GraphicsFramework/#9bf28e65755e
diff -r 85ba09eb46b3 -r 92c19be0aced LCD_shield_config.lib
--- a/LCD_shield_config.lib	Tue Sep 26 09:19:48 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-https://developer.mbed.org/users/dkato/code/LCD_shield_config/#720a62b44d67
diff -r 85ba09eb46b3 -r 92c19be0aced R_BSP.lib
--- a/R_BSP.lib	Tue Sep 26 09:19:48 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://developer.mbed.org/teams/Renesas/code/R_BSP/#fb9eda52224e
diff -r 85ba09eb46b3 -r 92c19be0aced USBHost_custom.lib
--- a/USBHost_custom.lib	Tue Sep 26 09:19:48 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-https://developer.mbed.org/teams/Renesas/code/USBHost_custom/#22e8f744bbad
diff -r 85ba09eb46b3 -r 92c19be0aced main.cpp
--- a/main.cpp	Tue Sep 26 09:19:48 2017 +0000
+++ b/main.cpp	Fri Sep 28 05:16:44 2018 +0000
@@ -1,14 +1,9 @@
 #include "mbed.h"
-#include "DisplayBace.h"
-#include "rtos.h"
-#include "LCD_shield_config_4_3inch.h"
+#include "EasyAttach_CameraAndLCD.h"
 #include "recognition_proc.h"
 #include "touch_proc.h"
 
 static DisplayBase Display;
-static DigitalOut  lcd_pwon(P7_15);
-static DigitalOut  lcd_blon(P8_1);
-static PwmOut      lcd_cntrst(P8_15);
 static Thread      recognitionTask(osPriorityNormal, 1024 * 8);
 static Thread      touchTask;
 
@@ -18,42 +13,13 @@
     touch_lcd_int(int_type);
 }
 
-static void Init_LCD_Display(void) {
-    DisplayBase::graphics_error_t error;
-    DisplayBase::lcd_config_t lcd_config;
-    PinName lvds_pin[8] = {
-        /* data pin */
-        P5_7, P5_6, P5_5, P5_4, P5_3, P5_2, P5_1, P5_0
-    };
-
-    lcd_pwon = 0;
-    lcd_blon = 0;
-    Thread::wait(100);
-    lcd_pwon = 1;
-    lcd_blon = 1;
-
-    Display.Graphics_Lvds_Port_Init(lvds_pin, 8);
-
-    /* Graphics initialization process */
-    lcd_config = LcdCfgTbl_LCD_shield;
-    error = Display.Graphics_init(&lcd_config);
-    if (error != DisplayBase::GRAPHICS_OK) {
-        printf("Line %d, error %d\n", __LINE__, error);
-        mbed_die();
-    }
-
-    /* Interrupt callback function setting (Vsync signal output from scaler 0) */
-    error = Display.Graphics_Irq_Handler_Set(DisplayBase::INT_TYPE_S0_LO_VSYNC, 0, IntCallbackFunc_LoVsync);
-    if (error != DisplayBase::GRAPHICS_OK) {
-        printf("Line %d, error %d\n", __LINE__, error);
-        mbed_die();
-    }
-}
-
 /****** main ******/
 int main(void) {
     /* Initialization of LCD */
-    Init_LCD_Display();
+    EasyAttach_Init(Display);
+
+    /* Interrupt callback function setting (Vsync signal output from scaler 0) */
+    Display.Graphics_Irq_Handler_Set(DisplayBase::INT_TYPE_S0_LO_VSYNC, 0, IntCallbackFunc_LoVsync);
 
     /* Start recognition processing */
     recognitionTask.start(callback(recognition_task, &Display));
@@ -62,8 +28,8 @@
     touchTask.start(callback(touch_task, &Display));
 
     /* Backlight on */
-    Thread::wait(200);
-    lcd_cntrst.write(1.0);
+    ThisThread::sleep_for(200);
+    EasyAttach_LcdBacklight(true);
 
     /* Wait for the threads to finish */
     recognitionTask.join();
diff -r 85ba09eb46b3 -r 92c19be0aced mbed-gr-libs.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-gr-libs.lib	Fri Sep 28 05:16:44 2018 +0000
@@ -0,0 +1,1 @@
+https://github.com/d-kato/mbed-gr-libs/#85550d80acf1b102d58cbf7635c27bc5ebff08f0
diff -r 85ba09eb46b3 -r 92c19be0aced mbed-os.lib
--- a/mbed-os.lib	Tue Sep 26 09:19:48 2017 +0000
+++ b/mbed-os.lib	Fri Sep 28 05:16:44 2018 +0000
@@ -1,1 +1,1 @@
-https://github.com/ARMmbed/mbed-os/#5faf4b26c5954d15c7c1cccac6498e0c690ad101
+https://github.com/ARMmbed/mbed-os/#835fabe557aabc3f8ec5d3fc1163fec757fbbe48
diff -r 85ba09eb46b3 -r 92c19be0aced mbed_app.json
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed_app.json	Fri Sep 28 05:16:44 2018 +0000
@@ -0,0 +1,13 @@
+{
+    "config": {
+        "camera":{
+            "help": "0:disable 1:enable",
+            "value": "0"
+        },
+        "lcd":{
+            "help": "0:disable 1:enable",
+            "value": "1"
+        }
+    }
+}
+
diff -r 85ba09eb46b3 -r 92c19be0aced recognition_proc/recognition_proc.cpp
--- a/recognition_proc/recognition_proc.cpp	Tue Sep 26 09:19:48 2017 +0000
+++ b/recognition_proc/recognition_proc.cpp	Fri Sep 28 05:16:44 2018 +0000
@@ -1,9 +1,7 @@
 #include "mbed.h"
-#include "DisplayBace.h"
-#include "rtos.h"
+#include "EasyAttach_CameraAndLCD.h"
 #include "AsciiFont.h"
 #include "USBHostSerial.h"
-#include "LCD_shield_config_4_3inch.h"
 #include "recognition_proc.h"
 #include "STBWrap.h"
 
@@ -324,7 +322,7 @@
     while (1) {
         /* try to connect a serial device */
         while (!serial.connect()) {
-            Thread::wait(500);
+            ThisThread::sleep_for(500);
         }
         serial.baud(921600);
         setting_req = true;
@@ -417,13 +415,13 @@
                         wk_width = (AsciiFont::CHAR_PIX_WIDTH * strlen(Str_disp)) + 2;
                         ascii_font.Erase(0x00000090, (DISP_PIXEL_WIDTH - wk_width) / 2, 153, wk_width, (AsciiFont::CHAR_PIX_HEIGHT + 2));
                         ascii_font.DrawStr(Str_disp, (DISP_PIXEL_WIDTH - wk_width) / 2 + 1, 154, 0x0000ffff, 1);
-                        Thread::wait(1200);
+                        ThisThread::sleep_for(1200);
                     } else {
                         if (status == 0x02) {
                             wk_width = (AsciiFont::CHAR_PIX_WIDTH * (sizeof(ERROR_02) - 1)) + 4;
                             ascii_font.Erase(0x00000090, (DISP_PIXEL_WIDTH - wk_width) / 2, 120, wk_width, (AsciiFont::CHAR_PIX_HEIGHT + 3));
                             ascii_font.DrawStr(ERROR_02, (DISP_PIXEL_WIDTH - wk_width) / 2 + 2, 121, 0x0000ffff, 1);
-                            Thread::wait(1500);
+                            ThisThread::sleep_for(1500);
                         }
                     }
                     registrationr_req = false;
diff -r 85ba09eb46b3 -r 92c19be0aced touch_proc/touch_proc.cpp
--- a/touch_proc/touch_proc.cpp	Tue Sep 26 09:19:48 2017 +0000
+++ b/touch_proc/touch_proc.cpp	Fri Sep 28 05:16:44 2018 +0000
@@ -1,7 +1,5 @@
 #include "mbed.h"
-#include "DisplayBace.h"
-#include "rtos.h"
-#include "LCD_shield_config_4_3inch.h"
+#include "EasyAttach_CameraAndLCD.h"
 #include "RGA.h"
 #include "BinaryImage_RZ_A1H.h"
 #include "recognition_proc.h"
@@ -377,7 +375,7 @@
 
 static void draw_touch_layer(DisplayBase * p_display, frame_buffer_t * frmbuf_info, Canvas2D_ContextClass * p_canvas2d) {
     while (vsync_count > 0) {
-        Thread::wait(1);
+        ThisThread::sleep_for(1);
     }
 
     /* Swap the frame buffer */