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

Committer:
dkato
Date:
Wed Mar 08 07:43:42 2017 +0000
Revision:
3:0760680f06d8
Parent:
0:f5de229c9a00
Fixed buffer size of character string .

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dkato 0:f5de229c9a00 1 /*---------------------------------------------------------------------------*/
dkato 0:f5de229c9a00 2 /* Copyright(C) 2017 OMRON Corporation */
dkato 0:f5de229c9a00 3 /* */
dkato 0:f5de229c9a00 4 /* Licensed under the Apache License, Version 2.0 (the "License"); */
dkato 0:f5de229c9a00 5 /* you may not use this file except in compliance with the License. */
dkato 0:f5de229c9a00 6 /* You may obtain a copy of the License at */
dkato 0:f5de229c9a00 7 /* */
dkato 0:f5de229c9a00 8 /* http://www.apache.org/licenses/LICENSE-2.0 */
dkato 0:f5de229c9a00 9 /* */
dkato 0:f5de229c9a00 10 /* Unless required by applicable law or agreed to in writing, software */
dkato 0:f5de229c9a00 11 /* distributed under the License is distributed on an "AS IS" BASIS, */
dkato 0:f5de229c9a00 12 /* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
dkato 0:f5de229c9a00 13 /* See the License for the specific language governing permissions and */
dkato 0:f5de229c9a00 14 /* limitations under the License. */
dkato 0:f5de229c9a00 15 /*---------------------------------------------------------------------------*/
dkato 0:f5de229c9a00 16
dkato 0:f5de229c9a00 17 #ifndef HVCDef_H__
dkato 0:f5de229c9a00 18 #define HVCDef_H__
dkato 0:f5de229c9a00 19
dkato 0:f5de229c9a00 20 /*----------------------------------------------------------------------------*/
dkato 0:f5de229c9a00 21 /* Execution flag */
dkato 0:f5de229c9a00 22 #define HVC_ACTIV_BODY_DETECTION 0x00000001
dkato 0:f5de229c9a00 23 #define HVC_ACTIV_HAND_DETECTION 0x00000002
dkato 0:f5de229c9a00 24 #define HVC_ACTIV_FACE_DETECTION 0x00000004
dkato 0:f5de229c9a00 25 #define HVC_ACTIV_FACE_DIRECTION 0x00000008
dkato 0:f5de229c9a00 26 #define HVC_ACTIV_AGE_ESTIMATION 0x00000010
dkato 0:f5de229c9a00 27 #define HVC_ACTIV_GENDER_ESTIMATION 0x00000020
dkato 0:f5de229c9a00 28 #define HVC_ACTIV_GAZE_ESTIMATION 0x00000040
dkato 0:f5de229c9a00 29 #define HVC_ACTIV_BLINK_ESTIMATION 0x00000080
dkato 0:f5de229c9a00 30 #define HVC_ACTIV_EXPRESSION_ESTIMATION 0x00000100
dkato 0:f5de229c9a00 31 #define HVC_ACTIV_FACE_RECOGNITION 0x00000200
dkato 0:f5de229c9a00 32
dkato 0:f5de229c9a00 33 /* Image info of Execute command */
dkato 0:f5de229c9a00 34 #define HVC_EXECUTE_IMAGE_NONE 0x00000000
dkato 0:f5de229c9a00 35 #define HVC_EXECUTE_IMAGE_QVGA 0x00000001
dkato 0:f5de229c9a00 36 #define HVC_EXECUTE_IMAGE_QVGA_HALF 0x00000002
dkato 0:f5de229c9a00 37
dkato 0:f5de229c9a00 38 /*----------------------------------------------------------------------------*/
dkato 0:f5de229c9a00 39 /* Error code */
dkato 0:f5de229c9a00 40
dkato 0:f5de229c9a00 41 /* Parameter error */
dkato 0:f5de229c9a00 42 #define HVC_ERROR_PARAMETER -1
dkato 0:f5de229c9a00 43
dkato 0:f5de229c9a00 44 /* Send signal timeout error */
dkato 0:f5de229c9a00 45 #define HVC_ERROR_SEND_DATA -10
dkato 0:f5de229c9a00 46
dkato 0:f5de229c9a00 47 /* Receive header signal timeout error */
dkato 0:f5de229c9a00 48 #define HVC_ERROR_HEADER_TIMEOUT -20
dkato 0:f5de229c9a00 49 /* Invalid header error */
dkato 0:f5de229c9a00 50 #define HVC_ERROR_HEADER_INVALID -21
dkato 0:f5de229c9a00 51 /* Receive data signal timeout error */
dkato 0:f5de229c9a00 52 #define HVC_ERROR_DATA_TIMEOUT -22
dkato 0:f5de229c9a00 53
dkato 0:f5de229c9a00 54
dkato 0:f5de229c9a00 55 /*----------------------------------------------------------------------------*/
dkato 0:f5de229c9a00 56 /* Album data size */
dkato 0:f5de229c9a00 57 #define HVC_ALBUM_SIZE_MIN 32
dkato 0:f5de229c9a00 58 #define HVC_ALBUM_SIZE_MAX 816032
dkato 0:f5de229c9a00 59
dkato 0:f5de229c9a00 60 /*----------------------------------------------------------------------------*/
dkato 0:f5de229c9a00 61 /* Expression */
dkato 0:f5de229c9a00 62 typedef enum {
dkato 0:f5de229c9a00 63 EX_NEUTRAL = 1,
dkato 0:f5de229c9a00 64 EX_HAPPINESS,
dkato 0:f5de229c9a00 65 EX_SURPRISE,
dkato 0:f5de229c9a00 66 EX_ANGER,
dkato 0:f5de229c9a00 67 EX_SADNESS
dkato 0:f5de229c9a00 68 }EXPRESSION;
dkato 0:f5de229c9a00 69
dkato 0:f5de229c9a00 70 /*----------------------------------------------------------------------------*/
dkato 0:f5de229c9a00 71 /* Struct */
dkato 0:f5de229c9a00 72 /*----------------------------------------------------------------------------*/
dkato 0:f5de229c9a00 73 /*----------------------------------------------------------------------------*/
dkato 0:f5de229c9a00 74 /* Devicefs model and version info */
dkato 0:f5de229c9a00 75 /*----------------------------------------------------------------------------*/
dkato 0:f5de229c9a00 76 typedef struct {
dkato 0:f5de229c9a00 77 UINT8 string[12];
dkato 0:f5de229c9a00 78 UINT8 major;
dkato 0:f5de229c9a00 79 UINT8 minor;
dkato 0:f5de229c9a00 80 UINT8 relese;
dkato 0:f5de229c9a00 81 UINT8 revision[4];
dkato 0:f5de229c9a00 82 }HVC_VERSION;
dkato 0:f5de229c9a00 83
dkato 0:f5de229c9a00 84 /*----------------------------------------------------------------------------*/
dkato 0:f5de229c9a00 85 /* Detection result */
dkato 0:f5de229c9a00 86 /*----------------------------------------------------------------------------*/
dkato 0:f5de229c9a00 87 typedef struct{
dkato 0:f5de229c9a00 88 INT32 posX; /* Center x-coordinate */
dkato 0:f5de229c9a00 89 INT32 posY; /* Center y-coordinate */
dkato 0:f5de229c9a00 90 INT32 size; /* Size */
dkato 0:f5de229c9a00 91 INT32 confidence; /* Degree of confidence */
dkato 0:f5de229c9a00 92 }DETECT_RESULT;
dkato 0:f5de229c9a00 93
dkato 0:f5de229c9a00 94 /*----------------------------------------------------------------------------*/
dkato 0:f5de229c9a00 95 /* Face direction */
dkato 0:f5de229c9a00 96 /*----------------------------------------------------------------------------*/
dkato 0:f5de229c9a00 97 typedef struct{
dkato 0:f5de229c9a00 98 INT32 yaw; /* Yaw angle */
dkato 0:f5de229c9a00 99 INT32 pitch; /* Pitch angle */
dkato 0:f5de229c9a00 100 INT32 roll; /* Roll angle */
dkato 0:f5de229c9a00 101 INT32 confidence; /* Degree of confidence */
dkato 0:f5de229c9a00 102 }DIR_RESULT;
dkato 0:f5de229c9a00 103
dkato 0:f5de229c9a00 104 /*----------------------------------------------------------------------------*/
dkato 0:f5de229c9a00 105 /* Age */
dkato 0:f5de229c9a00 106 /*----------------------------------------------------------------------------*/
dkato 0:f5de229c9a00 107 typedef struct{
dkato 0:f5de229c9a00 108 INT32 age; /* Age */
dkato 0:f5de229c9a00 109 INT32 confidence; /* Degree of confidence */
dkato 0:f5de229c9a00 110 }AGE_RESULT;
dkato 0:f5de229c9a00 111
dkato 0:f5de229c9a00 112 /*----------------------------------------------------------------------------*/
dkato 0:f5de229c9a00 113 /* Gender */
dkato 0:f5de229c9a00 114 /*----------------------------------------------------------------------------*/
dkato 0:f5de229c9a00 115 typedef struct{
dkato 0:f5de229c9a00 116 INT32 gender; /* Gender */
dkato 0:f5de229c9a00 117 INT32 confidence; /* Degree of confidence */
dkato 0:f5de229c9a00 118 }GENDER_RESULT;
dkato 0:f5de229c9a00 119
dkato 0:f5de229c9a00 120 /*----------------------------------------------------------------------------*/
dkato 0:f5de229c9a00 121 /* Gaze */
dkato 0:f5de229c9a00 122 /*----------------------------------------------------------------------------*/
dkato 0:f5de229c9a00 123 typedef struct{
dkato 0:f5de229c9a00 124 INT32 gazeLR; /* Yaw angle */
dkato 0:f5de229c9a00 125 INT32 gazeUD; /* Pitch angle */
dkato 0:f5de229c9a00 126 }GAZE_RESULT;
dkato 0:f5de229c9a00 127
dkato 0:f5de229c9a00 128 /*----------------------------------------------------------------------------*/
dkato 0:f5de229c9a00 129 /* Blink */
dkato 0:f5de229c9a00 130 /*----------------------------------------------------------------------------*/
dkato 0:f5de229c9a00 131 typedef struct{
dkato 0:f5de229c9a00 132 INT32 ratioL; /* Left eye blink result */
dkato 0:f5de229c9a00 133 INT32 ratioR; /* Right eye blink result */
dkato 0:f5de229c9a00 134 }BLINK_RESULT;
dkato 0:f5de229c9a00 135
dkato 0:f5de229c9a00 136 /*----------------------------------------------------------------------------*/
dkato 0:f5de229c9a00 137 /* Expression */
dkato 0:f5de229c9a00 138 /*----------------------------------------------------------------------------*/
dkato 0:f5de229c9a00 139 typedef struct{
dkato 0:f5de229c9a00 140 INT32 topExpression; /* Top expression */
dkato 0:f5de229c9a00 141 INT32 topScore; /* Top score */
dkato 0:f5de229c9a00 142 INT32 score[5]; /* Score of 5 expression */
dkato 0:f5de229c9a00 143 INT32 degree; /* Negative-positive degree */
dkato 0:f5de229c9a00 144 }EXPRESSION_RESULT;
dkato 0:f5de229c9a00 145
dkato 0:f5de229c9a00 146 /*----------------------------------------------------------------------------*/
dkato 0:f5de229c9a00 147 /* Face Recognition */
dkato 0:f5de229c9a00 148 /*----------------------------------------------------------------------------*/
dkato 0:f5de229c9a00 149 typedef struct{
dkato 0:f5de229c9a00 150 INT32 uid; /* User ID */
dkato 0:f5de229c9a00 151 INT32 confidence; /* Degree of confidence */
dkato 0:f5de229c9a00 152 }RECOGNITION_RESULT;
dkato 0:f5de229c9a00 153
dkato 0:f5de229c9a00 154 /*----------------------------------------------------------------------------*/
dkato 0:f5de229c9a00 155 /* Face Detection & Estimations result */
dkato 0:f5de229c9a00 156 /*----------------------------------------------------------------------------*/
dkato 0:f5de229c9a00 157 typedef struct{
dkato 0:f5de229c9a00 158 DETECT_RESULT dtResult; /* Face detection result */
dkato 0:f5de229c9a00 159 DIR_RESULT dirResult; /* Face direction estimation result */
dkato 0:f5de229c9a00 160 AGE_RESULT ageResult; /* Age Estimation result */
dkato 0:f5de229c9a00 161 GENDER_RESULT genderResult; /* Gender Estimation result */
dkato 0:f5de229c9a00 162 GAZE_RESULT gazeResult; /* Gaze Estimation result */
dkato 0:f5de229c9a00 163 BLINK_RESULT blinkResult; /* Blink Estimation result */
dkato 0:f5de229c9a00 164 EXPRESSION_RESULT expressionResult; /* Expression Estimation result */
dkato 0:f5de229c9a00 165 RECOGNITION_RESULT recognitionResult; /* Face Recognition result */
dkato 0:f5de229c9a00 166 }FACE_RESULT;
dkato 0:f5de229c9a00 167
dkato 0:f5de229c9a00 168 /*----------------------------------------------------------------------------*/
dkato 0:f5de229c9a00 169 /* Human Body Detection results */
dkato 0:f5de229c9a00 170 /*----------------------------------------------------------------------------*/
dkato 0:f5de229c9a00 171 typedef struct{
dkato 0:f5de229c9a00 172 UINT8 num; /* Number of Detection */
dkato 0:f5de229c9a00 173 DETECT_RESULT bdResult[35]; /* Detection result */
dkato 0:f5de229c9a00 174 }BD_RESULT;
dkato 0:f5de229c9a00 175
dkato 0:f5de229c9a00 176 /*----------------------------------------------------------------------------*/
dkato 0:f5de229c9a00 177 /* Hand Detection results */
dkato 0:f5de229c9a00 178 /*----------------------------------------------------------------------------*/
dkato 0:f5de229c9a00 179 typedef struct{
dkato 0:f5de229c9a00 180 UINT8 num; /* Number of Detection */
dkato 0:f5de229c9a00 181 DETECT_RESULT hdResult[35]; /* Detection result */
dkato 0:f5de229c9a00 182 }HD_RESULT;
dkato 0:f5de229c9a00 183
dkato 0:f5de229c9a00 184 /*----------------------------------------------------------------------------*/
dkato 0:f5de229c9a00 185 /* Face Detection & Estimations results */
dkato 0:f5de229c9a00 186 /*----------------------------------------------------------------------------*/
dkato 0:f5de229c9a00 187 typedef struct{
dkato 0:f5de229c9a00 188 UINT8 num; /* Number of Detection */
dkato 0:f5de229c9a00 189 FACE_RESULT fcResult[35]; /* Detection & Estimations result */
dkato 0:f5de229c9a00 190 }FD_RESULT;
dkato 0:f5de229c9a00 191
dkato 0:f5de229c9a00 192 /*----------------------------------------------------------------------------*/
dkato 0:f5de229c9a00 193 /* Image data */
dkato 0:f5de229c9a00 194 /*----------------------------------------------------------------------------*/
dkato 0:f5de229c9a00 195 typedef struct{
dkato 0:f5de229c9a00 196 INT32 width;
dkato 0:f5de229c9a00 197 INT32 height;
dkato 0:f5de229c9a00 198 UINT8 image[320*240];
dkato 0:f5de229c9a00 199 }HVC_IMAGE;
dkato 0:f5de229c9a00 200
dkato 0:f5de229c9a00 201 /*----------------------------------------------------------------------------*/
dkato 0:f5de229c9a00 202 /* Eesult data of Execute command */
dkato 0:f5de229c9a00 203 /*----------------------------------------------------------------------------*/
dkato 0:f5de229c9a00 204 typedef struct{
dkato 0:f5de229c9a00 205 INT32 executedFunc; /* Execution flag */
dkato 0:f5de229c9a00 206 BD_RESULT bdResult; /* Human Body Detection results */
dkato 0:f5de229c9a00 207 HD_RESULT hdResult; /* Hand Detection results */
dkato 0:f5de229c9a00 208 FD_RESULT fdResult; /* Face Detection & Estimations results */
dkato 0:f5de229c9a00 209 HVC_IMAGE image; /* Image data */
dkato 0:f5de229c9a00 210 }HVC_RESULT;
dkato 0:f5de229c9a00 211
dkato 0:f5de229c9a00 212 /*----------------------------------------------------------------------------*/
dkato 0:f5de229c9a00 213 /* Threshold of confidence */
dkato 0:f5de229c9a00 214 /*----------------------------------------------------------------------------*/
dkato 0:f5de229c9a00 215 typedef struct{
dkato 0:f5de229c9a00 216 INT32 bdThreshold; /* Threshold of confidence of Human Body Detection */
dkato 0:f5de229c9a00 217 INT32 hdThreshold; /* Threshold of confidence of Hand Detection */
dkato 0:f5de229c9a00 218 INT32 dtThreshold; /* Threshold of confidence of Face Detection */
dkato 0:f5de229c9a00 219 INT32 rsThreshold; /* Threshold of confidence of Face Recognition */
dkato 0:f5de229c9a00 220 }HVC_THRESHOLD;
dkato 0:f5de229c9a00 221
dkato 0:f5de229c9a00 222 /*----------------------------------------------------------------------------*/
dkato 0:f5de229c9a00 223 /* Detection size */
dkato 0:f5de229c9a00 224 /*----------------------------------------------------------------------------*/
dkato 0:f5de229c9a00 225 typedef struct{
dkato 0:f5de229c9a00 226 INT32 bdMinSize; /* Minimum detection size of Human Body Detection */
dkato 0:f5de229c9a00 227 INT32 bdMaxSize; /* Maximum detection size of Human Body Detection */
dkato 0:f5de229c9a00 228 INT32 hdMinSize; /* Minimum detection size of Hand Detection */
dkato 0:f5de229c9a00 229 INT32 hdMaxSize; /* Maximum detection size of Hand Detection */
dkato 0:f5de229c9a00 230 INT32 dtMinSize; /* Minimum detection size of Face Detection */
dkato 0:f5de229c9a00 231 INT32 dtMaxSize; /* Maximum detection size of Face Detection */
dkato 0:f5de229c9a00 232 }HVC_SIZERANGE;
dkato 0:f5de229c9a00 233
dkato 0:f5de229c9a00 234 #endif /* HVCDef_H__ */