Sample to operate omron HVC-P2 on GR-PEACH.
Dependencies: AsciiFont
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.
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.
- SENSING EGG PROJECT > HVC-P2 (In Japanese)
https://plus-sensing.omron.co.jp/egg-project/product/hvc-p2/ - HVC-P2 (Human Vision Components B5T-007001)
http://www.omron.com/ecb/products/mobile/hvc_p2/ - OKAO Vision
https://plus-sensing.omron.com/technology/index.html
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
- HVC-P2 x 1
- USBA-microUSB conversion cable x 2
- USBA-microUSB conversion adapter x 1
- GR-PEACH x 1
- 4.3inc LCD shield x 1
Please close JP3 of GR-PEACH.
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.
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.
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".
Revision 5:49a61433290a, committed 2017-09-05
- Comitter:
- dkato
- Date:
- Tue Sep 05 10:01:51 2017 +0000
- Parent:
- 4:55e0d1f4e55a
- Child:
- 6:8c0c70710090
- Commit message:
- Add HVC sensing result stabilizing library
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HVC/HVCApi/HVCApi.c Tue Sep 05 10:01:51 2017 +0000
@@ -0,0 +1,1297 @@
+/*---------------------------------------------------------------------------*/
+/* Copyright(C) 2017 OMRON Corporation */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
+/* See the License for the specific language governing permissions and */
+/* limitations under the License. */
+/*---------------------------------------------------------------------------*/
+
+/*
+ HVC Sample API
+*/
+
+#include <stdlib.h>
+#include "HVCApi.h"
+#include "HVCExtraUartFunc.h"
+
+/*----------------------------------------------------------------------------*/
+/* Command number */
+/*----------------------------------------------------------------------------*/
+#define HVC_COM_GET_VERSION (UINT8)0x00
+#define HVC_COM_SET_CAMERA_ANGLE (UINT8)0x01
+#define HVC_COM_GET_CAMERA_ANGLE (UINT8)0x02
+#define HVC_COM_EXECUTE (UINT8)0x03
+#define HVC_COM_EXECUTEEX (UINT8)0x04
+#define HVC_COM_SET_THRESHOLD (UINT8)0x05
+#define HVC_COM_GET_THRESHOLD (UINT8)0x06
+#define HVC_COM_SET_SIZE_RANGE (UINT8)0x07
+#define HVC_COM_GET_SIZE_RANGE (UINT8)0x08
+#define HVC_COM_SET_DETECTION_ANGLE (UINT8)0x09
+#define HVC_COM_GET_DETECTION_ANGLE (UINT8)0x0A
+#define HVC_COM_SET_BAUDRATE (UINT8)0x0E
+#define HVC_COM_REGISTRATION (UINT8)0x10
+#define HVC_COM_DELETE_DATA (UINT8)0x11
+#define HVC_COM_DELETE_USER (UINT8)0x12
+#define HVC_COM_DELETE_ALL (UINT8)0x13
+#define HVC_COM_GET_PERSON_DATA (UINT8)0x15
+#define HVC_COM_SAVE_ALBUM (UINT8)0x20
+#define HVC_COM_LOAD_ALBUM (UINT8)0x21
+#define HVC_COM_WRITE_ALBUM (UINT8)0x22
+
+/*----------------------------------------------------------------------------*/
+/* Header for send signal data */
+typedef enum {
+ SEND_HEAD_SYNCBYTE = 0,
+ SEND_HEAD_COMMANDNO,
+ SEND_HEAD_DATALENGTHLSB,
+ SEND_HEAD_DATALENGTHMSB,
+ SEND_HEAD_NUM
+}SEND_HEADER;
+/*----------------------------------------------------------------------------*/
+/* Header for receive signal data */
+typedef enum {
+ RECEIVE_HEAD_SYNCBYTE = 0,
+ RECEIVE_HEAD_STATUS,
+ RECEIVE_HEAD_DATALENLL,
+ RECEIVE_HEAD_DATALENLM,
+ RECEIVE_HEAD_DATALENML,
+ RECEIVE_HEAD_DATALENMM,
+ RECEIVE_HEAD_NUM
+}RECEIVE_HEADER;
+
+/*----------------------------------------------------------------------------*/
+/* Send command signal */
+/* param : UINT8 inCommandNo command number */
+/* : INT32 inDataSize sending signal data size */
+/* : UINT8 *inData sending signal data */
+/* return : INT32 execution result error code */
+/* : 0...normal */
+/* : -10...timeout error */
+/*----------------------------------------------------------------------------*/
+static INT32 HVC_SendCommand(UINT8 inCommandNo, INT32 inDataSize, UINT8 *inData)
+{
+ INT32 i;
+ INT32 ret = 0;
+ UINT8 sendData[32];
+
+ /* Create header */
+ sendData[SEND_HEAD_SYNCBYTE] = (UINT8)0xFE;
+ sendData[SEND_HEAD_COMMANDNO] = (UINT8)inCommandNo;
+ sendData[SEND_HEAD_DATALENGTHLSB] = (UINT8)(inDataSize&0xff);
+ sendData[SEND_HEAD_DATALENGTHMSB] = (UINT8)((inDataSize>>8)&0xff);
+
+ for(i = 0; i < inDataSize; i++){
+ sendData[SEND_HEAD_NUM + i] = inData[i];
+ }
+
+ /* Send command signal */
+ ret = UART_SendData(SEND_HEAD_NUM+inDataSize, sendData);
+ if(ret != SEND_HEAD_NUM+inDataSize){
+ return HVC_ERROR_SEND_DATA;
+ }
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/* Send command signal of LoadAlbum */
+/* param : UINT8 inCommandNo command number */
+/* : INT32 inDataSize sending signal data size */
+/* : UINT8 *inData sending signal data */
+/* return : INT32 execution result error code */
+/* : 0...normal */
+/* : -10...timeout error */
+/*----------------------------------------------------------------------------*/
+static INT32 HVC_SendCommandOfLoadAlbum(UINT8 inCommandNo, INT32 inDataSize, UINT8 *inData)
+{
+ INT32 i;
+ INT32 ret = 0;
+ UINT8 *pSendData = NULL;
+
+ pSendData = (UINT8*)malloc(SEND_HEAD_NUM + 4 + inDataSize);
+
+ /* Create header */
+ pSendData[SEND_HEAD_SYNCBYTE] = (UINT8)0xFE;
+ pSendData[SEND_HEAD_COMMANDNO] = (UINT8)inCommandNo;
+ pSendData[SEND_HEAD_DATALENGTHLSB] = (UINT8)4;
+ pSendData[SEND_HEAD_DATALENGTHMSB] = (UINT8)0;
+
+ pSendData[SEND_HEAD_NUM + 0] = (UINT8)(inDataSize & 0x000000ff);
+ pSendData[SEND_HEAD_NUM + 1] = (UINT8)((inDataSize >> 8) & 0x000000ff);
+ pSendData[SEND_HEAD_NUM + 2] = (UINT8)((inDataSize >> 16) & 0x000000ff);
+ pSendData[SEND_HEAD_NUM + 3] = (UINT8)((inDataSize >> 24) & 0x000000ff);
+
+ for(i = 0; i < inDataSize; i++){
+ pSendData[SEND_HEAD_NUM + 4 + i] = inData[i];
+ }
+
+ /* Send command signal */
+ ret = UART_SendData(SEND_HEAD_NUM+4+inDataSize, pSendData);
+ if(ret != SEND_HEAD_NUM + 4 + inDataSize){
+ ret = HVC_ERROR_SEND_DATA;
+ }
+ else{
+ ret = 0;
+ }
+ free(pSendData);
+
+ return ret;
+}
+
+/*----------------------------------------------------------------------------*/
+/* Receive header */
+/* param : INT32 inTimeOutTime timeout time */
+/* : INT32 *outDataSize receive signal data length */
+/* : UINT8 *outStatus status */
+/* return : INT32 execution result error code */
+/* : 0...normal */
+/* : -20...timeout error */
+/* : -21...invalid header error */
+/*----------------------------------------------------------------------------*/
+static INT32 HVC_ReceiveHeader(INT32 inTimeOutTime, INT32 *outDataSize, UINT8 *outStatus)
+{
+ INT32 ret = 0;
+ UINT8 headerData[32];
+
+ /* Get header part */
+ ret = UART_ReceiveData(inTimeOutTime, RECEIVE_HEAD_NUM, headerData);
+ if(ret != RECEIVE_HEAD_NUM){
+ return HVC_ERROR_HEADER_TIMEOUT;
+ }
+ else if((UINT8)0xFE != headerData[RECEIVE_HEAD_SYNCBYTE]){
+ /* Different value indicates an invalid result */
+ return HVC_ERROR_HEADER_INVALID;
+ }
+
+ /* Get data length */
+ *outDataSize = headerData[RECEIVE_HEAD_DATALENLL] +
+ (headerData[RECEIVE_HEAD_DATALENLM]<<8) +
+ (headerData[RECEIVE_HEAD_DATALENML]<<16) +
+ (headerData[RECEIVE_HEAD_DATALENMM]<<24);
+
+ /* Get command execution result */
+ *outStatus = headerData[RECEIVE_HEAD_STATUS];
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/* Receive data */
+/* param : INT32 inTimeOutTime timeout time */
+/* : INT32 inDataSize receive signal data size */
+/* : UINT8 *outResult receive signal data */
+/* return : INT32 execution result error code */
+/* : 0...normal */
+/* : -20...timeout error */
+/*----------------------------------------------------------------------------*/
+static INT32 HVC_ReceiveData(INT32 inTimeOutTime, INT32 inDataSize, UINT8 *outResult)
+{
+ INT32 ret = 0;
+
+ if ( inDataSize <= 0 ) return 0;
+
+ /* Receive data */
+ ret = UART_ReceiveData(inTimeOutTime, inDataSize, outResult);
+ if(ret != inDataSize){
+ return HVC_ERROR_DATA_TIMEOUT;
+ }
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/* HVC_GetVersion */
+/* param : INT32 inTimeOutTime timeout time (ms) */
+/* : HVC_VERSION *outVersion version data */
+/* : UINT8 *outStatus response code */
+/* return : INT32 execution result error code */
+/* : 0...normal */
+/* : -1...parameter error */
+/* : other...signal error */
+/*----------------------------------------------------------------------------*/
+INT32 HVC_GetVersion(INT32 inTimeOutTime, HVC_VERSION *outVersion, UINT8 *outStatus)
+{
+ INT32 ret = 0;
+ INT32 size = 0;
+
+ if((NULL == outVersion) || (NULL == outStatus)){
+ return HVC_ERROR_PARAMETER;
+ }
+
+ /* Send GetVersion command signal */
+ ret = HVC_SendCommand(HVC_COM_GET_VERSION, 0, NULL);
+ if ( ret != 0 ) return ret;
+
+ /* Receive header */
+ ret = HVC_ReceiveHeader(inTimeOutTime, &size, outStatus);
+ if ( ret != 0 ) return ret;
+
+ if ( size > (INT32)sizeof(HVC_VERSION) ) {
+ size = sizeof(HVC_VERSION);
+ }
+
+ /* Receive data */
+ return HVC_ReceiveData(inTimeOutTime, size, (UINT8*)outVersion);
+}
+
+/*----------------------------------------------------------------------------*/
+/* HVC_SetCameraAngle */
+/* param : INT32 inTimeOutTime timeout time (ms) */
+/* : INT32 inAngleNo camera angle number */
+/* : UINT8 *outStatus response code */
+/* return : INT32 execution result error code */
+/* : 0...normal */
+/* : -1...parameter error */
+/* : other...signal error */
+/*----------------------------------------------------------------------------*/
+INT32 HVC_SetCameraAngle(INT32 inTimeOutTime, INT32 inAngleNo, UINT8 *outStatus)
+{
+ INT32 ret = 0;
+ INT32 size = 0;
+ UINT8 sendData[32];
+
+ if(NULL == outStatus){
+ return HVC_ERROR_PARAMETER;
+ }
+
+ sendData[0] = (UINT8)(inAngleNo&0xff);
+ /* Send SetCameraAngle command signal */
+ ret = HVC_SendCommand(HVC_COM_SET_CAMERA_ANGLE, sizeof(UINT8), sendData);
+ if ( ret != 0 ) return ret;
+
+ /* Receive header */
+ ret = HVC_ReceiveHeader(inTimeOutTime, &size, outStatus);
+ if ( ret != 0 ) return ret;
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/* HVC_GetCameraAngle */
+/* param : INT32 inTimeOutTime timeout time (ms) */
+/* : INT32 *outAngleNo camera angle number */
+/* : UINT8 *outStatus response code */
+/* return : INT32 execution result error code */
+/* : 0...normal */
+/* : -1...parameter error */
+/* : other...signal error */
+/*----------------------------------------------------------------------------*/
+INT32 HVC_GetCameraAngle(INT32 inTimeOutTime, INT32 *outAngleNo, UINT8 *outStatus)
+{
+ INT32 ret = 0;
+ INT32 size = 0;
+ UINT8 recvData[32];
+
+ if((NULL == outAngleNo) || (NULL == outStatus)){
+ return HVC_ERROR_PARAMETER;
+ }
+
+ /* Send GetCameraAngle command signal */
+ ret = HVC_SendCommand(HVC_COM_GET_CAMERA_ANGLE, 0, NULL);
+ if ( ret != 0 ) return ret;
+
+ /* Receive header */
+ ret = HVC_ReceiveHeader(inTimeOutTime, &size, outStatus);
+ if ( ret != 0 ) return ret;
+
+ if ( size > (INT32)sizeof(UINT8) ) {
+ size = sizeof(UINT8);
+ }
+
+ /* Receive data */
+ ret = HVC_ReceiveData(inTimeOutTime, size, recvData);
+ *outAngleNo = recvData[0];
+ return ret;
+}
+
+/*----------------------------------------------------------------------------*/
+/* HVC_Execute */
+/* param : INT32 inTimeOutTime timeout time (ms) */
+/* : INT32 inExec executable function */
+/* : INT32 inImage image info */
+/* : HVC_RESULT *outHVCResult result data */
+/* : UINT8 *outStatus response code */
+/* return : INT32 execution result error code */
+/* : 0...normal */
+/* : -1...parameter error */
+/* : other...signal error */
+/*----------------------------------------------------------------------------*/
+INT32 HVC_Execute(INT32 inTimeOutTime, INT32 inExec, INT32 inImage, HVC_RESULT *outHVCResult, UINT8 *outStatus)
+{
+ int i;
+ INT32 ret = 0;
+ INT32 size = 0;
+ UINT8 sendData[32];
+ UINT8 recvData[32];
+
+ if((NULL == outHVCResult) || (NULL == outStatus)){
+ return HVC_ERROR_PARAMETER;
+ }
+
+ /* Send Execute command signal */
+ sendData[0] = (UINT8)(inExec&0xff);
+ sendData[1] = (UINT8)((inExec>>8)&0xff);
+ sendData[2] = (UINT8)(inImage&0xff);
+ ret = HVC_SendCommand(HVC_COM_EXECUTE, sizeof(UINT8)*3, sendData);
+ if ( ret != 0 ) return ret;
+
+ /* Receive header */
+ ret = HVC_ReceiveHeader(inTimeOutTime, &size, outStatus);
+ if ( ret != 0 ) return ret;
+
+ /* Receive result data */
+ if ( size >= (INT32)sizeof(UINT8)*4 ) {
+ outHVCResult->executedFunc = inExec;
+ ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*4, recvData);
+ outHVCResult->bdResult.num = recvData[0];
+ outHVCResult->hdResult.num = recvData[1];
+ outHVCResult->fdResult.num = recvData[2];
+ if ( ret != 0 ) return ret;
+ size -= sizeof(UINT8)*4;
+ }
+
+ /* Get Human Body Detection result */
+ for(i = 0; i < outHVCResult->bdResult.num; i++){
+ if ( size >= (INT32)sizeof(UINT8)*8 ) {
+ ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*8, recvData);
+ outHVCResult->bdResult.bdResult[i].posX = (short)(recvData[0] + (recvData[1]<<8));
+ outHVCResult->bdResult.bdResult[i].posY = (short)(recvData[2] + (recvData[3]<<8));
+ outHVCResult->bdResult.bdResult[i].size = (short)(recvData[4] + (recvData[5]<<8));
+ outHVCResult->bdResult.bdResult[i].confidence = (short)(recvData[6] + (recvData[7]<<8));
+ if ( ret != 0 ) return ret;
+ size -= sizeof(UINT8)*8;
+ }
+ }
+
+ /* Get Hand Detection result */
+ for(i = 0; i < outHVCResult->hdResult.num; i++){
+ if ( size >= (INT32)sizeof(UINT8)*8 ) {
+ ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*8, recvData);
+ outHVCResult->hdResult.hdResult[i].posX = (short)(recvData[0] + (recvData[1]<<8));
+ outHVCResult->hdResult.hdResult[i].posY = (short)(recvData[2] + (recvData[3]<<8));
+ outHVCResult->hdResult.hdResult[i].size = (short)(recvData[4] + (recvData[5]<<8));
+ outHVCResult->hdResult.hdResult[i].confidence = (short)(recvData[6] + (recvData[7]<<8));
+ if ( ret != 0 ) return ret;
+ size -= sizeof(UINT8)*8;
+ }
+ }
+
+ /* Face-related results */
+ for(i = 0; i < outHVCResult->fdResult.num; i++){
+ /* Face Detection result */
+ if(0 != (outHVCResult->executedFunc & HVC_ACTIV_FACE_DETECTION)){
+ if ( size >= (INT32)sizeof(UINT8)*8 ) {
+ ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*8, recvData);
+ outHVCResult->fdResult.fcResult[i].dtResult.posX = (short)(recvData[0] + (recvData[1]<<8));
+ outHVCResult->fdResult.fcResult[i].dtResult.posY = (short)(recvData[2] + (recvData[3]<<8));
+ outHVCResult->fdResult.fcResult[i].dtResult.size = (short)(recvData[4] + (recvData[5]<<8));
+ outHVCResult->fdResult.fcResult[i].dtResult.confidence = (short)(recvData[6] + (recvData[7]<<8));
+ if ( ret != 0 ) return ret;
+ size -= sizeof(UINT8)*8;
+ }
+ }
+
+ /* Face direction */
+ if(0 != (outHVCResult->executedFunc & HVC_ACTIV_FACE_DIRECTION)){
+ if ( size >= (INT32)sizeof(UINT8)*8 ) {
+ ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*8, recvData);
+ outHVCResult->fdResult.fcResult[i].dirResult.yaw = (short)(recvData[0] + (recvData[1]<<8));
+ outHVCResult->fdResult.fcResult[i].dirResult.pitch = (short)(recvData[2] + (recvData[3]<<8));
+ outHVCResult->fdResult.fcResult[i].dirResult.roll = (short)(recvData[4] + (recvData[5]<<8));
+ outHVCResult->fdResult.fcResult[i].dirResult.confidence = (short)(recvData[6] + (recvData[7]<<8));
+ if ( ret != 0 ) return ret;
+ size -= sizeof(UINT8)*8;
+ }
+ }
+
+ /* Age */
+ if(0 != (outHVCResult->executedFunc & HVC_ACTIV_AGE_ESTIMATION)){
+ if ( size >= (INT32)sizeof(UINT8)*3 ) {
+ ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*3, recvData);
+#if(1) // Mbed
+ outHVCResult->fdResult.fcResult[i].ageResult.age = (signed char)(recvData[0]);
+#else
+ outHVCResult->fdResult.fcResult[i].ageResult.age = (char)(recvData[0]);
+#endif
+ outHVCResult->fdResult.fcResult[i].ageResult.confidence = (short)(recvData[1] + (recvData[2]<<8));
+ if ( ret != 0 ) return ret;
+ size -= sizeof(UINT8)*3;
+ }
+ }
+
+ /* Gender */
+ if(0 != (outHVCResult->executedFunc & HVC_ACTIV_GENDER_ESTIMATION)){
+ if ( size >= (INT32)sizeof(UINT8)*3 ) {
+ ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*3, recvData);
+#if(1) // Mbed
+ outHVCResult->fdResult.fcResult[i].genderResult.gender = (signed char)(recvData[0]);
+#else
+ outHVCResult->fdResult.fcResult[i].genderResult.gender = (char)(recvData[0]);
+#endif
+ outHVCResult->fdResult.fcResult[i].genderResult.confidence = (short)(recvData[1] + (recvData[2]<<8));
+ if ( ret != 0 ) return ret;
+ size -= sizeof(UINT8)*3;
+ }
+ }
+
+ /* Gaze */
+ if(0 != (outHVCResult->executedFunc & HVC_ACTIV_GAZE_ESTIMATION)){
+ if ( size >= (INT32)sizeof(UINT8)*2 ) {
+ ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*2, recvData);
+#if(1) // Mbed
+ outHVCResult->fdResult.fcResult[i].gazeResult.gazeLR = (signed char)(recvData[0]);
+ outHVCResult->fdResult.fcResult[i].gazeResult.gazeUD = (signed char)(recvData[1]);
+#else
+ outHVCResult->fdResult.fcResult[i].gazeResult.gazeLR = (char)(recvData[0]);
+ outHVCResult->fdResult.fcResult[i].gazeResult.gazeUD = (char)(recvData[1]);
+#endif
+ if ( ret != 0 ) return ret;
+ size -= sizeof(UINT8)*2;
+ }
+ }
+
+ /* Blink */
+ if(0 != (outHVCResult->executedFunc & HVC_ACTIV_BLINK_ESTIMATION)){
+ if ( size >= (INT32)sizeof(UINT8)*4 ) {
+ ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*4, recvData);
+ outHVCResult->fdResult.fcResult[i].blinkResult.ratioL = (short)(recvData[0] + (recvData[1]<<8));
+ outHVCResult->fdResult.fcResult[i].blinkResult.ratioR = (short)(recvData[2] + (recvData[3]<<8));
+ if ( ret != 0 ) return ret;
+ size -= sizeof(UINT8)*4;
+ }
+ }
+
+ /* Expression */
+ if(0 != (outHVCResult->executedFunc & HVC_ACTIV_EXPRESSION_ESTIMATION)){
+ if ( size >= (INT32)sizeof(UINT8)*3 ) {
+ ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*3, recvData);
+#if(1) // Mbed
+ outHVCResult->fdResult.fcResult[i].expressionResult.topExpression = (signed char)(recvData[0]);
+ outHVCResult->fdResult.fcResult[i].expressionResult.topScore = (signed char)(recvData[1]);
+ outHVCResult->fdResult.fcResult[i].expressionResult.degree = (signed char)(recvData[2]);
+#else
+ outHVCResult->fdResult.fcResult[i].expressionResult.topExpression = (char)(recvData[0]);
+ outHVCResult->fdResult.fcResult[i].expressionResult.topScore = (char)(recvData[1]);
+ outHVCResult->fdResult.fcResult[i].expressionResult.degree = (char)(recvData[2]);
+#endif
+ if ( ret != 0 ) return ret;
+ size -= sizeof(UINT8)*3;
+ }
+ }
+
+ /* Face Recognition */
+ if(0 != (outHVCResult->executedFunc & HVC_ACTIV_FACE_RECOGNITION)){
+ if ( size >= (INT32)sizeof(UINT8)*4 ) {
+ ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*4, recvData);
+ outHVCResult->fdResult.fcResult[i].recognitionResult.uid = (short)(recvData[0] + (recvData[1]<<8));
+ outHVCResult->fdResult.fcResult[i].recognitionResult.confidence = (short)(recvData[2] + (recvData[3]<<8));
+ if ( ret != 0 ) return ret;
+ size -= sizeof(UINT8)*4;
+ }
+ }
+ }
+
+ if(HVC_EXECUTE_IMAGE_NONE != inImage){
+ /* Image data */
+ if ( size >= (INT32)sizeof(UINT8)*4 ) {
+ ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*4, recvData);
+ outHVCResult->image.width = (short)(recvData[0] + (recvData[1]<<8));
+ outHVCResult->image.height = (short)(recvData[2] + (recvData[3]<<8));
+ if ( ret != 0 ) return ret;
+ size -= sizeof(UINT8)*4;
+ }
+
+ if ( size >= (INT32)sizeof(UINT8)*outHVCResult->image.width*outHVCResult->image.height ) {
+ ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*outHVCResult->image.width*outHVCResult->image.height, outHVCResult->image.image);
+ if ( ret != 0 ) return ret;
+ size -= sizeof(UINT8)*outHVCResult->image.width*outHVCResult->image.height;
+ }
+ }
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/* HVC_ExecuteEx */
+/* param : INT32 inTimeOutTime timeout time (ms) */
+/* : INT32 inExec executable function */
+/* : INT32 inImage image info */
+/* : HVC_RESULT *outHVCResult result data */
+/* : UINT8 *outStatus response code */
+/* return : INT32 execution result error code */
+/* : 0...normal */
+/* : -1...parameter error */
+/* : other...signal error */
+/*----------------------------------------------------------------------------*/
+INT32 HVC_ExecuteEx(INT32 inTimeOutTime, INT32 inExec, INT32 inImage, HVC_RESULT *outHVCResult, UINT8 *outStatus)
+{
+ int i, j;
+ INT32 ret = 0;
+ INT32 size = 0;
+ UINT8 sendData[32];
+ UINT8 recvData[32];
+
+ if((NULL == outHVCResult) || (NULL == outStatus)){
+ return HVC_ERROR_PARAMETER;
+ }
+
+ /* Send Execute command signal */
+ sendData[0] = (UINT8)(inExec&0xff);
+ sendData[1] = (UINT8)((inExec>>8)&0xff);
+ sendData[2] = (UINT8)(inImage&0xff);
+ ret = HVC_SendCommand(HVC_COM_EXECUTEEX, sizeof(UINT8)*3, sendData);
+ if ( ret != 0 ) return ret;
+
+ /* Receive header */
+ ret = HVC_ReceiveHeader(inTimeOutTime, &size, outStatus);
+ if ( ret != 0 ) return ret;
+
+ /* Receive result data */
+ if ( size >= (INT32)sizeof(UINT8)*4 ) {
+ outHVCResult->executedFunc = inExec;
+ ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*4, recvData);
+ outHVCResult->bdResult.num = recvData[0];
+ outHVCResult->hdResult.num = recvData[1];
+ outHVCResult->fdResult.num = recvData[2];
+ if ( ret != 0 ) return ret;
+ size -= sizeof(UINT8)*4;
+ }
+
+ /* Get Human Body Detection result */
+ for(i = 0; i < outHVCResult->bdResult.num; i++){
+ if ( size >= (INT32)sizeof(UINT8)*8 ) {
+ ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*8, recvData);
+ outHVCResult->bdResult.bdResult[i].posX = (short)(recvData[0] + (recvData[1]<<8));
+ outHVCResult->bdResult.bdResult[i].posY = (short)(recvData[2] + (recvData[3]<<8));
+ outHVCResult->bdResult.bdResult[i].size = (short)(recvData[4] + (recvData[5]<<8));
+ outHVCResult->bdResult.bdResult[i].confidence = (short)(recvData[6] + (recvData[7]<<8));
+ if ( ret != 0 ) return ret;
+ size -= sizeof(UINT8)*8;
+ }
+ }
+
+ /* Get Hand Detection result */
+ for(i = 0; i < outHVCResult->hdResult.num; i++){
+ if ( size >= (INT32)sizeof(UINT8)*8 ) {
+ ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*8, recvData);
+ outHVCResult->hdResult.hdResult[i].posX = (short)(recvData[0] + (recvData[1]<<8));
+ outHVCResult->hdResult.hdResult[i].posY = (short)(recvData[2] + (recvData[3]<<8));
+ outHVCResult->hdResult.hdResult[i].size = (short)(recvData[4] + (recvData[5]<<8));
+ outHVCResult->hdResult.hdResult[i].confidence = (short)(recvData[6] + (recvData[7]<<8));
+ if ( ret != 0 ) return ret;
+ size -= sizeof(UINT8)*8;
+ }
+ }
+
+ /* Face-related results */
+ for(i = 0; i < outHVCResult->fdResult.num; i++){
+ /* Face Detection result */
+ if(0 != (outHVCResult->executedFunc & HVC_ACTIV_FACE_DETECTION)){
+ if ( size >= (INT32)sizeof(UINT8)*8 ) {
+ ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*8, recvData);
+ outHVCResult->fdResult.fcResult[i].dtResult.posX = (short)(recvData[0] + (recvData[1]<<8));
+ outHVCResult->fdResult.fcResult[i].dtResult.posY = (short)(recvData[2] + (recvData[3]<<8));
+ outHVCResult->fdResult.fcResult[i].dtResult.size = (short)(recvData[4] + (recvData[5]<<8));
+ outHVCResult->fdResult.fcResult[i].dtResult.confidence = (short)(recvData[6] + (recvData[7]<<8));
+ if ( ret != 0 ) return ret;
+ size -= sizeof(UINT8)*8;
+ }
+ }
+
+ /* Face direction */
+ if(0 != (outHVCResult->executedFunc & HVC_ACTIV_FACE_DIRECTION)){
+ if ( size >= (INT32)sizeof(UINT8)*8 ) {
+ ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*8, recvData);
+ outHVCResult->fdResult.fcResult[i].dirResult.yaw = (short)(recvData[0] + (recvData[1]<<8));
+ outHVCResult->fdResult.fcResult[i].dirResult.pitch = (short)(recvData[2] + (recvData[3]<<8));
+ outHVCResult->fdResult.fcResult[i].dirResult.roll = (short)(recvData[4] + (recvData[5]<<8));
+ outHVCResult->fdResult.fcResult[i].dirResult.confidence = (short)(recvData[6] + (recvData[7]<<8));
+ if ( ret != 0 ) return ret;
+ size -= sizeof(UINT8)*8;
+ }
+ }
+
+ /* Age */
+ if(0 != (outHVCResult->executedFunc & HVC_ACTIV_AGE_ESTIMATION)){
+ if ( size >= (INT32)sizeof(UINT8)*3 ) {
+ ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*3, recvData);
+#if(1) // Mbed
+ outHVCResult->fdResult.fcResult[i].ageResult.age = (signed char)(recvData[0]);
+#else
+ outHVCResult->fdResult.fcResult[i].ageResult.age = (char)(recvData[0]);
+#endif
+ outHVCResult->fdResult.fcResult[i].ageResult.confidence = (short)(recvData[1] + (recvData[2]<<8));
+ if ( ret != 0 ) return ret;
+ size -= sizeof(UINT8)*3;
+ }
+ }
+
+ /* Gender */
+ if(0 != (outHVCResult->executedFunc & HVC_ACTIV_GENDER_ESTIMATION)){
+ if ( size >= (INT32)sizeof(UINT8)*3 ) {
+ ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*3, recvData);
+#if(1) // Mbed
+ outHVCResult->fdResult.fcResult[i].genderResult.gender = (signed char)(recvData[0]);
+#else
+ outHVCResult->fdResult.fcResult[i].genderResult.gender = (char)(recvData[0]);
+#endif
+ outHVCResult->fdResult.fcResult[i].genderResult.confidence = (short)(recvData[1] + (recvData[2]<<8));
+ if ( ret != 0 ) return ret;
+ size -= sizeof(UINT8)*3;
+ }
+ }
+
+ /* Gaze */
+ if(0 != (outHVCResult->executedFunc & HVC_ACTIV_GAZE_ESTIMATION)){
+ if ( size >= (INT32)sizeof(UINT8)*2 ) {
+ ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*2, recvData);
+#if(1) // Mbed
+ outHVCResult->fdResult.fcResult[i].gazeResult.gazeLR = (signed char)(recvData[0]);
+ outHVCResult->fdResult.fcResult[i].gazeResult.gazeUD = (signed char)(recvData[1]);
+#else
+ outHVCResult->fdResult.fcResult[i].gazeResult.gazeLR = (char)(recvData[0]);
+ outHVCResult->fdResult.fcResult[i].gazeResult.gazeUD = (char)(recvData[1]);
+#endif
+ if ( ret != 0 ) return ret;
+ size -= sizeof(UINT8)*2;
+ }
+ }
+
+ /* Blink */
+ if(0 != (outHVCResult->executedFunc & HVC_ACTIV_BLINK_ESTIMATION)){
+ if ( size >= (INT32)sizeof(UINT8)*4 ) {
+ ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*4, recvData);
+ outHVCResult->fdResult.fcResult[i].blinkResult.ratioL = (short)(recvData[0] + (recvData[1]<<8));
+ outHVCResult->fdResult.fcResult[i].blinkResult.ratioR = (short)(recvData[2] + (recvData[3]<<8));
+ if ( ret != 0 ) return ret;
+ size -= sizeof(UINT8)*4;
+ }
+ }
+
+ /* Expression */
+ if(0 != (outHVCResult->executedFunc & HVC_ACTIV_EXPRESSION_ESTIMATION)){
+ if ( size >= (INT32)sizeof(UINT8)*6 ) {
+ ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*6, recvData);
+ outHVCResult->fdResult.fcResult[i].expressionResult.topExpression = -128;
+ outHVCResult->fdResult.fcResult[i].expressionResult.topScore = -128;
+ for(j = 0; j < 5; j++){
+#if(1) // Mbed
+ outHVCResult->fdResult.fcResult[i].expressionResult.score[j] = (signed char)(recvData[j]);
+#else
+ outHVCResult->fdResult.fcResult[i].expressionResult.score[j] = (char)(recvData[j]);
+#endif
+ if(outHVCResult->fdResult.fcResult[i].expressionResult.topScore < outHVCResult->fdResult.fcResult[i].expressionResult.score[j]){
+ outHVCResult->fdResult.fcResult[i].expressionResult.topScore = outHVCResult->fdResult.fcResult[i].expressionResult.score[j];
+ outHVCResult->fdResult.fcResult[i].expressionResult.topExpression = j + 1;
+ }
+ }
+#if(1) // Mbed
+ outHVCResult->fdResult.fcResult[i].expressionResult.degree = (signed char)(recvData[5]);
+#else
+ outHVCResult->fdResult.fcResult[i].expressionResult.degree = (char)(recvData[5]);
+#endif
+ if ( ret != 0 ) return ret;
+ size -= sizeof(UINT8)*6;
+ }
+ }
+
+ /* Face Recognition */
+ if(0 != (outHVCResult->executedFunc & HVC_ACTIV_FACE_RECOGNITION)){
+ if ( size >= (INT32)sizeof(UINT8)*4 ) {
+ ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*4, recvData);
+ outHVCResult->fdResult.fcResult[i].recognitionResult.uid = (short)(recvData[0] + (recvData[1]<<8));
+ outHVCResult->fdResult.fcResult[i].recognitionResult.confidence = (short)(recvData[2] + (recvData[3]<<8));
+ if ( ret != 0 ) return ret;
+ size -= sizeof(UINT8)*4;
+ }
+ }
+ }
+
+ if(HVC_EXECUTE_IMAGE_NONE != inImage){
+ /* Image data */
+ if ( size >= (INT32)sizeof(UINT8)*4 ) {
+ ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*4, recvData);
+ outHVCResult->image.width = (short)(recvData[0] + (recvData[1]<<8));
+ outHVCResult->image.height = (short)(recvData[2] + (recvData[3]<<8));
+ if ( ret != 0 ) return ret;
+ size -= sizeof(UINT8)*4;
+ }
+
+ if ( size >= (INT32)sizeof(UINT8)*outHVCResult->image.width*outHVCResult->image.height ) {
+ ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*outHVCResult->image.width*outHVCResult->image.height, outHVCResult->image.image);
+ if ( ret != 0 ) return ret;
+ size -= sizeof(UINT8)*outHVCResult->image.width*outHVCResult->image.height;
+ }
+ }
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/* HVC_SetThreshold */
+/* param : INT32 inTimeOutTime timeout time (ms) */
+/* : HVC_THRESHOLD *inThreshold threshold values */
+/* : UINT8 *outStatus response code */
+/* return : INT32 execution result error code */
+/* : 0...normal */
+/* : -1...parameter error */
+/* : other...signal error */
+/*----------------------------------------------------------------------------*/
+INT32 HVC_SetThreshold(INT32 inTimeOutTime, HVC_THRESHOLD *inThreshold, UINT8 *outStatus)
+{
+ INT32 ret = 0;
+ INT32 size = 0;
+ UINT8 sendData[32];
+
+ if((NULL == inThreshold) || (NULL == outStatus)){
+ return HVC_ERROR_PARAMETER;
+ }
+
+ sendData[0] = (UINT8)(inThreshold->bdThreshold&0xff);
+ sendData[1] = (UINT8)((inThreshold->bdThreshold>>8)&0xff);
+ sendData[2] = (UINT8)(inThreshold->hdThreshold&0xff);
+ sendData[3] = (UINT8)((inThreshold->hdThreshold>>8)&0xff);
+ sendData[4] = (UINT8)(inThreshold->dtThreshold&0xff);
+ sendData[5] = (UINT8)((inThreshold->dtThreshold>>8)&0xff);
+ sendData[6] = (UINT8)(inThreshold->rsThreshold&0xff);
+ sendData[7] = (UINT8)((inThreshold->rsThreshold>>8)&0xff);
+ /* Send SetThreshold command signal */
+ ret = HVC_SendCommand(HVC_COM_SET_THRESHOLD, sizeof(UINT8)*8, sendData);
+ if ( ret != 0 ) return ret;
+
+ /* Receive header */
+ ret = HVC_ReceiveHeader(inTimeOutTime, &size, outStatus);
+ if ( ret != 0 ) return ret;
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/* HVC_GetThreshold */
+/* param : INT32 inTimeOutTime timeout time (ms) */
+/* : HVC_THRESHOLD *outThreshold threshold values */
+/* : UINT8 *outStatus response code */
+/* return : INT32 execution result error code */
+/* : 0...normal */
+/* : -1...parameter error */
+/* : other...signal error */
+/*----------------------------------------------------------------------------*/
+INT32 HVC_GetThreshold(INT32 inTimeOutTime, HVC_THRESHOLD *outThreshold, UINT8 *outStatus)
+{
+ INT32 ret = 0;
+ INT32 size = 0;
+ UINT8 recvData[32];
+
+ if((NULL == outThreshold) || (NULL == outStatus)){
+ return HVC_ERROR_PARAMETER;
+ }
+
+ /* Send GetThreshold command signal */
+ ret = HVC_SendCommand(HVC_COM_GET_THRESHOLD, 0, NULL);
+ if ( ret != 0 ) return ret;
+
+ /* Receive header */
+ ret = HVC_ReceiveHeader(inTimeOutTime, &size, outStatus);
+ if ( ret != 0 ) return ret;
+
+ if ( size > (INT32)sizeof(UINT8)*8 ) {
+ size = sizeof(UINT8)*8;
+ }
+
+ /* Receive data */
+ ret = HVC_ReceiveData(inTimeOutTime, size, recvData);
+ outThreshold->bdThreshold = recvData[0] + (recvData[1]<<8);
+ outThreshold->hdThreshold = recvData[2] + (recvData[3]<<8);
+ outThreshold->dtThreshold = recvData[4] + (recvData[5]<<8);
+ outThreshold->rsThreshold = recvData[6] + (recvData[7]<<8);
+ return ret;
+}
+
+/*----------------------------------------------------------------------------*/
+/* HVC_SetSizeRange */
+/* param : INT32 inTimeOutTime timeout time (ms) */
+/* : HVC_SIZERANGE *inSizeRange detection sizes */
+/* : UINT8 *outStatus response code */
+/* return : INT32 execution result error code */
+/* : 0...normal */
+/* : -1...parameter error */
+/* : other...signal error */
+/*----------------------------------------------------------------------------*/
+INT32 HVC_SetSizeRange(INT32 inTimeOutTime, HVC_SIZERANGE *inSizeRange, UINT8 *outStatus)
+{
+ INT32 ret = 0;
+ INT32 size = 0;
+ UINT8 sendData[32];
+
+ if((NULL == inSizeRange) || (NULL == outStatus)){
+ return HVC_ERROR_PARAMETER;
+ }
+
+ sendData[0] = (UINT8)(inSizeRange->bdMinSize&0xff);
+ sendData[1] = (UINT8)((inSizeRange->bdMinSize>>8)&0xff);
+ sendData[2] = (UINT8)(inSizeRange->bdMaxSize&0xff);
+ sendData[3] = (UINT8)((inSizeRange->bdMaxSize>>8)&0xff);
+ sendData[4] = (UINT8)(inSizeRange->hdMinSize&0xff);
+ sendData[5] = (UINT8)((inSizeRange->hdMinSize>>8)&0xff);
+ sendData[6] = (UINT8)(inSizeRange->hdMaxSize&0xff);
+ sendData[7] = (UINT8)((inSizeRange->hdMaxSize>>8)&0xff);
+ sendData[8] = (UINT8)(inSizeRange->dtMinSize&0xff);
+ sendData[9] = (UINT8)((inSizeRange->dtMinSize>>8)&0xff);
+ sendData[10] = (UINT8)(inSizeRange->dtMaxSize&0xff);
+ sendData[11] = (UINT8)((inSizeRange->dtMaxSize>>8)&0xff);
+ /* Send SetSizeRange command signal */
+ ret = HVC_SendCommand(HVC_COM_SET_SIZE_RANGE, sizeof(UINT8)*12, sendData);
+ if ( ret != 0 ) return ret;
+
+ /* Receive header */
+ ret = HVC_ReceiveHeader(inTimeOutTime, &size, outStatus);
+ if ( ret != 0 ) return ret;
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/* HVC_GetSizeRange */
+/* param : INT32 inTimeOutTime timeout time (ms) */
+/* : HVC_SIZERANGE *outSizeRange detection sizes */
+/* : UINT8 *outStatus response code */
+/* return : INT32 execution result error code */
+/* : 0...normal */
+/* : -1...parameter error */
+/* : other...signal error */
+/*----------------------------------------------------------------------------*/
+INT32 HVC_GetSizeRange(INT32 inTimeOutTime, HVC_SIZERANGE *outSizeRange, UINT8 *outStatus)
+{
+ INT32 ret = 0;
+ INT32 size = 0;
+ UINT8 recvData[32];
+
+ if((NULL == outSizeRange) || (NULL == outStatus)){
+ return HVC_ERROR_PARAMETER;
+ }
+
+ /* Send GetSizeRange command signal */
+ ret = HVC_SendCommand(HVC_COM_GET_SIZE_RANGE, 0, NULL);
+ if ( ret != 0 ) return ret;
+
+ /* Receive header */
+ ret = HVC_ReceiveHeader(inTimeOutTime, &size, outStatus);
+ if ( ret != 0 ) return ret;
+
+ if ( size > (INT32)sizeof(UINT8)*12 ) {
+ size = sizeof(UINT8)*12;
+ }
+
+ /* Receive data */
+ ret = HVC_ReceiveData(inTimeOutTime, size, recvData);
+ outSizeRange->bdMinSize = recvData[0] + (recvData[1]<<8);
+ outSizeRange->bdMaxSize = recvData[2] + (recvData[3]<<8);
+ outSizeRange->hdMinSize = recvData[4] + (recvData[5]<<8);
+ outSizeRange->hdMaxSize = recvData[6] + (recvData[7]<<8);
+ outSizeRange->dtMinSize = recvData[8] + (recvData[9]<<8);
+ outSizeRange->dtMaxSize = recvData[10] + (recvData[11]<<8);
+ return ret;
+}
+
+/*----------------------------------------------------------------------------*/
+/* HVC_SetFaceDetectionAngle */
+/* param : INT32 inTimeOutTime timeout time (ms) */
+/* : INT32 inPose Yaw angle range */
+/* : INT32 inAngle Roll angle range */
+/* : UINT8 *outStatus response code */
+/* return : INT32 execution result error code */
+/* : 0...normal */
+/* : -1...parameter error */
+/* : other...signal error */
+/*----------------------------------------------------------------------------*/
+INT32 HVC_SetFaceDetectionAngle(INT32 inTimeOutTime, INT32 inPose, INT32 inAngle, UINT8 *outStatus)
+{
+ INT32 ret = 0;
+ INT32 size = 0;
+ UINT8 sendData[32];
+
+ if(NULL == outStatus){
+ return HVC_ERROR_PARAMETER;
+ }
+
+ sendData[0] = (UINT8)(inPose&0xff);
+ sendData[1] = (UINT8)(inAngle&0xff);
+ /* Send SetFaceDetectionAngle command signal */
+ ret = HVC_SendCommand(HVC_COM_SET_DETECTION_ANGLE, sizeof(UINT8)*2, sendData);
+ if ( ret != 0 ) return ret;
+
+ /* Receive header */
+ ret = HVC_ReceiveHeader(inTimeOutTime, &size, outStatus);
+ if ( ret != 0 ) return ret;
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/* HVC_GetFaceDetectionAngle */
+/* param : INT32 inTimeOutTime timeout time (ms) */
+/* : INT32 *outPose Yaw angle range */
+/* : INT32 *outAngle Roll angle range */
+/* : UINT8 *outStatus response code */
+/* return : INT32 execution result error code */
+/* : 0...normal */
+/* : -1...parameter error */
+/* : other...signal error */
+/*----------------------------------------------------------------------------*/
+INT32 HVC_GetFaceDetectionAngle(INT32 inTimeOutTime, INT32 *outPose, INT32 *outAngle, UINT8 *outStatus)
+{
+ INT32 ret = 0;
+ INT32 size = 0;
+ UINT8 recvData[32];
+
+ if((NULL == outPose) || (NULL == outAngle) || (NULL == outStatus)){
+ return HVC_ERROR_PARAMETER;
+ }
+
+ /* Send GetFaceDetectionAngle signal command */
+ ret = HVC_SendCommand(HVC_COM_GET_DETECTION_ANGLE, 0, NULL);
+ if ( ret != 0 ) return ret;
+
+ /* Receive header */
+ ret = HVC_ReceiveHeader(inTimeOutTime, &size, outStatus);
+ if ( ret != 0 ) return ret;
+
+ if ( size > (INT32)sizeof(UINT8)*2 ) {
+ size = sizeof(UINT8)*2;
+ }
+
+ /* Receive data */
+ ret = HVC_ReceiveData(inTimeOutTime, size, recvData);
+ *outPose = recvData[0];
+ *outAngle = recvData[1];
+ return ret;
+}
+
+/*----------------------------------------------------------------------------*/
+/* HVC_SetBaudRate */
+/* param : INT32 inTimeOutTime timeout time (ms) */
+/* : INT32 inRate Baudrate */
+/* : UINT8 *outStatus response code */
+/* return : INT32 execution result error code */
+/* : 0...normal */
+/* : -1...parameter error */
+/* : other...signal error */
+/*----------------------------------------------------------------------------*/
+INT32 HVC_SetBaudRate(INT32 inTimeOutTime, INT32 inRate, UINT8 *outStatus)
+{
+ INT32 ret = 0;
+ INT32 size = 0;
+ UINT8 sendData[32];
+
+ if(NULL == outStatus){
+ return HVC_ERROR_PARAMETER;
+ }
+
+ sendData[0] = (UINT8)(inRate&0xff);
+ /* Send SetBaudRate command signal */
+ ret = HVC_SendCommand(HVC_COM_SET_BAUDRATE, sizeof(UINT8), sendData);
+ if ( ret != 0 ) return ret;
+
+ /* Receive header */
+ ret = HVC_ReceiveHeader(inTimeOutTime, &size, outStatus);
+ if ( ret != 0 ) return ret;
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/* HVC_Registration */
+/* param : INT32 inTimeOutTime timeout time (ms) */
+/* : INT32 inUserID User ID (0-499) */
+/* : INT32 inDataID Data ID (0-9) */
+/* : HVC_IMAGE *outImage image info */
+/* : UINT8 *outStatus response code */
+/* return : INT32 execution result error code */
+/* : 0...normal */
+/* : -1...parameter error */
+/* : other...signal error */
+/*----------------------------------------------------------------------------*/
+INT32 HVC_Registration(INT32 inTimeOutTime, INT32 inUserID, INT32 inDataID, HVC_IMAGE *outImage, UINT8 *outStatus)
+{
+ INT32 ret = 0;
+ INT32 size = 0;
+ UINT8 sendData[32];
+ UINT8 recvData[32];
+
+ if((NULL == outImage) || (NULL == outStatus)){
+ return HVC_ERROR_PARAMETER;
+ }
+
+ /* Send Registration signal command */
+ sendData[0] = (UINT8)(inUserID&0xff);
+ sendData[1] = (UINT8)((inUserID>>8)&0xff);
+ sendData[2] = (UINT8)(inDataID&0xff);
+ ret = HVC_SendCommand(HVC_COM_REGISTRATION, sizeof(UINT8)*3, sendData);
+ if ( ret != 0 ) return ret;
+
+ /* Receive header */
+ ret = HVC_ReceiveHeader(inTimeOutTime, &size, outStatus);
+ if ( ret != 0 ) return ret;
+
+ /* Receive data */
+ if ( size >= (INT32)sizeof(UINT8)*4 ) {
+ ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*4, recvData);
+ outImage->width = recvData[0] + (recvData[1]<<8);
+ outImage->height = recvData[2] + (recvData[3]<<8);
+ if ( ret != 0 ) return ret;
+ size -= sizeof(UINT8)*4;
+ }
+
+ /* Image data */
+ if ( size >= (INT32)sizeof(UINT8)*64*64 ) {
+ ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*64*64, outImage->image);
+ if ( ret != 0 ) return ret;
+ size -= sizeof(UINT8)*64*64;
+ }
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/* HVC_DeleteData */
+/* param : INT32 inTimeOutTime timeout time (ms) */
+/* : INT32 inUserID User ID (0-499) */
+/* : INT32 inDataID Data ID (0-9) */
+/* : UINT8 *outStatus response code */
+/* return : INT32 execution result error code */
+/* : 0...normal */
+/* : -1...parameter error */
+/* : other...signal error */
+/*----------------------------------------------------------------------------*/
+INT32 HVC_DeleteData(INT32 inTimeOutTime, INT32 inUserID, INT32 inDataID, UINT8 *outStatus)
+{
+ INT32 ret = 0;
+ INT32 size = 0;
+ UINT8 sendData[32];
+
+ if(NULL == outStatus){
+ return HVC_ERROR_PARAMETER;
+ }
+
+ /* Send Delete Data signal command */
+ sendData[0] = (UINT8)(inUserID&0xff);
+ sendData[1] = (UINT8)((inUserID>>8)&0xff);
+ sendData[2] = (UINT8)(inDataID&0xff);
+ ret = HVC_SendCommand(HVC_COM_DELETE_DATA, sizeof(UINT8)*3, sendData);
+ if ( ret != 0 ) return ret;
+
+ /* Receive header */
+ ret = HVC_ReceiveHeader(inTimeOutTime, &size, outStatus);
+ if ( ret != 0 ) return ret;
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/* HVC_DeleteUser */
+/* param : INT32 inTimeOutTime timeout time (ms) */
+/* : INT32 inUserID User ID (0-499) */
+/* : UINT8 *outStatus response code */
+/* return : INT32 execution result error code */
+/* : 0...normal */
+/* : -1...parameter error */
+/* : other...signal error */
+/*----------------------------------------------------------------------------*/
+INT32 HVC_DeleteUser(INT32 inTimeOutTime, INT32 inUserID, UINT8 *outStatus)
+{
+ INT32 ret = 0;
+ INT32 size = 0;
+ UINT8 sendData[32];
+
+ if(NULL == outStatus){
+ return HVC_ERROR_PARAMETER;
+ }
+
+ /* Send Delete User signal command */
+ sendData[0] = (UINT8)(inUserID&0xff);
+ sendData[1] = (UINT8)((inUserID>>8)&0xff);
+ ret = HVC_SendCommand(HVC_COM_DELETE_USER, sizeof(UINT8)*2, sendData);
+ if ( ret != 0 ) return ret;
+
+ /* Receive header */
+ ret = HVC_ReceiveHeader(inTimeOutTime, &size, outStatus);
+ if ( ret != 0 ) return ret;
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/* HVC_DeleteAll */
+/* param : INT32 inTimeOutTime timeout time (ms) */
+/* : UINT8 *outStatus response code */
+/* return : INT32 execution result error code */
+/* : 0...normal */
+/* : -1...parameter error */
+/* : other...signal error */
+/*----------------------------------------------------------------------------*/
+INT32 HVC_DeleteAll(INT32 inTimeOutTime, UINT8 *outStatus)
+{
+ INT32 ret = 0;
+ INT32 size = 0;
+
+ if(NULL == outStatus){
+ return HVC_ERROR_PARAMETER;
+ }
+
+ /* Send Delete All signal command */
+ ret = HVC_SendCommand(HVC_COM_DELETE_ALL, 0, NULL);
+ if ( ret != 0 ) return ret;
+
+ /* Receive header */
+ ret = HVC_ReceiveHeader(inTimeOutTime, &size, outStatus);
+ if ( ret != 0 ) return ret;
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/* HVC_GetUserData */
+/* param : INT32 inTimeOutTime timeout time (ms) */
+/* : INT32 inUserID User ID (0-499) */
+/* : INT32 *outDataNo Registration Info */
+/* : UINT8 *outStatus response code */
+/* return : INT32 execution result error code */
+/* : 0...normal */
+/* : -1...parameter error */
+/* : other...signal error */
+/*----------------------------------------------------------------------------*/
+INT32 HVC_GetUserData(INT32 inTimeOutTime, INT32 inUserID, INT32 *outDataNo, UINT8 *outStatus)
+{
+ INT32 ret = 0;
+ INT32 size = 0;
+ UINT8 sendData[8];
+ UINT8 recvData[8];
+
+ if((NULL == outDataNo) || (NULL == outStatus)){
+ return HVC_ERROR_PARAMETER;
+ }
+
+ /* Send Get Registration Info signal command */
+ sendData[0] = (UINT8)(inUserID&0xff);
+ sendData[1] = (UINT8)((inUserID>>8)&0xff);
+ ret = HVC_SendCommand(HVC_COM_GET_PERSON_DATA, sizeof(UINT8)*2, sendData);
+ if ( ret != 0 ) return ret;
+
+ /* Receive header */
+ ret = HVC_ReceiveHeader(inTimeOutTime, &size, outStatus);
+ if ( ret != 0 ) return ret;
+
+ if ( size > (INT32)sizeof(UINT8)*2 ) {
+ size = sizeof(UINT8)*2;
+ }
+
+ /* Receive data */
+ ret = HVC_ReceiveData(inTimeOutTime, size, recvData);
+ *outDataNo = recvData[0] + (recvData[1]<<8);
+ return ret;
+}
+
+/*----------------------------------------------------------------------------*/
+/* HVC_SaveAlbum */
+/* param : INT32 inTimeOutTime timeout time (ms) */
+/* : UINT8 *outAlbumData Album data */
+/* : INT32 *outAlbumDataSize Album data size */
+/* : UINT8 *outStatus response code */
+/* return : INT32 execution result error code */
+/* : 0...normal */
+/* : -1...parameter error */
+/* : other...signal error */
+/*----------------------------------------------------------------------------*/
+INT32 HVC_SaveAlbum(INT32 inTimeOutTime, UINT8 *outAlbumData, INT32 *outAlbumDataSize, UINT8 *outStatus)
+{
+ INT32 ret = 0;
+ INT32 size = 0;
+
+ UINT8 *tmpAlbumData = NULL;;
+
+ if((NULL == outAlbumData) || (NULL == outAlbumDataSize) || (NULL == outStatus)){
+ return HVC_ERROR_PARAMETER;
+ }
+
+ /* Send Save Album signal command */
+ ret = HVC_SendCommand(HVC_COM_SAVE_ALBUM, 0, NULL);
+ if ( ret != 0 ) return ret;
+
+ ret = HVC_ReceiveHeader(inTimeOutTime, &size, outStatus);
+ if ( ret != 0 ) return ret;
+
+ if ( size >= (INT32)sizeof(UINT8)*8 + HVC_ALBUM_SIZE_MIN ) {
+ *outAlbumDataSize = size;
+ tmpAlbumData = outAlbumData;
+
+ do{
+ ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*4, tmpAlbumData);
+ if ( ret != 0 ) return ret;
+ tmpAlbumData += sizeof(UINT8)*4;
+
+ ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*4, tmpAlbumData);
+ if ( ret != 0 ) return ret;
+ tmpAlbumData += sizeof(UINT8)*4;
+
+ ret = HVC_ReceiveData(inTimeOutTime, size - sizeof(UINT8)*8, tmpAlbumData);
+ if ( ret != 0 ) return ret;
+ }while(0);
+ }
+ return ret;
+}
+
+
+/*----------------------------------------------------------------------------*/
+/* HVC_LoadAlbum */
+/* param : INT32 inTimeOutTime timeout time (ms) */
+/* : UINT8 *inAlbumData Album data */
+/* : INT32 inAlbumDataSize Album data size */
+/* : UINT8 *outStatus response code */
+/* return : INT32 execution result error code */
+/* : 0...normal */
+/* : -1...parameter error */
+/* : other...signal error */
+/*----------------------------------------------------------------------------*/
+INT32 HVC_LoadAlbum(INT32 inTimeOutTime, UINT8 *inAlbumData, INT32 inAlbumDataSize, UINT8 *outStatus)
+{
+ INT32 ret = 0;
+ INT32 size = 0;
+
+ if((NULL == inAlbumData) || (NULL == outStatus)){
+ return HVC_ERROR_PARAMETER;
+ }
+
+ /* Send Save Album signal command */
+ ret = HVC_SendCommandOfLoadAlbum(HVC_COM_LOAD_ALBUM, inAlbumDataSize, inAlbumData);
+ if ( ret != 0 ) return ret;
+
+ /* Receive header */
+ ret = HVC_ReceiveHeader(inTimeOutTime, &size, outStatus);
+ if ( ret != 0 ) return ret;
+
+ return ret;
+}
+
+/*----------------------------------------------------------------------------*/
+/* HVC_WriteAlbum */
+/* param : INT32 inTimeOutTime timeout time (ms) */
+/* : UINT8 *outStatus response code */
+/* return : INT32 execution result error code */
+/* : 0...normal */
+/* : -1...parameter error */
+/* : other...signal error */
+/*----------------------------------------------------------------------------*/
+INT32 HVC_WriteAlbum(INT32 inTimeOutTime, UINT8 *outStatus)
+{
+ INT32 ret = 0;
+ INT32 size = 0;
+
+ if(NULL == outStatus){
+ return HVC_ERROR_PARAMETER;
+ }
+
+ /* Send Write Album signal command */
+ ret = HVC_SendCommand(HVC_COM_WRITE_ALBUM, 0, NULL);
+ if ( ret != 0 ) return ret;
+
+ /* Receive header */
+ ret = HVC_ReceiveHeader(inTimeOutTime, &size, outStatus);
+ if ( ret != 0 ) return ret;
+
+ return ret;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HVC/HVCApi/HVCApi.h Tue Sep 05 10:01:51 2017 +0000
@@ -0,0 +1,174 @@
+/*---------------------------------------------------------------------------*/
+/* Copyright(C) 2017 OMRON Corporation */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
+/* See the License for the specific language governing permissions and */
+/* limitations under the License. */
+/*---------------------------------------------------------------------------*/
+
+/*
+ HVC Sample API
+*/
+
+#ifndef HVCApi_H__
+#define HVCApi_H__
+
+#ifndef UINT8
+typedef unsigned char UINT8; /* 8 bit Unsigned Integer */
+#endif /* UINT8 */
+#ifndef INT32
+typedef int INT32; /* 32 bit Signed Integer */
+#endif /* INT32 */
+#ifndef NULL
+ #define NULL 0
+#endif
+
+#include "HVCDef.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* HVC_GetVersion */
+/* param : INT32 inTimeOutTime timeout time (ms) */
+/* : HVC_VERSION *outVersion version data */
+/* : UINT8 *outStatus response code */
+INT32 HVC_GetVersion(INT32 inTimeOutTime, HVC_VERSION *outVersion, UINT8 *outStatus);
+
+/* HVC_SetCameraAngle */
+/* param : INT32 inTimeOutTime timeout time (ms) */
+/* : INT32 inAngleNo camera angle number */
+/* : UINT8 *outStatus response code */
+INT32 HVC_SetCameraAngle(INT32 inTimeOutTime, INT32 inAngleNo, UINT8 *outStatus);
+
+/* HVC_GetCameraAngle */
+/* param : INT32 inTimeOutTime timeout time (ms) */
+/* : INT32 *outAngleNo camera angle number */
+/* : UINT8 *outStatus response code */
+INT32 HVC_GetCameraAngle(INT32 inTimeOutTime, INT32 *outAngleNo, UINT8 *outStatus);
+
+/* HVC_Execute */
+/* param : INT32 inTimeOutTime timeout time (ms) */
+/* : INT32 inExec executable function */
+/* : INT32 inImage image output number */
+/* : HVC_RESULT *outHVCResult result data */
+/* : UINT8 *outStatus response code */
+INT32 HVC_Execute(INT32 inTimeOutTime, INT32 inExec, INT32 inImage, HVC_RESULT *outHVCResult, UINT8 *outStatus);
+
+/* HVC_ExecuteEx */
+/* param : INT32 inTimeOutTime timeout time (ms) */
+/* : INT32 inExec executable function */
+/* : INT32 inImage image output number */
+/* : HVC_RESULT *outHVCResult result data */
+/* : UINT8 *outStatus response code */
+INT32 HVC_ExecuteEx(INT32 inTimeOutTime, INT32 inExec, INT32 inImage, HVC_RESULT *outHVCResult, UINT8 *outStatus);
+
+/* HVC_SetThreshold */
+/* param : INT32 inTimeOutTime timeout time (ms) */
+/* : HVC_THRESHOLD *inThreshold threshold values */
+/* : UINT8 *outStatus response code */
+INT32 HVC_SetThreshold(INT32 inTimeOutTime, HVC_THRESHOLD *inThreshold, UINT8 *outStatus);
+
+/* HVC_GetThreshold */
+/* param : INT32 inTimeOutTime timeout time (ms) */
+/* : HVC_THRESHOLD *outThreshold threshold values */
+/* : UINT8 *outStatus response code */
+INT32 HVC_GetThreshold(INT32 inTimeOutTime, HVC_THRESHOLD *outThreshold, UINT8 *outStatus);
+
+/* HVC_SetSizeRange */
+/* param : INT32 inTimeOutTime timeout time (ms) */
+/* : HVC_SIZERANGE *inSizeRange detection sizes */
+/* : UINT8 *outStatus response code */
+INT32 HVC_SetSizeRange(INT32 inTimeOutTime, HVC_SIZERANGE *inSizeRange, UINT8 *outStatus);
+
+/* HVC_GetSizeRange */
+/* param : INT32 inTimeOutTime timeout time (ms) */
+/* : HVC_SIZERANGE *outSizeRange detection sizes */
+/* : UINT8 *outStatus response code */
+INT32 HVC_GetSizeRange(INT32 inTimeOutTime, HVC_SIZERANGE *outSizeRange, UINT8 *outStatus);
+
+/* HVC_SetFaceDetectionAngle */
+/* param : INT32 inTimeOutTime timeout time (ms) */
+/* : INT32 inPose Yaw angle range */
+/* : INT32 inAngle Roll angle range */
+/* : UINT8 *outStatus response code */
+INT32 HVC_SetFaceDetectionAngle(INT32 inTimeOutTime, INT32 inPose, INT32 inAngle, UINT8 *outStatus);
+
+/* HVC_GetFaceDetectionAngle */
+/* param : INT32 inTimeOutTime timeout time (ms) */
+/* : INT32 *outPose Yaw angle range */
+/* : INT32 *outAngle Roll angle range */
+/* : UINT8 *outStatus response code */
+INT32 HVC_GetFaceDetectionAngle(INT32 inTimeOutTime, INT32 *outPose, INT32 *outAngle, UINT8 *outStatus);
+
+/* HVC_SetBaudRate */
+/* param : INT32 inTimeOutTime timeout time (ms) */
+/* : INT32 inRate Baudrate */
+/* : UINT8 *outStatus response code */
+INT32 HVC_SetBaudRate(INT32 inTimeOutTime, INT32 inRate, UINT8 *outStatus);
+
+/* HVC_Registration */
+/* param : INT32 inTimeOutTime timeout time (ms) */
+/* : INT32 inUserID User ID (0-499) */
+/* : INT32 inDataID Data ID (0-9) */
+/* : HVC_IMAGE *outImage image info */
+/* : UINT8 *outStatus response code */
+INT32 HVC_Registration(INT32 inTimeOutTime, INT32 inUserID, INT32 inDataID, HVC_IMAGE *outImage, UINT8 *outStatus);
+
+/* HVC_DeleteData */
+/* param : INT32 inTimeOutTime timeout time (ms) */
+/* : INT32 inUserID User ID (0-499) */
+/* : INT32 inDataID Data ID (0-9) */
+/* : UINT8 *outStatus response code */
+INT32 HVC_DeleteData(INT32 inTimeOutTime, INT32 inUserID, INT32 inDataID, UINT8 *outStatus);
+
+/* HVC_DeleteUser */
+/* param : INT32 inTimeOutTime timeout time (ms) */
+/* : INT32 inUserID User ID (0-499) */
+/* : UINT8 *outStatus response code */
+INT32 HVC_DeleteUser(INT32 inTimeOutTime, INT32 inUserID, UINT8 *outStatus);
+
+/* HVC_DeleteAll */
+/* param : INT32 inTimeOutTime timeout time (ms) */
+/* : UINT8 *outStatus response code */
+INT32 HVC_DeleteAll(INT32 inTimeOutTime, UINT8 *outStatus);
+
+/* HVC_GetUserData */
+/* param : INT32 inTimeOutTime timeout time (ms) */
+/* : INT32 inUserID User ID (0-499) */
+/* : INT32 *outDataNo Registration Info */
+/* : UINT8 *outStatus response code */
+INT32 HVC_GetUserData(INT32 inTimeOutTime, INT32 inUserID, INT32 *outDataNo, UINT8 *outStatus);
+
+/* HVC_SaveAlbum */
+/* param : INT32 inTimeOutTime timeout time (ms) */
+/* : UINT8 *outAlbumData Album data */
+/* : INT32 *outAlbumDataSize Album data size */
+/* : UINT8 *outStatus response code */
+INT32 HVC_SaveAlbum(INT32 inTimeOutTime, UINT8 *outAlbumData, INT32 *outAlbumDataSize, UINT8 *outStatus);
+
+/* HVC_LoadAlbum */
+/* param : INT32 inTimeOutTime timeout time (ms) */
+/* : UINT8 *inAlbumData Album data */
+/* : INT32 inAlbumDataSize Album data size */
+/* : UINT8 *outStatus response code */
+INT32 HVC_LoadAlbum(INT32 inTimeOutTime, UINT8 *inAlbumData, INT32 inAlbumDataSize, UINT8 *outStatus);
+
+/* HVC_WriteAlbum */
+/* param : INT32 inTimeOutTime timeout time (ms) */
+/* : UINT8 *outStatus response code */
+INT32 HVC_WriteAlbum(INT32 inTimeOutTime, UINT8 *outStatus);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* HVCApi_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HVC/HVCApi/HVCDef.h Tue Sep 05 10:01:51 2017 +0000
@@ -0,0 +1,234 @@
+/*---------------------------------------------------------------------------*/
+/* Copyright(C) 2017 OMRON Corporation */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
+/* See the License for the specific language governing permissions and */
+/* limitations under the License. */
+/*---------------------------------------------------------------------------*/
+
+#ifndef HVCDef_H__
+#define HVCDef_H__
+
+/*----------------------------------------------------------------------------*/
+/* Execution flag */
+#define HVC_ACTIV_BODY_DETECTION 0x00000001
+#define HVC_ACTIV_HAND_DETECTION 0x00000002
+#define HVC_ACTIV_FACE_DETECTION 0x00000004
+#define HVC_ACTIV_FACE_DIRECTION 0x00000008
+#define HVC_ACTIV_AGE_ESTIMATION 0x00000010
+#define HVC_ACTIV_GENDER_ESTIMATION 0x00000020
+#define HVC_ACTIV_GAZE_ESTIMATION 0x00000040
+#define HVC_ACTIV_BLINK_ESTIMATION 0x00000080
+#define HVC_ACTIV_EXPRESSION_ESTIMATION 0x00000100
+#define HVC_ACTIV_FACE_RECOGNITION 0x00000200
+
+/* Image info of Execute command */
+#define HVC_EXECUTE_IMAGE_NONE 0x00000000
+#define HVC_EXECUTE_IMAGE_QVGA 0x00000001
+#define HVC_EXECUTE_IMAGE_QVGA_HALF 0x00000002
+
+/*----------------------------------------------------------------------------*/
+/* Error code */
+
+/* Parameter error */
+#define HVC_ERROR_PARAMETER -1
+
+/* Send signal timeout error */
+#define HVC_ERROR_SEND_DATA -10
+
+/* Receive header signal timeout error */
+#define HVC_ERROR_HEADER_TIMEOUT -20
+/* Invalid header error */
+#define HVC_ERROR_HEADER_INVALID -21
+/* Receive data signal timeout error */
+#define HVC_ERROR_DATA_TIMEOUT -22
+
+
+/*----------------------------------------------------------------------------*/
+/* Album data size */
+#define HVC_ALBUM_SIZE_MIN 32
+#define HVC_ALBUM_SIZE_MAX 816032
+
+/*----------------------------------------------------------------------------*/
+/* Expression */
+typedef enum {
+ EX_NEUTRAL = 1,
+ EX_HAPPINESS,
+ EX_SURPRISE,
+ EX_ANGER,
+ EX_SADNESS
+}EXPRESSION;
+
+/*----------------------------------------------------------------------------*/
+/* Struct */
+/*----------------------------------------------------------------------------*/
+/*----------------------------------------------------------------------------*/
+/* Devicefs model and version info */
+/*----------------------------------------------------------------------------*/
+typedef struct {
+ UINT8 string[12];
+ UINT8 major;
+ UINT8 minor;
+ UINT8 relese;
+ UINT8 revision[4];
+}HVC_VERSION;
+
+/*----------------------------------------------------------------------------*/
+/* Detection result */
+/*----------------------------------------------------------------------------*/
+typedef struct{
+ INT32 posX; /* Center x-coordinate */
+ INT32 posY; /* Center y-coordinate */
+ INT32 size; /* Size */
+ INT32 confidence; /* Degree of confidence */
+}DETECT_RESULT;
+
+/*----------------------------------------------------------------------------*/
+/* Face direction */
+/*----------------------------------------------------------------------------*/
+typedef struct{
+ INT32 yaw; /* Yaw angle */
+ INT32 pitch; /* Pitch angle */
+ INT32 roll; /* Roll angle */
+ INT32 confidence; /* Degree of confidence */
+}DIR_RESULT;
+
+/*----------------------------------------------------------------------------*/
+/* Age */
+/*----------------------------------------------------------------------------*/
+typedef struct{
+ INT32 age; /* Age */
+ INT32 confidence; /* Degree of confidence */
+}AGE_RESULT;
+
+/*----------------------------------------------------------------------------*/
+/* Gender */
+/*----------------------------------------------------------------------------*/
+typedef struct{
+ INT32 gender; /* Gender */
+ INT32 confidence; /* Degree of confidence */
+}GENDER_RESULT;
+
+/*----------------------------------------------------------------------------*/
+/* Gaze */
+/*----------------------------------------------------------------------------*/
+typedef struct{
+ INT32 gazeLR; /* Yaw angle */
+ INT32 gazeUD; /* Pitch angle */
+}GAZE_RESULT;
+
+/*----------------------------------------------------------------------------*/
+/* Blink */
+/*----------------------------------------------------------------------------*/
+typedef struct{
+ INT32 ratioL; /* Left eye blink result */
+ INT32 ratioR; /* Right eye blink result */
+}BLINK_RESULT;
+
+/*----------------------------------------------------------------------------*/
+/* Expression */
+/*----------------------------------------------------------------------------*/
+typedef struct{
+ INT32 topExpression; /* Top expression */
+ INT32 topScore; /* Top score */
+ INT32 score[5]; /* Score of 5 expression */
+ INT32 degree; /* Negative-positive degree */
+}EXPRESSION_RESULT;
+
+/*----------------------------------------------------------------------------*/
+/* Face Recognition */
+/*----------------------------------------------------------------------------*/
+typedef struct{
+ INT32 uid; /* User ID */
+ INT32 confidence; /* Degree of confidence */
+}RECOGNITION_RESULT;
+
+/*----------------------------------------------------------------------------*/
+/* Face Detection & Estimations result */
+/*----------------------------------------------------------------------------*/
+typedef struct{
+ DETECT_RESULT dtResult; /* Face detection result */
+ DIR_RESULT dirResult; /* Face direction estimation result */
+ AGE_RESULT ageResult; /* Age Estimation result */
+ GENDER_RESULT genderResult; /* Gender Estimation result */
+ GAZE_RESULT gazeResult; /* Gaze Estimation result */
+ BLINK_RESULT blinkResult; /* Blink Estimation result */
+ EXPRESSION_RESULT expressionResult; /* Expression Estimation result */
+ RECOGNITION_RESULT recognitionResult; /* Face Recognition result */
+}FACE_RESULT;
+
+/*----------------------------------------------------------------------------*/
+/* Human Body Detection results */
+/*----------------------------------------------------------------------------*/
+typedef struct{
+ UINT8 num; /* Number of Detection */
+ DETECT_RESULT bdResult[35]; /* Detection result */
+}BD_RESULT;
+
+/*----------------------------------------------------------------------------*/
+/* Hand Detection results */
+/*----------------------------------------------------------------------------*/
+typedef struct{
+ UINT8 num; /* Number of Detection */
+ DETECT_RESULT hdResult[35]; /* Detection result */
+}HD_RESULT;
+
+/*----------------------------------------------------------------------------*/
+/* Face Detection & Estimations results */
+/*----------------------------------------------------------------------------*/
+typedef struct{
+ UINT8 num; /* Number of Detection */
+ FACE_RESULT fcResult[35]; /* Detection & Estimations result */
+}FD_RESULT;
+
+/*----------------------------------------------------------------------------*/
+/* Image data */
+/*----------------------------------------------------------------------------*/
+typedef struct{
+ INT32 width;
+ INT32 height;
+ UINT8 image[320*240];
+}HVC_IMAGE;
+
+/*----------------------------------------------------------------------------*/
+/* Eesult data of Execute command */
+/*----------------------------------------------------------------------------*/
+typedef struct{
+ INT32 executedFunc; /* Execution flag */
+ BD_RESULT bdResult; /* Human Body Detection results */
+ HD_RESULT hdResult; /* Hand Detection results */
+ FD_RESULT fdResult; /* Face Detection & Estimations results */
+ HVC_IMAGE image; /* Image data */
+}HVC_RESULT;
+
+/*----------------------------------------------------------------------------*/
+/* Threshold of confidence */
+/*----------------------------------------------------------------------------*/
+typedef struct{
+ INT32 bdThreshold; /* Threshold of confidence of Human Body Detection */
+ INT32 hdThreshold; /* Threshold of confidence of Hand Detection */
+ INT32 dtThreshold; /* Threshold of confidence of Face Detection */
+ INT32 rsThreshold; /* Threshold of confidence of Face Recognition */
+}HVC_THRESHOLD;
+
+/*----------------------------------------------------------------------------*/
+/* Detection size */
+/*----------------------------------------------------------------------------*/
+typedef struct{
+ INT32 bdMinSize; /* Minimum detection size of Human Body Detection */
+ INT32 bdMaxSize; /* Maximum detection size of Human Body Detection */
+ INT32 hdMinSize; /* Minimum detection size of Hand Detection */
+ INT32 hdMaxSize; /* Maximum detection size of Hand Detection */
+ INT32 dtMinSize; /* Minimum detection size of Face Detection */
+ INT32 dtMaxSize; /* Maximum detection size of Face Detection */
+}HVC_SIZERANGE;
+
+#endif /* HVCDef_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HVC/HVCApi/HVCExtraUartFunc.h Tue Sep 05 10:01:51 2017 +0000
@@ -0,0 +1,49 @@
+/*---------------------------------------------------------------------------*/
+/* Copyright(C) 2017 OMRON Corporation */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
+/* See the License for the specific language governing permissions and */
+/* limitations under the License. */
+/*---------------------------------------------------------------------------*/
+
+/*
+ External UART-function definition
+*/
+
+#ifndef HVCExtraUartFunc_H__
+#define HVCExtraUartFunc_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*----------------------------------------------------------------------------*/
+/* UART send signal */
+/* param : int inDataSize send signal data */
+/* : UINT8 *inData data length */
+/* return : int send signal complete data number */
+/*----------------------------------------------------------------------------*/
+extern int UART_SendData(int inDataSize, UINT8 *inData);
+
+/*----------------------------------------------------------------------------*/
+/* UART receive signal */
+/* param : int inTimeOutTime timeout time (ms) */
+/* : int *inDataSize receive signal data size */
+/* : UINT8 *outResult receive signal data */
+/* return : int receive signal complete data number */
+/*----------------------------------------------------------------------------*/
+extern int UART_ReceiveData(int inTimeOutTime, int inDataSize, UINT8 *outResult);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* HVCExtraUartFunc_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HVC/STBApi/STBWrap.c Tue Sep 05 10:01:51 2017 +0000
@@ -0,0 +1,236 @@
+/*---------------------------------------------------------------------------*/
+/* Copyright(C) 2017 OMRON Corporation */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
+/* See the License for the specific language governing permissions and */
+/* limitations under the License. */
+/*---------------------------------------------------------------------------*/
+
+/*
+ STB Sample API
+*/
+
+#include <stdlib.h>
+#include "STBWrap.h"
+
+#pragma comment(lib, "STB.lib")
+
+#define STB_MAX_NUM 35
+
+static HSTB m_Handle;
+static int m_nFaceCount;
+static STB_FACE m_Face[STB_MAX_NUM];
+static int m_nBodyCount;
+static STB_BODY m_Body[STB_MAX_NUM];
+
+
+int STB_Init(int inFuncFlag)
+{
+ if(NULL != m_Handle){
+ STB_DeleteHandle(m_Handle);
+ m_Handle = NULL;
+ }
+
+ m_Handle = STB_CreateHandle(inFuncFlag);
+ if(NULL == m_Handle){
+ return STB_ERR_INITIALIZE;
+ }
+ return STB_NORMAL;
+}
+
+void STB_Final(void)
+{
+ if(NULL != m_Handle){
+ STB_DeleteHandle(m_Handle);
+ m_Handle = NULL;
+ }
+}
+
+int STB_Exec(int inActiveFunc, const HVC_RESULT *inResult, int *pnSTBFaceCount, STB_FACE **pSTBFaceResult, int *pnSTBBodyCount, STB_BODY **pSTBBodyResult)
+{
+ int ret;
+ STB_FRAME_RESULT frameRes;
+
+ m_nFaceCount = 0;
+ m_nBodyCount = 0;
+ GetFrameResult(inActiveFunc, inResult, &frameRes);
+ do{
+ // Set frame information (Detection Result)
+ ret = STB_SetFrameResult(m_Handle, &frameRes);
+ if(STB_NORMAL != ret){
+ break;
+ }
+
+ // STB Execution
+ ret = STB_Execute(m_Handle);
+ if(STB_NORMAL != ret){
+ break;
+ }
+
+ // Get STB Result
+ ret = STB_GetFaces(m_Handle, (STB_UINT32 *)&m_nFaceCount, m_Face);
+ if(STB_NORMAL != ret){
+ break;
+ }
+
+ ret = STB_GetBodies(m_Handle, (STB_UINT32 *)&m_nBodyCount, m_Body);
+ if(STB_NORMAL != ret){
+ break;
+ }
+ }while(0);
+
+ *pnSTBFaceCount = m_nFaceCount;
+ *pSTBFaceResult = m_Face;
+ *pnSTBBodyCount = m_nBodyCount;
+ *pSTBBodyResult = m_Body;
+ return ret;
+}
+
+int STB_Clear(void)
+{
+ return STB_ClearFrameResults(m_Handle);
+}
+
+int STB_SetTrParam(int inRetryCount, int inStbPosParam, int inStbSizeParam)
+{
+ int ret;
+ do{
+ ret = STB_SetTrRetryCount(m_Handle, inRetryCount);
+ if(STB_NORMAL != ret){
+ break;
+ }
+
+ ret = STB_SetTrSteadinessParam(m_Handle, inStbPosParam, inStbSizeParam);
+ }while(0);
+
+ return ret;
+}
+
+int STB_SetPeParam(int inThreshold, int inUDAngleMin, int inUDAngleMax, int inLRAngleMin, int inLRAngleMax, int inCompCount)
+{
+ int ret;
+ do{
+ ret = STB_SetPeThresholdUse(m_Handle, inThreshold);
+ if(STB_NORMAL != ret){
+ break;
+ }
+
+ ret = STB_SetPeAngleUse(m_Handle, inUDAngleMin, inUDAngleMax, inLRAngleMin, inLRAngleMax);
+ if(STB_NORMAL != ret){
+ break;
+ }
+
+ ret = STB_SetPeCompleteFrameCount(m_Handle, inCompCount);
+ }while(0);
+
+ return ret;
+}
+
+int STB_SetFrParam(int inThreshold, int inUDAngleMin, int inUDAngleMax, int inLRAngleMin, int inLRAngleMax, int inCompCount, int inRatio)
+{
+ int ret;
+ do{
+ ret = STB_SetFrThresholdUse(m_Handle, inThreshold);
+ if(STB_NORMAL != ret){
+ break;
+ }
+
+ ret = STB_SetFrAngleUse(m_Handle, inUDAngleMin, inUDAngleMax, inLRAngleMin, inLRAngleMax);
+ if(STB_NORMAL != ret){
+ break;
+ }
+
+ ret = STB_SetFrCompleteFrameCount(m_Handle, inCompCount);
+ if(STB_NORMAL != ret){
+ break;
+ }
+
+ ret = STB_SetFrMinRatio(m_Handle, inRatio);
+ }while(0);
+
+ return ret;
+}
+
+
+
+static void GetFrameResult(int inActiveFunc, const HVC_RESULT *inResult, STB_FRAME_RESULT *outFrameResult)
+{
+ int i;
+
+ // Body Detection
+ outFrameResult->bodys.nCount = inResult->bdResult.num;
+ if(inActiveFunc & HVC_ACTIV_BODY_DETECTION){
+ for(i = 0; i < inResult->bdResult.num; i++){
+ DETECT_RESULT dtRes = inResult->bdResult.bdResult[i];
+ outFrameResult->bodys.body[i].center.nX = dtRes.posX;
+ outFrameResult->bodys.body[i].center.nY = dtRes.posY;
+ outFrameResult->bodys.body[i].nSize = dtRes.size;
+ outFrameResult->bodys.body[i].nConfidence = dtRes.confidence;
+ }
+ }
+
+ outFrameResult->faces.nCount = inResult->fdResult.num;
+ for(i = 0; i < inResult->fdResult.num; i++){
+ // Face Detection
+ if(inActiveFunc & HVC_ACTIV_FACE_DETECTION){
+ DETECT_RESULT dtRes = inResult->fdResult.fcResult[i].dtResult;
+ outFrameResult->faces.face[i].center.nX = dtRes.posX;
+ outFrameResult->faces.face[i].center.nY = dtRes.posY;
+ outFrameResult->faces.face[i].nSize = dtRes.size;
+ outFrameResult->faces.face[i].nConfidence = dtRes.confidence;
+ }
+
+ // Face Direction
+ if(inActiveFunc & HVC_ACTIV_FACE_DIRECTION){
+ DIR_RESULT dirRes = inResult->fdResult.fcResult[i].dirResult;
+ outFrameResult->faces.face[i].direction.nUD = dirRes.pitch;
+ outFrameResult->faces.face[i].direction.nLR = dirRes.yaw;
+ outFrameResult->faces.face[i].direction.nRoll = dirRes.roll;
+ outFrameResult->faces.face[i].direction.nConfidence = dirRes.confidence;
+ } else {
+ outFrameResult->faces.face[i].direction.nUD = 0;
+ outFrameResult->faces.face[i].direction.nLR = 0;
+ outFrameResult->faces.face[i].direction.nRoll = 0;
+ outFrameResult->faces.face[i].direction.nConfidence = 0;
+ }
+
+ // Age
+ if(inActiveFunc & HVC_ACTIV_AGE_ESTIMATION){
+ AGE_RESULT ageRes = inResult->fdResult.fcResult[i].ageResult;
+ outFrameResult->faces.face[i].age.nAge = ageRes.age;
+ outFrameResult->faces.face[i].age.nConfidence = ageRes.confidence;
+ } else {
+ outFrameResult->faces.face[i].age.nAge = -128;
+ outFrameResult->faces.face[i].age.nConfidence = -128;
+ }
+
+ // Gender
+ if(inActiveFunc & HVC_ACTIV_GENDER_ESTIMATION){
+ GENDER_RESULT genderRes = inResult->fdResult.fcResult[i].genderResult;
+ outFrameResult->faces.face[i].gender.nGender = genderRes.gender;
+ outFrameResult->faces.face[i].gender.nConfidence = genderRes.confidence;
+ } else {
+ outFrameResult->faces.face[i].gender.nGender = -128;
+ outFrameResult->faces.face[i].gender.nConfidence = -128;
+ }
+
+ // FØ
+ if(inActiveFunc & HVC_ACTIV_FACE_RECOGNITION){
+ RECOGNITION_RESULT recogRes = inResult->fdResult.fcResult[i].recognitionResult;
+ outFrameResult->faces.face[i].recognition.nUID = recogRes.uid;
+ outFrameResult->faces.face[i].recognition.nScore = recogRes.confidence;
+ } else {
+ outFrameResult->faces.face[i].recognition.nUID = -128;
+ outFrameResult->faces.face[i].recognition.nScore = -128;
+ }
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HVC/STBApi/STBWrap.h Tue Sep 05 10:01:51 2017 +0000
@@ -0,0 +1,51 @@
+/*---------------------------------------------------------------------------*/
+/* Copyright(C) 2017 OMRON Corporation */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
+/* See the License for the specific language governing permissions and */
+/* limitations under the License. */
+/*---------------------------------------------------------------------------*/
+
+/*
+ HVC Sample API
+*/
+
+#ifndef STBWrap_H__
+#define STBWrap_H__
+
+#include "STBAPI.h"
+#include "STBCommonDef.h"
+
+#include "HVCApi.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int STB_Init(int inFuncFlag);
+void STB_Final(void);
+
+int STB_Exec(int inActiveFunc, const HVC_RESULT *inResult, int *pnSTBFaceCount, STB_FACE **pSTBFaceResult, int *pnSTBBodyCount, STB_BODY **pSTBBodyResult);
+
+int STB_Clear(void);
+
+int STB_SetTrParam(int inRetryCount, int inStbPosParam, int inStbSizeParam);
+int STB_SetPeParam(int inThreshold, int inUDAngleMin, int inUDAngleMax, int inLRAngleMin, int inLRAngleMax, int inCompCount);
+int STB_SetFrParam(int inThreshold, int inUDAngleMin, int inUDAngleMax, int inLRAngleMin, int inLRAngleMax, int inCompCount, int inRatio);
+
+static void GetFrameResult(int inActiveFunc, const HVC_RESULT *inResult, STB_FRAME_RESULT *outFrameResult);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* STBWrap_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HVC/STBLib/src/STB/Interface.c Tue Sep 05 10:01:51 2017 +0000
@@ -0,0 +1,1002 @@
+/*---------------------------------------------------------------------------*/
+/* Copyright(C) 2017 OMRON Corporation */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
+/* See the License for the specific language governing permissions and */
+/* limitations under the License. */
+/*---------------------------------------------------------------------------*/
+
+#include "Interface.h"
+#include "STBValidValue.h"
+#include "STBCommonDef.h"
+#include "STBTracking.h"
+#include "STBFaceInfo.h"
+#include "STBMakeResult.h"
+
+
+/*Value range check*/
+#define ISVALID_RANGE( val , min , max ) ( ( (min) <= (val) ) && ( (val) <= (max) ) )
+
+
+/*------------------------------------------------------------------------------------------------------------------*/
+/*IsValidValue : error check*/
+/*------------------------------------------------------------------------------------------------------------------*/
+static STB_INT32 IsValidValue(
+ const STB_INT32 nValue ,
+ const STB_INT32 nLimitMin ,
+ const STB_INT32 nLimitMax )
+{
+ STB_INT32 nRet;
+ for( nRet = STB_ERR_INVALIDPARAM; nRet != STB_NORMAL; nRet = STB_NORMAL )
+ {
+ if( ! ISVALID_RANGE( nValue , nLimitMin , nLimitMax ) )
+ {
+ break;
+ }
+ }
+ return nRet;
+}
+/*------------------------------------------------------------------------------------------------------------------*/
+/* IsValidPointer */
+/*------------------------------------------------------------------------------------------------------------------*/
+static STB_INT32 IsValidPointer( const VOID* pPointer )
+{
+ STB_INT32 nRet;
+ for( nRet = STB_ERR_INVALIDPARAM; nRet != STB_NORMAL; nRet = STB_NORMAL )
+ {
+ if( NULL == pPointer ){ break; }
+ }
+ return nRet;
+}
+
+/*------------------------------------------------------------------------------------------------------------------*/
+/* GetVersion */
+/* Interface between SDK layer and functional layer */
+/* Responsible for error check and function call */
+/*------------------------------------------------------------------------------------------------------------------*/
+STB_INT32 GetVersion( STB_INT8* pnMajorVersion , STB_INT8* pnMinorVersion ){
+ STB_INT32 nRet;
+
+ for( nRet = STB_ERR_INVALIDPARAM; nRet != STB_NORMAL; nRet = STB_NORMAL )
+ {
+ nRet = IsValidPointer( pnMajorVersion );
+ if( STB_NORMAL != nRet )
+ {
+ break;
+ }
+ nRet = IsValidPointer( pnMinorVersion );
+ if( STB_NORMAL != nRet )
+ {
+ break;
+ }
+ *pnMajorVersion = VERSION_MAJOR;
+ *pnMinorVersion = VERSION_MINOR;
+ }
+
+ return nRet;
+}
+/*------------------------------------------------------------------------------------------------------------------*/
+/* CalcStbSize */
+/*------------------------------------------------------------------------------------------------------------------*/
+STB_UINT32 CalcStbSize ( STBExecFlg *execFlg , STB_UINT32 nTraCntMax)
+{
+ STB_UINT32 retVal ;
+
+ retVal = 0 ;
+
+ retVal += 100 ;///Margin : alignment
+
+
+
+
+ retVal += sizeof( STB_TR_DET );//wSrcTr
+ if( execFlg->bodyTr == STB_TRUE )
+ {
+ retVal += sizeof( TraObj ) * nTraCntMax ; // trBody
+ retVal += sizeof( ROI_DET ) * nTraCntMax ; // wSrcTr->bdDet
+ retVal += sizeof( STB_TR_RES_BODYS ) ; // wDstTrBody
+ retVal += sizeof( STB_TR_RES ) * nTraCntMax ; // wDstTrBody->body
+ }
+ if( execFlg->faceTr == STB_TRUE )
+ {
+ retVal += sizeof( TraObj ) * nTraCntMax ; // trFace
+ retVal += sizeof( ROI_DET ) * nTraCntMax ; // wSrcTr->fcDet
+ retVal += sizeof( STB_TR_RES_FACES ) ; // wDstTrFace
+ retVal += sizeof( STB_TR_RES ) * nTraCntMax ; // wDstTrFace->face
+ }
+ if( execFlg->gen == STB_TRUE
+ || execFlg->age == STB_TRUE
+ || execFlg->fr == STB_TRUE
+ || execFlg->exp == STB_TRUE
+ || execFlg->dir == STB_TRUE
+ || execFlg->gaz == STB_TRUE
+ || execFlg->bli == STB_TRUE
+ )
+ {
+ retVal += sizeof( FaceObj ) * nTraCntMax ; // infoFace
+ }
+
+
+ if( execFlg->gen == STB_TRUE
+ || execFlg->age == STB_TRUE
+ //|| execFlg->fr == STB_TRUE
+ || execFlg->exp == STB_TRUE
+ || execFlg->dir == STB_TRUE
+ || execFlg->gaz == STB_TRUE
+ || execFlg->bli == STB_TRUE
+ )
+ {
+ retVal += sizeof( STB_PE_DET ) ; // wSrcPe
+ retVal += sizeof( FACE_DET ) * nTraCntMax ; // wSrcPe->fcDet
+ retVal += sizeof( STB_PE_RES ) ; // wDstPe
+ retVal += sizeof( STB_PE_FACE ) * nTraCntMax ; // wDstPe->peFace
+
+ }
+
+ if( execFlg->fr == STB_TRUE )
+ {
+ retVal += sizeof( STB_FR_DET ) ; // wSrcFr
+ retVal += sizeof( FR_DET ) * nTraCntMax ; // wSrcFr->fcDet
+ retVal += sizeof( STB_FR_RES ) ; // wDstFr
+ retVal += sizeof( FR_RES ) * nTraCntMax ; // wDstFr->frFace
+ }
+
+
+ return retVal;
+}
+/*------------------------------------------------------------------------------------------------------------------*/
+/* ShareStbSize */
+/*------------------------------------------------------------------------------------------------------------------*/
+void ShareStbSize ( STBHANDLE handle , STB_INT8 *stbPtr )
+{
+ STB_UINT32 nTraCntMax;
+
+ nTraCntMax = handle->nTraCntMax;
+
+
+ handle->wSrcTr = (STB_TR_DET*)stbPtr; stbPtr += ( sizeof( STB_TR_DET ) );
+ if( handle->execFlg->bodyTr == STB_TRUE )
+ {
+ handle->trBody = ( TraObj* ) stbPtr; stbPtr += ( sizeof( TraObj ) * nTraCntMax );
+ handle->wSrcTr->bdDet = ( ROI_DET* ) stbPtr; stbPtr += ( sizeof( ROI_DET ) * nTraCntMax );
+ handle->wDstTrBody = ( STB_TR_RES_BODYS* ) stbPtr; stbPtr += ( sizeof( STB_TR_RES_BODYS ));
+ handle->wDstTrBody->body = ( STB_TR_RES* ) stbPtr; stbPtr += ( sizeof( STB_TR_RES ) * nTraCntMax );
+ }
+ if( handle->execFlg->faceTr == STB_TRUE )
+ {
+ handle->trFace = ( TraObj* ) stbPtr; stbPtr += ( sizeof( TraObj ) * nTraCntMax );
+ handle->wSrcTr->fcDet = ( ROI_DET* ) stbPtr; stbPtr += ( sizeof( ROI_DET ) * nTraCntMax );
+ handle->wDstTrFace = ( STB_TR_RES_FACES* ) stbPtr; stbPtr += ( sizeof( STB_TR_RES_FACES ));
+ handle->wDstTrFace->face = ( STB_TR_RES* ) stbPtr; stbPtr += ( sizeof( STB_TR_RES ) * nTraCntMax );
+ }
+
+ if( handle->execFlg->gen == STB_TRUE
+ || handle->execFlg->age == STB_TRUE
+ || handle->execFlg->fr == STB_TRUE
+ || handle->execFlg->exp == STB_TRUE
+ || handle->execFlg->dir == STB_TRUE
+ || handle->execFlg->gaz == STB_TRUE
+ || handle->execFlg->bli == STB_TRUE
+ )
+ {
+ handle->infoFace = ( FaceObj* ) stbPtr; stbPtr += ( sizeof( FaceObj ) * nTraCntMax );
+ }
+
+ if( handle->execFlg->gen == STB_TRUE
+ || handle->execFlg->age == STB_TRUE
+ //||| handle->execFlg->fr == STB_TRUE
+ || handle->execFlg->exp == STB_TRUE
+ || handle->execFlg->dir == STB_TRUE
+ || handle->execFlg->gaz == STB_TRUE
+ || handle->execFlg->bli == STB_TRUE
+ )
+ {
+ handle->wSrcPe = ( STB_PE_DET* ) stbPtr; stbPtr += ( sizeof( STB_PE_DET ) );
+ handle->wSrcPe->fcDet = ( FACE_DET* ) stbPtr; stbPtr += ( sizeof( FACE_DET ) * nTraCntMax );
+ handle->wDstPe = ( STB_PE_RES* ) stbPtr; stbPtr += ( sizeof( STB_PE_RES ) );
+ handle->wDstPe->peFace = ( STB_PE_FACE*) stbPtr; stbPtr += ( sizeof( STB_PE_FACE) * nTraCntMax );
+ }
+
+ if( handle->execFlg->fr == STB_TRUE )
+ {
+ handle->wSrcFr = ( STB_FR_DET* ) stbPtr; stbPtr += ( sizeof( STB_FR_DET ) );
+ handle->wSrcFr->fcDet = ( FR_DET* ) stbPtr; stbPtr += ( sizeof( FR_DET ) * nTraCntMax );
+ handle->wDstFr = ( STB_FR_RES* ) stbPtr; stbPtr += ( sizeof( STB_FR_RES ) );
+ handle->wDstFr->frFace = ( FR_RES* ) stbPtr; stbPtr += ( sizeof( FR_RES ) * nTraCntMax );
+ }
+
+
+}
+/*------------------------------------------------------------------------------------------------------------------*/
+/*Create handle*/
+/*------------------------------------------------------------------------------------------------------------------*/
+STBHANDLE CreateHandle ( STB_UINT32 stbExecFlg )
+{
+
+ STBHANDLE handle;
+ STB_UINT32 tmpVal;
+ STB_UINT32 tmpFLG;
+
+
+
+ /*do STB handle's malloc here*/
+ handle = NULL ;
+ handle = ( STBHANDLE )malloc( sizeof( *handle ) );
+ if( handle == NULL )
+ {
+ return NULL;/* FAIL : Create STB handle */
+ }
+
+ /* ExecFlg */
+ handle->execFlg = ( STBExecFlg* )malloc( sizeof( STBExecFlg ) );
+ if( handle->execFlg == NULL )
+ {
+ free ( handle ) ;/*Free of Malloc things at the present time*/
+ return NULL ;/* FAIL : Create STB handle ExecFlg */
+ }
+ if( ( stbExecFlg & STB_FUNC_BD )== STB_FUNC_BD ){ handle->execFlg->bodyTr = STB_TRUE ;}else{ handle->execFlg->bodyTr = STB_FALSE ;}
+ if( ( stbExecFlg & STB_FUNC_DT )== STB_FUNC_DT ){ handle->execFlg->faceTr = STB_TRUE ;}else{ handle->execFlg->faceTr = STB_FALSE ;}
+ if( ( stbExecFlg & STB_FUNC_PT )== STB_FUNC_PT ){ handle->execFlg->dir = STB_TRUE ;}else{ handle->execFlg->dir = STB_FALSE ;}
+ if( ( stbExecFlg & STB_FUNC_AG )== STB_FUNC_AG ){ handle->execFlg->age = STB_TRUE ;}else{ handle->execFlg->age = STB_FALSE ;}
+ if( ( stbExecFlg & STB_FUNC_GN )== STB_FUNC_GN ){ handle->execFlg->gen = STB_TRUE ;}else{ handle->execFlg->gen = STB_FALSE ;}
+ if( ( stbExecFlg & STB_FUNC_GZ )== STB_FUNC_GZ ){ handle->execFlg->gaz = STB_TRUE ;}else{ handle->execFlg->gaz = STB_FALSE ;}
+ if( ( stbExecFlg & STB_FUNC_BL )== STB_FUNC_BL ){ handle->execFlg->bli = STB_TRUE ;}else{ handle->execFlg->bli = STB_FALSE ;}
+ if( ( stbExecFlg & STB_FUNC_EX )== STB_FUNC_EX ){ handle->execFlg->exp = STB_TRUE ;}else{ handle->execFlg->exp = STB_FALSE ;}
+ if( ( stbExecFlg & STB_FUNC_FR )== STB_FUNC_FR ){ handle->execFlg->fr = STB_TRUE ;}else{ handle->execFlg->fr = STB_FALSE ;}
+ handle->execFlg->pet = STB_FALSE ;
+ handle->execFlg->hand = STB_FALSE ;
+
+
+ if( handle->execFlg->faceTr == STB_FALSE )
+ {
+ if( handle->execFlg->gen == STB_TRUE
+ || handle->execFlg->age == STB_TRUE
+ || handle->execFlg->fr == STB_TRUE
+ || handle->execFlg->exp == STB_TRUE
+ || handle->execFlg->dir == STB_TRUE
+ || handle->execFlg->gaz == STB_TRUE
+ || handle->execFlg->bli == STB_TRUE
+ )
+ {
+ free ( handle->execFlg );/*Free of Malloc things at the present time*/
+ free ( handle );/*Free of Malloc things at the present time*/
+ return NULL ;/*Invalid input parameter stbExecFlg*/
+ }
+ }
+
+
+ /*Setting the initial value here.*/
+ handle->nTraCntBody = 0;
+ handle->nTraCntFace = 0;
+ handle->nDetCntMax = DETECT_CNT_MAX ;/*A maximum number of detected(input) people*/
+ handle->nTraCntMax = TRACK_CNT_MAX ;/*A maximum number of tracking(output) people*/
+ handle->nExecuted = STB_FALSE ;
+ handle->nInitialized= STB_FALSE ;
+ handle->nDetCntBody = 0;
+ handle->nDetCntFace = 0;
+ handle->trFace = NULL;
+ handle->trBody = NULL;
+ handle->infoFace = NULL;
+ handle->wSrcTr = NULL;
+ handle->wDstTrFace = NULL;
+ handle->wDstTrBody = NULL;
+ handle->wSrcPe = NULL;
+ handle->wDstPe = NULL;
+ handle->wSrcFr = NULL;
+ handle->wDstFr = NULL;
+
+
+ /* Do Malloc to things that need Malloc in STB handle */
+ handle->stbPtr = NULL ;
+ handle->hTrHandle = NULL ;
+ handle->hPeHandle = NULL ;
+ handle->hFrHandle = NULL ;
+ tmpVal = CalcStbSize ( handle->execFlg ,handle->nTraCntMax ); /*calculate necessary amount in the STB handle*/
+ handle->stbPtr = ( STB_INT8 * )malloc( tmpVal ) ; /*keep necessary amount in the STB handle*/
+ if( handle->stbPtr == NULL )
+ {
+ free ( handle->execFlg );/*Free of Malloc things at the present time*/
+ free ( handle );/*Free of Malloc things at the present time*/
+ return NULL ;
+ }
+ ShareStbSize ( handle, handle->stbPtr); /* Malloc-area is allocated to things that need Malloc in STB handle */
+
+ /*Create handles for child functions*/
+ tmpFLG = STB_TRUE;
+ if( handle->execFlg->bodyTr == STB_TRUE
+ || handle->execFlg->faceTr == STB_TRUE
+ )
+ {
+ handle->hTrHandle = STB_Tr_CreateHandle( handle->execFlg ,handle->nDetCntMax, handle->nTraCntMax );
+ if( handle->hTrHandle == NULL ){ tmpFLG = STB_FALSE; }
+ }
+ if( handle->execFlg->gen == STB_TRUE
+ || handle->execFlg->age == STB_TRUE
+ //|| handle->execFlg->fr == STB_TRUE
+ || handle->execFlg->exp == STB_TRUE
+ || handle->execFlg->dir == STB_TRUE
+ || handle->execFlg->gaz == STB_TRUE
+ || handle->execFlg->bli == STB_TRUE
+ )
+ {
+ handle->hPeHandle = STB_Pe_CreateHandle( handle->execFlg ,handle->nTraCntMax );
+ if( handle->hPeHandle == NULL ){ tmpFLG = STB_FALSE; }
+ }
+ if( handle->execFlg->fr == STB_TRUE )
+ {
+ handle->hFrHandle = STB_Fr_CreateHandle( handle->nTraCntMax );
+ if( handle->hFrHandle == NULL ){ tmpFLG = STB_FALSE; }
+ }
+
+ if( tmpFLG == STB_FALSE )
+ {
+ /*When Malloc failed, Free of Malloc data at the present time*/
+ if( handle->hTrHandle != NULL ) { STB_Tr_DeleteHandle ( handle->hTrHandle ) ;}
+ if( handle->hPeHandle != NULL ) { STB_Pe_DeleteHandle ( handle->hPeHandle ) ;}
+ if( handle->hFrHandle != NULL ) { STB_Fr_DeleteHandle ( handle->hFrHandle ) ;}
+ if( handle->stbPtr != NULL ) { free ( handle->stbPtr ) ;}/*Free of Malloc things at the present time*/
+ if( handle->execFlg != NULL ) { free ( handle->execFlg ) ;}/*Free of Malloc things at the present time*/
+ if( handle != NULL ) { free ( handle ) ;}/*Free of Malloc things at the present time*/
+ return NULL;
+ }
+
+ return handle;
+}
+//-------------------------------------------------------------------------------------------------------------------
+// DeleteHandle /*Delete handle*/
+//-------------------------------------------------------------------------------------------------------------------
+STB_INT32 DeleteHandle(STBHANDLE handle)
+{
+
+ STB_INT32 nRet;
+
+ /*NULL check*/
+ nRet = IsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+
+ /*Malloc things here, do free*/
+ if( handle->hTrHandle != NULL ) { STB_Tr_DeleteHandle ( handle->hTrHandle ) ;}
+ if( handle->hPeHandle != NULL ) { STB_Pe_DeleteHandle ( handle->hPeHandle ) ;}
+ if( handle->hFrHandle != NULL ) { STB_Fr_DeleteHandle ( handle->hFrHandle ) ;}
+ if( handle->stbPtr != NULL ) { free ( handle->stbPtr ) ;}
+ if( handle->execFlg != NULL ) { free ( handle->execFlg ) ;}
+ if( handle != NULL ) { free ( handle ) ;}
+
+
+
+ return STB_NORMAL;
+}
+/*------------------------------------------------------------------------------------------------------------------*/
+/* SetFrameResult : Get the result of stbINPUT */
+/*------------------------------------------------------------------------------------------------------------------*/
+STB_INT32 SetFrameResult ( STBHANDLE handle , const STB_FRAME_RESULT *stbINPUTResult )
+{
+
+ STB_INT32 nRet;
+
+ /*NULL check*/
+ nRet = IsValidPointer(handle);
+ if(nRet != STB_NORMAL)
+ {
+ return STB_ERR_NOHANDLE;
+ }
+
+ nRet = IsValidPointer(stbINPUTResult);
+ if(nRet != STB_NORMAL)
+ {
+ return STB_ERR_INVALIDPARAM;
+ }
+
+
+ /*Input value check*/
+ nRet = STB_IsValidValue ( stbINPUTResult ,handle->execFlg );
+ if(nRet != STB_TRUE)
+ {
+ return STB_ERR_INVALIDPARAM;
+ }
+
+
+ /*Clear the unexecuted state flag*/
+ handle->nExecuted = STB_FALSE;
+
+ /*Set the received result to the handle*/
+ if( handle->execFlg->bodyTr == STB_TRUE )
+ {
+ handle->nDetCntBody = stbINPUTResult->bodys.nCount;
+ SetTrackingObjectBody ( &(stbINPUTResult->bodys) ,handle->trBody );
+ }
+ if( handle->execFlg->faceTr == STB_TRUE )
+ {
+ handle->nDetCntFace = stbINPUTResult->faces.nCount;
+ SetTrackingObjectFace ( &(stbINPUTResult->faces) ,handle->trFace );
+ }
+
+ /*Set detection result to Face/Property/Recognition data*/
+ if( handle->execFlg->gen == STB_TRUE
+ || handle->execFlg->age == STB_TRUE
+ || handle->execFlg->fr == STB_TRUE
+ || handle->execFlg->exp == STB_TRUE
+ || handle->execFlg->gaz == STB_TRUE
+ || handle->execFlg->dir == STB_TRUE
+ || handle->execFlg->bli == STB_TRUE
+ )
+ {
+ SetFaceObject ( &(stbINPUTResult->faces) ,handle->infoFace ,handle->execFlg , handle->nTraCntMax );
+ }
+
+
+ handle->nInitialized = STB_TRUE;
+
+ return STB_NORMAL;
+}
+
+/*------------------------------------------------------------------------------------------------------------------*/
+/*Execute : Main process execution*/
+/*------------------------------------------------------------------------------------------------------------------*/
+STB_INT32 Execute ( STBHANDLE handle )
+{
+ STB_INT32 nRet ;
+ STB_TR_DET *srcTr = handle->wSrcTr ;/*TR : input data*/
+ STB_TR_RES_FACES *dstTrFace = handle->wDstTrFace;/*TR : output data*/
+ STB_TR_RES_BODYS *dstTrBody = handle->wDstTrBody;/*TR : output data*/
+ STB_PE_DET *srcPe = handle->wSrcPe ;/*PR : Input data*/
+ STB_PE_RES *dstPe = handle->wDstPe ;/*PE : Output data*/
+ STB_FR_DET *srcFr = handle->wSrcFr ;/*FR : Input data*/
+ STB_FR_RES *dstFr = handle->wDstFr ;/*FR : Output data*/
+
+
+
+ /*NULL check*/
+ nRet = IsValidPointer ( handle );
+ if( nRet != STB_NORMAL )
+ {
+ return STB_ERR_NOHANDLE;
+ }
+
+ if( handle->nInitialized != STB_TRUE)
+ {
+ return STB_ERR_INITIALIZE;
+ }
+ handle->nInitialized = STB_FALSE;
+ handle->nExecuted = STB_FALSE;
+
+ /* TR ------------------------------------------------------------------------------------------------*/
+ if( handle->execFlg->faceTr == STB_TRUE )
+ {
+ SetSrcTrFace ( handle->nDetCntFace , handle->trFace , srcTr ); /*Creation of tracking input data from handle information*/
+ }
+ if( handle->execFlg->bodyTr == STB_TRUE )
+ {
+ SetSrcTrBody ( handle->nDetCntBody , handle->trBody , srcTr ); /*Creation of tracking input data from handle information*/
+ }
+ nRet = STB_Tr_SetDetect ( handle->hTrHandle , srcTr); /*Frame information settings*/
+ if( nRet != STB_NORMAL) { return nRet; }
+ nRet = STB_Tr_Execute ( handle->hTrHandle ); /*execute tracking*/
+ if( nRet != STB_NORMAL) { return nRet; }
+ nRet = STB_Tr_GetResult ( handle->hTrHandle , dstTrFace , dstTrBody ); /*get the tracking result*/
+ if( nRet != STB_NORMAL) { return nRet; }
+ if( handle->execFlg->faceTr == STB_TRUE )
+ {
+ SetTrackingInfoToFace ( dstTrFace,&(handle->nTraCntFace),handle->trFace);/*copy to handle the tracking result*/
+ }
+ if( handle->execFlg->bodyTr == STB_TRUE )
+ {
+ SetTrackingInfoToBody ( dstTrBody,&(handle->nTraCntBody),handle->trBody);/*copy to handle the tracking result*/
+ }
+
+
+ /*Association of face information and tracking ID--------------------------------------------------------------------------------*/
+ if( handle->execFlg->gen == STB_TRUE
+ || handle->execFlg->age == STB_TRUE
+ || handle->execFlg->fr == STB_TRUE
+ || handle->execFlg->exp == STB_TRUE
+ || handle->execFlg->gaz == STB_TRUE
+ || handle->execFlg->dir == STB_TRUE
+ || handle->execFlg->bli == STB_TRUE
+ )
+ {
+ SetTrackingIDToFace ( handle->nTraCntFace ,handle->nDetCntFace, handle->trFace,handle->infoFace , handle->execFlg );
+ }
+
+ /* Fr ------------------------------------------------------------------------------------------------*/
+ if( handle->execFlg->fr == STB_TRUE )
+ {
+ SetFaceToFrInfo ( handle->nTraCntFace,handle->infoFace,srcFr ); /*Creation of recognition input data from handle information*/
+ nRet = STB_Fr_SetDetect ( handle->hFrHandle,srcFr ); /*Pass to the recognized stabilization*/
+ if(nRet != STB_NORMAL ){ return nRet; }
+ nRet = STB_Fr_Execute ( handle->hFrHandle ); /* Recognized stabilization execution*/
+ if(nRet != STB_NORMAL ){ return nRet; }
+ nRet = STB_Fr_GetResult ( handle->hFrHandle,dstFr ); /*get the recognized stabilization results*/
+ if(nRet != STB_NORMAL ){ return nRet; }
+ SetFrInfoToFace ( handle->nTraCntFace,dstFr,handle->infoFace ); /*Copy to handle the recognized stabilization results*/
+ }
+
+ /* Pe ------------------------------------------------------------------------------------------------*/
+ if( handle->execFlg->gen == STB_TRUE
+ || handle->execFlg->age == STB_TRUE
+ //|| handle->execFlg->fr == STB_TRUE
+ || handle->execFlg->exp == STB_TRUE
+ || handle->execFlg->gaz == STB_TRUE
+ || handle->execFlg->dir == STB_TRUE
+ || handle->execFlg->bli == STB_TRUE
+ )
+ {
+ SetFaceToPeInfo ( handle->nTraCntFace,handle->infoFace,srcPe ); /*Creation of property input data from handle information*/
+ nRet = STB_Pe_SetDetect ( handle->hPeHandle,srcPe ); /*Pass to property stabilization*/
+ if( nRet != STB_NORMAL ){ return nRet; }
+ nRet = STB_Pe_Execute ( handle->hPeHandle ); /*Property stabilization execution*/
+ if( nRet != STB_NORMAL ){ return nRet; }
+ nRet = STB_Pe_GetResult ( handle->hPeHandle,dstPe ); /*get the property stabilization results*/
+ if( nRet != STB_NORMAL ){ return nRet; }
+ SetPeInfoToFace ( handle->nTraCntFace,dstPe,handle->infoFace , handle->execFlg ); /*Copy to handle the property stabilization results*/
+ }
+
+
+
+ /*Set execution completion flag--------------------------------------------------*/
+ handle->nExecuted = STB_TRUE;
+
+ return STB_NORMAL;
+}
+/*------------------------------------------------------------------------------------------------------------------*/
+/* GetFaces : Getting stabilization results of face*/
+/*------------------------------------------------------------------------------------------------------------------*/
+STB_INT32 GetFaces(STBHANDLE handle, STB_UINT32 *face_count, STB_FACE *face )
+{
+ STB_INT32 nRet , i;
+
+ /*NULL check*/
+ nRet = IsValidPointer(handle);
+ if(nRet != STB_NORMAL)
+ {
+ return STB_ERR_NOHANDLE;
+ }
+ nRet = IsValidPointer(face_count);
+ if(nRet != STB_NORMAL)
+ {
+ return nRet;
+ }
+ nRet = IsValidPointer(face);
+ if(nRet != STB_NORMAL)
+ {
+ return nRet;
+ }
+ if( handle->nExecuted != STB_TRUE)
+ {
+ return STB_ERR_INITIALIZE;
+ }
+
+ /*init*/
+ *face_count = 0;
+ for( i = 0 ; i < handle->nTraCntMax ; i++ )
+ {
+ face[i].nDetectID = -1;
+ face[i].nTrackingID = -1;
+ face[i].center.x = 0;
+ face[i].center.y = 0;
+ face[i].nSize = 0;
+ face[i].conf = STB_CONF_NO_DATA ;
+ face[i].age.conf = STB_CONF_NO_DATA ;
+ face[i].age.status = STB_STATUS_NO_DATA;
+ face[i].age.value = -1;
+ face[i].blink.ratioL = -1;
+ face[i].blink.ratioR = -1;
+ face[i].blink.status = STB_STATUS_NO_DATA;
+ face[i].direction.conf = STB_CONF_NO_DATA ;
+ face[i].direction.pitch = -1;
+ face[i].direction.roll = -1;
+ face[i].direction.status = STB_STATUS_NO_DATA;
+ face[i].direction.yaw = -1;
+ face[i].expression.conf = STB_CONF_NO_DATA ;
+ face[i].expression.status = STB_STATUS_NO_DATA;
+ face[i].expression.value = -1;
+ face[i].gaze.conf = STB_CONF_NO_DATA ;
+ face[i].gaze.LR = -1;
+ face[i].gaze.status = STB_STATUS_NO_DATA;
+ face[i].gaze.UD = -1;
+ face[i].gender.conf = STB_CONF_NO_DATA ;
+ face[i].gender.status = STB_STATUS_NO_DATA;
+ face[i].gender.value = -1;
+ face[i].recognition.conf = STB_CONF_NO_DATA ;
+ face[i].recognition.status = STB_STATUS_NO_DATA;
+ face[i].recognition.value = -1;
+ }
+
+ /*Set the result to the structure*/
+ if( handle->execFlg->faceTr == STB_TRUE )
+ {
+ *face_count = handle->nTraCntFace;
+ SetFaceToResult ( handle->nTraCntFace ,handle->trFace ,handle->infoFace ,face , handle->execFlg );
+ }
+
+ return STB_NORMAL;
+}
+/*------------------------------------------------------------------------------------------------------------------*/
+/* GetBodies : Getting stabilization results of body */
+/*------------------------------------------------------------------------------------------------------------------*/
+STB_INT32 GetBodies(STBHANDLE handle, STB_UINT32 *body_count, STB_BODY *body)
+{
+ STB_INT32 nRet , i;
+
+ /*NULL check*/
+ nRet = IsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+ nRet = IsValidPointer(body_count);
+ if(nRet != STB_NORMAL){
+ return nRet;
+ }
+ nRet = IsValidPointer(body);
+ if(nRet != STB_NORMAL){
+ return nRet;
+ }
+ if( handle->nExecuted != STB_TRUE){
+ return STB_ERR_INITIALIZE;
+ }
+
+
+ /*init*/
+ *body_count = 0;
+ for( i = 0 ; i < handle->nTraCntMax ; i++ )
+ {
+ body[i].nDetectID = -1;
+ body[i].nTrackingID = -1;
+ body[i].center.x = 0;
+ body[i].center.y = 0;
+ body[i].nSize = 0;
+ body[i].conf = STB_CONF_NO_DATA ;
+ }
+
+ /*Set the result to the structure*/
+ if( handle->execFlg->bodyTr == STB_TRUE )
+ {
+ *body_count = handle->nTraCntBody;
+ SetBodyToResult(handle->nTraCntBody,handle->trBody, body);
+ }
+ return STB_NORMAL;
+}
+/*------------------------------------------------------------------------------------------------------------------*/
+/* Clear */
+/*------------------------------------------------------------------------------------------------------------------*/
+STB_INT32 Clear(STBHANDLE handle)
+{
+ STB_INT32 nRet;
+
+ /*NULL check*/
+ nRet = IsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+
+ STB_Tr_Clear( handle->hTrHandle );
+ STB_Pe_Clear( handle->hPeHandle );
+ if( handle->execFlg->fr == STB_TRUE )
+ {
+ STB_Fr_Clear( handle->hFrHandle );
+ }
+
+ handle->nInitialized = STB_FALSE;
+ handle->nExecuted = STB_FALSE;
+
+
+ return STB_NORMAL;
+
+}
+/*------------------------------------------------------------------------------------------------------------------*/
+/*Setting function (wrapper for child libraries)*/
+/*------------------------------------------------------------------------------------------------------------------*/
+STB_INT32 SetTrackingRetryCount(STBHANDLE handle, STB_INT32 nMaxRetryCount){
+ STB_INT32 nRet;
+ /*NULL check*/
+ nRet = IsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+
+ return STB_Tr_SetRetryCount(handle->hTrHandle,nMaxRetryCount);
+}
+
+STB_INT32 GetTrackingRetryCount(STBHANDLE handle, STB_INT32 *pnMaxRetryCount){
+ STB_INT32 nRet;
+ /*NULL check*/
+ nRet = IsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+
+ return STB_Tr_GetRetryCount(handle->hTrHandle,pnMaxRetryCount);
+}
+
+STB_INT32 SetTrackingSteadinessParam(STBHANDLE handle, STB_INT32 nPosSteadinessParam, STB_INT32 nSizeSteadinessParam){
+ STB_INT32 nRet;
+ /*NULL check*/
+ nRet = IsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+
+ return STB_Tr_SetStedinessParam(handle->hTrHandle, nPosSteadinessParam, nSizeSteadinessParam);
+}
+
+STB_INT32 GetTrackingSteadinessParam(STBHANDLE handle, STB_INT32 *pnPosSteadinessParam, STB_INT32 *pnSizeSteadinessParam){
+ STB_INT32 nRet;
+ /*NULL check*/
+ nRet = IsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+
+ return STB_Tr_GetStedinessParam(handle->hTrHandle, pnPosSteadinessParam, pnSizeSteadinessParam);
+}
+
+STB_INT32 SetPropertyThreshold(STBHANDLE handle, STB_INT32 nThreshold){
+ STB_INT32 nRet;
+ /*NULL check*/
+ nRet = IsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+
+ if( handle->execFlg->gen == STB_TRUE
+ || handle->execFlg->age == STB_TRUE
+ || handle->execFlg->exp == STB_TRUE
+ || handle->execFlg->dir == STB_TRUE
+ || handle->execFlg->gaz == STB_TRUE
+ || handle->execFlg->bli == STB_TRUE
+ )
+ {
+ }else
+ {
+ return STB_NORMAL;
+ }
+
+ return STB_Pe_SetFaceDirThreshold(handle->hPeHandle, nThreshold);
+}
+
+STB_INT32 GetPropertyThreshold(STBHANDLE handle, STB_INT32 *pnThreshold){
+ STB_INT32 nRet;
+ /*NULL check*/
+ nRet = IsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+ if( handle->execFlg->gen == STB_TRUE
+ || handle->execFlg->age == STB_TRUE
+ || handle->execFlg->exp == STB_TRUE
+ || handle->execFlg->dir == STB_TRUE
+ || handle->execFlg->gaz == STB_TRUE
+ || handle->execFlg->bli == STB_TRUE
+ )
+ {
+ }else
+ {
+ return STB_NORMAL;
+ }
+ return STB_Pe_GetFaceDirThreshold(handle->hPeHandle, pnThreshold);
+}
+
+STB_INT32 SetPropertyAngle(STBHANDLE handle,STB_INT32 nMinUDAngle, STB_INT32 nMaxUDAngle,
+ STB_INT32 nMinLRAngle, STB_INT32 nMaxLRAngle){
+ STB_INT32 nRet;
+ /*NULL check*/
+ nRet = IsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+ if( handle->execFlg->gen == STB_TRUE
+ || handle->execFlg->age == STB_TRUE
+ || handle->execFlg->exp == STB_TRUE
+ || handle->execFlg->dir == STB_TRUE
+ || handle->execFlg->gaz == STB_TRUE
+ || handle->execFlg->bli == STB_TRUE
+ )
+ {
+ }else
+ {
+ return STB_NORMAL;
+ }
+ return STB_Pe_SetFaceDirMinMax(handle->hPeHandle, nMinUDAngle, nMaxUDAngle, nMinLRAngle, nMaxLRAngle);
+}
+
+STB_INT32 GetPropertyAngle(STBHANDLE handle, STB_INT32 *pnMinUDAngle , STB_INT32 *pnMaxUDAngle ,
+ STB_INT32 *pnMinLRAngle , STB_INT32 *pnMaxLRAngle ){
+ STB_INT32 nRet;
+ /*NULL check*/
+ nRet = IsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+ if( handle->execFlg->gen == STB_TRUE
+ || handle->execFlg->age == STB_TRUE
+ || handle->execFlg->exp == STB_TRUE
+ || handle->execFlg->dir == STB_TRUE
+ || handle->execFlg->gaz == STB_TRUE
+ || handle->execFlg->bli == STB_TRUE
+ )
+ {
+ }else
+ {
+ return STB_NORMAL;
+ }
+ return STB_Pe_GetFaceDirMinMax(handle->hPeHandle, pnMinUDAngle, pnMaxUDAngle, pnMinLRAngle, pnMaxLRAngle);
+}
+STB_INT32 SetPropertyFrameCount(STBHANDLE handle, STB_INT32 nFrameCount){
+ STB_INT32 nRet;
+ /*NULL check*/
+ nRet = IsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+ if( handle->execFlg->gen == STB_TRUE
+ || handle->execFlg->age == STB_TRUE
+ || handle->execFlg->exp == STB_TRUE
+ || handle->execFlg->dir == STB_TRUE
+ || handle->execFlg->gaz == STB_TRUE
+ || handle->execFlg->bli == STB_TRUE
+ )
+ {
+ }else
+ {
+ return STB_NORMAL;
+ }
+ return STB_Pe_SetFrameCount(handle->hPeHandle, nFrameCount);
+}
+STB_INT32 GetPropertyFrameCount(STBHANDLE handle, STB_INT32 *pnFrameCount){
+ STB_INT32 nRet;
+ /*NULL check*/
+ nRet = IsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+ if( handle->execFlg->gen == STB_TRUE
+ || handle->execFlg->age == STB_TRUE
+ || handle->execFlg->exp == STB_TRUE
+ || handle->execFlg->dir == STB_TRUE
+ || handle->execFlg->gaz == STB_TRUE
+ || handle->execFlg->bli == STB_TRUE
+ )
+ {
+ }else
+ {
+ return STB_NORMAL;
+ }
+ return STB_Pe_GetFrameCount(handle->hPeHandle, pnFrameCount);
+}
+STB_INT32 SetRecognitionThreshold(STBHANDLE handle, STB_INT32 nThreshold){
+ STB_INT32 nRet;
+ /*NULL check*/
+ nRet = IsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+ if( handle->execFlg->fr == STB_FALSE )
+ {
+ return STB_NORMAL;
+ }
+ return STB_Fr_SetFaceDirThreshold(handle->hFrHandle, nThreshold);
+}
+STB_INT32 GetRecognitionThreshold(STBHANDLE handle, STB_INT32 *pnThreshold){
+ STB_INT32 nRet;
+ /*NULL check*/
+ nRet = IsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+ if( handle->execFlg->fr == STB_FALSE )
+ {
+ return STB_NORMAL;
+ }
+ return STB_Fr_GetFaceDirThreshold(handle->hFrHandle, pnThreshold);
+}
+
+STB_INT32 SetRecognitionAngle(STBHANDLE handle, STB_INT32 nMinUDAngle, STB_INT32 nMaxUDAngle,
+ STB_INT32 nMinLRAngle, STB_INT32 nMaxLRAngle){
+ STB_INT32 nRet;
+ /*NULL check*/
+ nRet = IsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+ if( handle->execFlg->fr == STB_FALSE )
+ {
+ return STB_NORMAL;
+ }
+ return STB_Fr_SetFaceDirMinMax(handle->hFrHandle, nMinUDAngle, nMaxUDAngle, nMinLRAngle , nMaxLRAngle);
+}
+
+STB_INT32 GetRecognitionAngle(STBHANDLE handle, STB_INT32 *pnMinUDAngle , STB_INT32 *pnMaxUDAngle ,
+ STB_INT32 *pnMinLRAngle , STB_INT32 *pnMaxLRAngle){
+ STB_INT32 nRet;
+ /*NULL check*/
+ nRet = IsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+ nRet = IsValidPointer(pnMinUDAngle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_INVALIDPARAM;
+ }
+ nRet = IsValidPointer(pnMaxUDAngle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_INVALIDPARAM;
+ }
+ nRet = IsValidPointer(pnMinLRAngle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_INVALIDPARAM;
+ }
+ nRet = IsValidPointer(pnMaxLRAngle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_INVALIDPARAM;
+ }
+
+ if( handle->execFlg->fr == STB_FALSE )
+ {
+ return STB_NORMAL;
+ }
+ return STB_Fr_GetFaceDirMinMax(handle->hFrHandle, pnMinUDAngle, pnMaxUDAngle, pnMinLRAngle , pnMaxLRAngle);
+}
+
+STB_INT32 SetRecognitionFrameCount(STBHANDLE handle, STB_INT32 nFrameCount){
+ STB_INT32 nRet;
+ /*NULL check*/
+ nRet = IsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+ if( handle->execFlg->fr == STB_FALSE )
+ {
+ return STB_NORMAL;
+ }
+ return STB_Fr_SetFrameCount(handle->hFrHandle, nFrameCount);
+}
+STB_INT32 GetRecognitionFrameCount(STBHANDLE handle, STB_INT32 *pnFrameCount){
+ STB_INT32 nRet;
+ /*NULL check*/
+ nRet = IsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+ if( handle->execFlg->fr == STB_FALSE )
+ {
+ return STB_NORMAL;
+ }
+ return STB_Fr_GetFrameCount(handle->hFrHandle, pnFrameCount);
+}
+
+STB_INT32 SetRecognitionRatio (STBHANDLE handle, STB_INT32 nMinRatio){
+ STB_INT32 nRet;
+ /*NULL check*/
+ nRet = IsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+ if( handle->execFlg->fr == STB_FALSE )
+ {
+ return STB_NORMAL;
+ }
+ return STB_Fr_SetMinRatio(handle->hFrHandle, nMinRatio);
+}
+STB_INT32 GetRecognitionRatio (STBHANDLE handle, STB_INT32 *pnMinRatio){
+ STB_INT32 nRet;
+ /*NULL check*/
+ nRet = IsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+ if( handle->execFlg->fr == STB_FALSE )
+ {
+ return STB_NORMAL;
+ }
+ return STB_Fr_GetMinRatio(handle->hFrHandle, pnMinRatio);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HVC/STBLib/src/STB/Interface.h Tue Sep 05 10:01:51 2017 +0000
@@ -0,0 +1,68 @@
+/*---------------------------------------------------------------------------*/
+/* Copyright(C) 2017 OMRON Corporation */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
+/* See the License for the specific language governing permissions and */
+/* limitations under the License. */
+/*---------------------------------------------------------------------------*/
+
+#if !defined( _INTERFACE_H_ )
+#define _INTERFACE_H_
+#include "STBTypedefInput.h"
+#include "STBHandle.h"
+
+#define VERSION_MAJOR ( 1 )
+#define VERSION_MINOR ( 1 )
+
+#define DETECT_CNT_MAX ( 35 ) /*A maximum number of detected(input) people*/
+#define TRACK_CNT_MAX ( 35 ) /*A maximum number of tracking(output) people*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*-------------------------------------------------------------------------------------------------------------------*/
+STB_INT32 GetVersion (STB_INT8* pnMajorVersion , STB_INT8* pnMinorVersion );
+STBHANDLE CreateHandle (STB_UINT32 stbExecFlg );
+STB_INT32 DeleteHandle (STBHANDLE handle);
+STB_INT32 SetFrameResult (STBHANDLE handle,const STB_FRAME_RESULT *stbINPUTResult);
+STB_INT32 Execute (STBHANDLE handle);
+/*-------------------------------------------------------------------------------------------------------------------*/
+STB_INT32 GetFaces (STBHANDLE handle, STB_UINT32 *face_count, STB_FACE face[35]);
+STB_INT32 GetBodies (STBHANDLE handle, STB_UINT32 *body_count, STB_BODY body[35]);
+STB_INT32 Clear (STBHANDLE handle);
+/*-------------------------------------------------------------------------------------------------------------------*/
+STB_INT32 SetTrackingRetryCount (STBHANDLE handle, STB_INT32 nMaxRetryCount );
+STB_INT32 GetTrackingRetryCount (STBHANDLE handle, STB_INT32 *pnMaxRetryCount );
+STB_INT32 SetTrackingSteadinessParam (STBHANDLE handle, STB_INT32 nPosSteadinessParam , STB_INT32 nSizeSteadinessParam );
+STB_INT32 GetTrackingSteadinessParam (STBHANDLE handle, STB_INT32 *pnPosSteadinessParam , STB_INT32 *pnSizeSteadinessParam );
+/*-------------------------------------------------------------------------------------------------------------------*/
+STB_INT32 SetPropertyThreshold (STBHANDLE handle, STB_INT32 nThreshold );
+STB_INT32 GetPropertyThreshold (STBHANDLE handle, STB_INT32 *pnThreshold );
+STB_INT32 SetPropertyAngle (STBHANDLE handle, STB_INT32 nMinUDAngle , STB_INT32 nMaxUDAngle ,STB_INT32 nMinLRAngle , STB_INT32 nMaxLRAngle );
+STB_INT32 GetPropertyAngle (STBHANDLE handle, STB_INT32 *pnMinUDAngle , STB_INT32 *pnMaxUDAngle ,STB_INT32 *pnMinLRAngle, STB_INT32 *pnMaxLRAngle );
+STB_INT32 SetPropertyFrameCount (STBHANDLE handle, STB_INT32 nFrameCount );
+STB_INT32 GetPropertyFrameCount (STBHANDLE handle, STB_INT32 *pnFrameCount );
+/*-------------------------------------------------------------------------------------------------------------------*/
+STB_INT32 SetRecognitionThreshold (STBHANDLE handle, STB_INT32 nThreshold );
+STB_INT32 GetRecognitionThreshold (STBHANDLE handle, STB_INT32 *pnThreshold );
+STB_INT32 SetRecognitionAngle (STBHANDLE handle, STB_INT32 nMinUDAngle , STB_INT32 nMaxUDAngle ,STB_INT32 nMinLRAngle , STB_INT32 nMaxLRAngle );
+STB_INT32 GetRecognitionAngle (STBHANDLE handle, STB_INT32 *pnMinUDAngle , STB_INT32 *pnMaxUDAngle ,STB_INT32 *pnMinLRAngle, STB_INT32 *pnMaxLRAngle );
+STB_INT32 SetRecognitionFrameCount (STBHANDLE handle, STB_INT32 nFrameCount );
+STB_INT32 GetRecognitionFrameCount (STBHANDLE handle, STB_INT32 *pnFrameCount );
+STB_INT32 SetRecognitionRatio (STBHANDLE handle, STB_INT32 nFrameShare );
+STB_INT32 GetRecognitionRatio (STBHANDLE handle, STB_INT32 *pnFrameShare );
+/*-------------------------------------------------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HVC/STBLib/src/STB/STBAPI.c Tue Sep 05 10:01:51 2017 +0000
@@ -0,0 +1,112 @@
+/*---------------------------------------------------------------------------*/
+/* Copyright(C) 2017 OMRON Corporation */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
+/* See the License for the specific language governing permissions and */
+/* limitations under the License. */
+/*---------------------------------------------------------------------------*/
+
+#include "Interface.h"
+#include "STBAPI.h"
+
+
+/*This layer only defines the API function */
+
+/*get the version*/
+STB_INT32 STB_GetVersion(STB_INT8* pnMajorVersion, STB_INT8* pnMinorVersion){
+ return GetVersion(pnMajorVersion, pnMinorVersion);
+}
+/*Create/Delete handle*/
+HSTB STB_CreateHandle(STB_UINT32 stbExecFlg){
+ return (HSTB)CreateHandle(stbExecFlg);
+}
+VOID STB_DeleteHandle(HSTB handle){
+ DeleteHandle((STBHANDLE)handle);
+}
+/*set frame information*/
+STB_INT32 STB_SetFrameResult(HSTB handle, const STB_FRAME_RESULT *stbINPUTResult){
+ return SetFrameResult((STBHANDLE)handle, stbINPUTResult);
+}
+STB_INT32 STB_ClearFrameResults(HSTB handle){
+ return Clear((STBHANDLE)handle);
+}
+/*Main process execution*/
+STB_INT32 STB_Execute(HSTB handle){
+ return Execute((STBHANDLE)handle);
+}
+/*get the result*/
+STB_INT32 STB_GetFaces(HSTB handle, STB_UINT32 *face_count, STB_FACE face[35]){
+ return GetFaces((STBHANDLE)handle, face_count, face);
+}
+STB_INT32 STB_GetBodies(HSTB handle, STB_UINT32 *body_count, STB_BODY body[35]){
+ return GetBodies((STBHANDLE)handle, body_count, body);
+}
+
+/*Setting / Getting Function for tracking*/
+STB_INT32 STB_SetTrRetryCount(HSTB hHandle, STB_INT32 nMaxRetryCount){
+ return SetTrackingRetryCount((STBHANDLE)hHandle, nMaxRetryCount);
+}
+STB_INT32 STB_GetTrRetryCount(HSTB hHandle, STB_INT32 *pnMaxRetryCount){
+ return GetTrackingRetryCount((STBHANDLE)hHandle, pnMaxRetryCount);
+}
+STB_INT32 STB_SetTrSteadinessParam(HSTB hHandle, STB_INT32 nPosSteadinessParam, STB_INT32 nSizeSteadinessParam){
+ return SetTrackingSteadinessParam((STBHANDLE)hHandle, nPosSteadinessParam, nSizeSteadinessParam);
+}
+STB_INT32 STB_GetTrSteadinessParam(HSTB hHandle, STB_INT32 *pnPosSteadinessParam, STB_INT32 *pnSizeSteadinessParam){
+ return GetTrackingSteadinessParam((STBHANDLE)hHandle, pnPosSteadinessParam, pnSizeSteadinessParam);
+}
+
+/*Setting / Getting Function for property*/
+STB_INT32 STB_SetPeThresholdUse(HSTB hHandle, STB_INT32 nThreshold){
+ return SetPropertyThreshold((STBHANDLE)hHandle, nThreshold);
+}
+STB_INT32 STB_GetPeThresholdUse(HSTB hHandle, STB_INT32 *pnThreshold){
+ return GetPropertyThreshold((STBHANDLE)hHandle, pnThreshold);
+}
+STB_INT32 STB_SetPeAngleUse(HSTB hHandle, STB_INT32 nMinUDAngle, STB_INT32 nMaxUDAngle, STB_INT32 nMinLRAngle, STB_INT32 nMaxLRAngle ){
+ return SetPropertyAngle((STBHANDLE)hHandle, nMinUDAngle, nMaxUDAngle, nMinLRAngle, nMaxLRAngle);
+}
+STB_INT32 STB_GetPeAngleUse(HSTB hHandle, STB_INT32 *pnMinUDAngle, STB_INT32 *pnMaxUDAngle, STB_INT32 *pnMinLRAngle, STB_INT32 *pnMaxLRAngle ){
+ return GetPropertyAngle((STBHANDLE)hHandle, pnMinUDAngle, pnMaxUDAngle, pnMinLRAngle, pnMaxLRAngle);
+}
+STB_INT32 STB_SetPeCompleteFrameCount(HSTB hHandle, STB_INT32 nFrameCount){
+ return SetPropertyFrameCount((STBHANDLE)hHandle, nFrameCount);
+}
+STB_INT32 STB_GetPeCompleteFrameCount(HSTB hHandle, STB_INT32 *pnFrameCount){
+ return GetPropertyFrameCount((STBHANDLE)hHandle, pnFrameCount);
+}
+
+/*Setting / Getting Function for recognition*/
+STB_INT32 STB_SetFrThresholdUse(HSTB hHandle, STB_INT32 nThreshold){
+ return SetRecognitionThreshold((STBHANDLE)hHandle, nThreshold);
+}
+STB_INT32 STB_GetFrThresholdUse(HSTB hHandle, STB_INT32 *pnThreshold){
+ return GetRecognitionThreshold((STBHANDLE)hHandle, pnThreshold);
+}
+STB_INT32 STB_SetFrAngleUse(HSTB hHandle, STB_INT32 nMinUDAngle, STB_INT32 nMaxUDAngle, STB_INT32 nMinLRAngle, STB_INT32 nMaxLRAngle ){
+ return SetRecognitionAngle((STBHANDLE)hHandle, nMinUDAngle, nMaxUDAngle, nMinLRAngle, nMaxLRAngle);
+}
+STB_INT32 STB_GetFrAngleUse(HSTB hHandle, STB_INT32 *pnMinUDAngle, STB_INT32 *pnMaxUDAngle, STB_INT32 *pnMinLRAngle, STB_INT32 *pnMaxLRAngle ){
+ return GetRecognitionAngle((STBHANDLE)hHandle, pnMinUDAngle, pnMaxUDAngle, pnMinLRAngle, pnMaxLRAngle);
+}
+STB_INT32 STB_SetFrCompleteFrameCount(HSTB hHandle, STB_INT32 nFrameCount){
+ return SetRecognitionFrameCount((STBHANDLE)hHandle, nFrameCount);
+}
+STB_INT32 STB_GetFrCompleteFrameCount(HSTB hHandle, STB_INT32 *pnFrameCount){
+ return GetRecognitionFrameCount((STBHANDLE)hHandle, pnFrameCount);
+}
+STB_INT32 STB_SetFrMinRatio(HSTB hHandle, STB_INT32 nFrameRatio){
+ return SetRecognitionRatio((STBHANDLE)hHandle, nFrameRatio);
+}
+STB_INT32 STB_GetFrMinRatio(HSTB hHandle, STB_INT32 *pnFrameRatio){
+ return GetRecognitionRatio((STBHANDLE)hHandle, pnFrameRatio);
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HVC/STBLib/src/STB/STBAPI.h Tue Sep 05 10:01:51 2017 +0000
@@ -0,0 +1,74 @@
+/*---------------------------------------------------------------------------*/
+/* Copyright(C) 2017 OMRON Corporation */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
+/* See the License for the specific language governing permissions and */
+/* limitations under the License. */
+/*---------------------------------------------------------------------------*/
+
+#if !defined( _SDK_STB_H_ )
+#define _SDK_STB_H_
+#include "STBTypedefInput.h"
+#include "STBTypedefOutput.h"
+
+
+
+#if !defined( STB_DEF_HANDLE )
+ #define STB_DEF_HANDLE
+ typedef VOID* HSTB ;
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*Create/Delete handle*/
+STB_INT32 STB_GetVersion(STB_INT8* pnMajorVersion, STB_INT8* pnMinorVersion);
+HSTB STB_CreateHandle(STB_UINT32 unUseFuncFlag);
+VOID STB_DeleteHandle(HSTB hSTB);
+
+/*set frame information*/
+STB_INT32 STB_SetFrameResult(HSTB hSTB, const STB_FRAME_RESULT *stFrameResult);
+STB_INT32 STB_ClearFrameResults(HSTB hSTB);
+/*Main process execution*/
+STB_INT32 STB_Execute(HSTB hSTB);
+/*get the result*/
+STB_INT32 STB_GetFaces(HSTB hSTB, STB_UINT32 *punFaceCount, STB_FACE stFace[]);
+STB_INT32 STB_GetBodies(HSTB hSTB, STB_UINT32 *punBodyCount, STB_BODY stBody[]);
+
+/*Setting / Getting Function for tracking*/
+STB_INT32 STB_SetTrRetryCount(HSTB hSTB, STB_INT32 nMaxRetryCount);
+STB_INT32 STB_GetTrRetryCount(HSTB hSTB, STB_INT32 *pnMaxRetryCount);
+STB_INT32 STB_SetTrSteadinessParam(HSTB hSTB, STB_INT32 nPosSteadinessParam, STB_INT32 nSizeSteadinessParam);
+STB_INT32 STB_GetTrSteadinessParam(HSTB hSTB, STB_INT32 *pnPosSteadinessParam, STB_INT32 *pnSizeSteadinessParam);
+/*Setting / Getting Function for property*/
+STB_INT32 STB_SetPeThresholdUse(HSTB hSTB, STB_INT32 nThreshold);
+STB_INT32 STB_GetPeThresholdUse(HSTB hSTB, STB_INT32 *pnThreshold);
+STB_INT32 STB_SetPeAngleUse(HSTB hSTB, STB_INT32 nMinUDAngle, STB_INT32 nMaxUDAngle, STB_INT32 nMinLRAngle, STB_INT32 nMaxLRAngle);
+STB_INT32 STB_GetPeAngleUse(HSTB hSTB, STB_INT32 *pnMinUDAngle, STB_INT32 *pnMaxUDAngle, STB_INT32 *pnMinLRAngle, STB_INT32 *pnMaxLRAngle);
+STB_INT32 STB_SetPeCompleteFrameCount(HSTB hSTB, STB_INT32 nFrameCount);
+STB_INT32 STB_GetPeCompleteFrameCount(HSTB hSTB, STB_INT32 *pnFrameCount);
+/*Setting / Getting Function for recognition*/
+STB_INT32 STB_SetFrThresholdUse(HSTB hSTB, STB_INT32 nThreshold);
+STB_INT32 STB_GetFrThresholdUse(HSTB hSTB, STB_INT32 *pnThreshold);
+STB_INT32 STB_SetFrAngleUse(HSTB hSTB, STB_INT32 nMinUDAngle, STB_INT32 nMaxUDAngle, STB_INT32 nMinLRAngle, STB_INT32 nMaxLRAngle);
+STB_INT32 STB_GetFrAngleUse(HSTB hSTB, STB_INT32 *pnMinUDAngle, STB_INT32 *pnMaxUDAngle, STB_INT32 *pnMinLRAngle, STB_INT32 *pnMaxLRAngle);
+STB_INT32 STB_SetFrCompleteFrameCount(HSTB hSTB, STB_INT32 nFrameCount);
+STB_INT32 STB_GetFrCompleteFrameCount(HSTB hSTB, STB_INT32 *pnFrameCount);
+STB_INT32 STB_SetFrMinRatio(HSTB hSTB, STB_INT32 nMinRatio);
+STB_INT32 STB_GetFrMinRatio(HSTB hSTB, STB_INT32 *pnMinRatio);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HVC/STBLib/src/STB/STBFaceInfo.c Tue Sep 05 10:01:51 2017 +0000
@@ -0,0 +1,450 @@
+/*---------------------------------------------------------------------------*/
+/* Copyright(C) 2017 OMRON Corporation */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
+/* See the License for the specific language governing permissions and */
+/* limitations under the License. */
+/*---------------------------------------------------------------------------*/
+
+#include "STBCommonDef.h"
+#include "STBFaceInfo.h"
+#include "STB_Debug.h"
+#include "STBValidValue.h"
+
+
+
+
+/*------------------------------------------------------------------------------------------------------------------*/
+/*CopyFace : Face information all copy*/
+/*------------------------------------------------------------------------------------------------------------------*/
+static VOID CopyFace(FaceObj *faceSrc,FaceObj *faceDst, const STBExecFlg *execFlg )
+{
+
+ STB_INT32 j;
+
+ faceDst->nDetID = faceSrc->nDetID ;
+ faceDst->nTraID = faceSrc->nTraID ;
+ if( execFlg->gen == STB_TRUE )
+ {
+ faceDst->genConf = faceSrc->genConf ;
+ faceDst->genStatus = faceSrc->genStatus ;
+ faceDst->genVal = faceSrc->genVal ;
+ }
+ if( execFlg->age == STB_TRUE )
+ {
+ faceDst->ageConf = faceSrc->ageConf ;
+ faceDst->ageStatus = faceSrc->ageStatus ;
+ faceDst->ageVal = faceSrc->ageVal ;
+ }
+ if( execFlg->fr == STB_TRUE )
+ {
+ faceDst->frConf = faceSrc->frConf ;
+ faceDst->frStatus = faceSrc->frStatus ;
+ faceDst->frVal = faceSrc->frVal ;
+ }
+ if( execFlg->exp == STB_TRUE )
+ {
+ faceDst->expConf = faceSrc->expConf ;
+ faceDst->expStatus = faceSrc->expStatus ;
+ faceDst->expVal = faceSrc->expVal ;
+ for( j = 0 ; j < STB_EX_MAX ;j++)
+ {
+ faceDst->expScore[j] = faceSrc->expScore[j];
+ }
+ }
+ if( execFlg->gaz == STB_TRUE )
+ {
+ faceDst->gazConf = faceSrc->gazConf ;
+ faceDst->gazStatus = faceSrc->gazStatus ;
+ faceDst->gazLR = faceSrc->gazLR ;
+ faceDst->gazUD = faceSrc->gazUD ;
+ }
+ if( execFlg->dir == STB_TRUE )
+ {
+ faceDst->dirConf = faceSrc->dirConf ;
+ faceDst->dirYaw = faceSrc->dirYaw ;
+ faceDst->dirRoll = faceSrc->dirRoll ;
+ faceDst->dirPitch = faceSrc->dirPitch ;
+ faceDst->dirStatus = faceSrc->dirStatus ;
+ }
+ if( execFlg->bli == STB_TRUE )
+ {
+ faceDst->bliL = faceSrc->bliL ;
+ faceDst->bliR = faceSrc->bliR ;
+ faceDst->bliStatus = faceSrc->bliStatus ;
+ }
+
+
+
+}
+/*------------------------------------------------------------------------------------------------------------------*/
+/* ClearFace */
+/*------------------------------------------------------------------------------------------------------------------*/
+static VOID ClearFace ( FaceObj *face , int i , const STBExecFlg *execFlg )
+{
+ STB_INT32 j;
+
+ face[i].nDetID = -1 ;
+ face[i].nTraID = -1 ;
+
+ if( execFlg->gen == STB_TRUE )
+ {
+ face[i].genConf = STB_ERR_PE_CANNOT ;
+ face[i].genStatus = STB_STATUS_NO_DATA ;
+ face[i].genVal = STB_ERR_PE_CANNOT ;
+ }
+ if( execFlg->age == STB_TRUE )
+ {
+ face[i].ageConf = STB_ERR_PE_CANNOT ;
+ face[i].ageStatus = STB_STATUS_NO_DATA ;
+ face[i].ageVal = STB_ERR_PE_CANNOT ;
+ }
+ if( execFlg->fr == STB_TRUE )
+ {
+ face[i].frConf = STB_ERR_PE_CANNOT ;
+ face[i].frStatus = STB_STATUS_NO_DATA ;
+ face[i].frVal = STB_ERR_FR_CANNOT ;
+ }
+ if( execFlg->exp == STB_TRUE )
+ {
+ face[i].expConf = STB_ERR_PE_CANNOT ;
+ for (j = STB_EX_NEUTRAL; j < STB_EX_MAX;j++)
+ {
+ face[i].expScore[j] = STB_ERR_PE_CANNOT ;
+ }
+ face[i].expStatus = STB_STATUS_NO_DATA ;
+ face[i].expVal = STB_ERR_PE_CANNOT ;
+ }
+ if( execFlg->gaz == STB_TRUE )
+ {
+ face[i].gazConf = STB_ERR_PE_CANNOT ;
+ face[i].gazStatus = STB_STATUS_NO_DATA ;
+ face[i].gazLR = STB_ERR_PE_CANNOT ;
+ face[i].gazUD = STB_ERR_PE_CANNOT ;
+ }
+ if( execFlg->dir == STB_TRUE )
+ {
+ face[i].dirConf = STB_ERR_PE_CANNOT ;
+ face[i].dirStatus = STB_STATUS_NO_DATA ;
+ face[i].dirYaw = STB_ERR_DIR_CANNOT ;
+ face[i].dirRoll = STB_ERR_DIR_CANNOT ;
+ face[i].dirPitch = STB_ERR_DIR_CANNOT ;
+ }
+ if( execFlg->bli == STB_TRUE )
+ {
+ face[i].bliL = STB_ERR_PE_CANNOT ;
+ face[i].bliR = STB_ERR_PE_CANNOT ;
+ face[i].bliStatus = STB_STATUS_NO_DATA ;
+ }
+
+}
+/*------------------------------------------------------------------------------------------------------------------*/
+/* SetFaceObject : Copy the tracking information */
+/*------------------------------------------------------------------------------------------------------------------*/
+VOID SetFaceObject( const STB_FRAME_RESULT_FACES* stbINPUTfaces ,FaceObj *faces , const STBExecFlg *execFlg , const STB_INT32 nTraCntMax)
+{
+ STB_INT32 nCount;
+ STB_INT32 i,nIdx1;
+
+
+ nCount = stbINPUTfaces->nCount;
+
+
+ for (i = 0; i < nCount; i++)
+ {
+ faces[i].nDetID = i;
+ faces[i].nTraID = STB_STATUS_NO_DATA;
+ }
+
+ if( execFlg->dir == STB_TRUE ) /*Face direction*/
+ {
+ for (i = 0; i < nCount; i++)
+ {
+ faces[i].dirConf = stbINPUTfaces->face[i].direction.nConfidence;
+ faces[i].dirYaw = stbINPUTfaces->face[i].direction.nLR;
+ faces[i].dirRoll = stbINPUTfaces->face[i].direction.nRoll;
+ faces[i].dirPitch = stbINPUTfaces->face[i].direction.nUD;
+ }
+ }
+ if( execFlg->age == STB_TRUE ) /*Age*/
+ {
+ for (i = 0; i < nCount; i++)
+ {
+ faces[i].ageConf = stbINPUTfaces->face[i].age.nConfidence;
+ faces[i].ageStatus = STB_STATUS_NO_DATA;
+ faces[i].ageVal = stbINPUTfaces->face[i].age.nAge;
+ }
+ }
+ if( execFlg->exp == STB_TRUE ) /*Facial expression*/
+ {
+ for (i = 0; i < nCount; i++)
+ {
+ faces[i].expConf = -1;// not degree
+ for (nIdx1 = STB_EX_NEUTRAL; nIdx1 < STB_EX_MAX;nIdx1++)
+ {
+ faces[i].expScore[ nIdx1] = stbINPUTfaces->face[i].expression.anScore[nIdx1];
+ }
+ faces[i].expStatus = STB_STATUS_NO_DATA;
+ faces[i].expVal = STB_EX_UNKNOWN;
+ }
+ }
+ if( execFlg->gen == STB_TRUE ) /*Gender*/
+ {
+ for (i = 0; i < nCount; i++)
+ {
+ faces[i].genConf = stbINPUTfaces->face[i].gender.nConfidence;
+ faces[i].genStatus = STB_STATUS_NO_DATA;
+ faces[i].genVal = stbINPUTfaces->face[i].gender.nGender;
+ }
+ }
+ if( execFlg->gaz == STB_TRUE ) /*Gaze*/
+ {
+ for (i = 0; i < nCount; i++)
+ {
+ faces[i].gazConf = stbINPUTfaces->face[i].direction.nConfidence;
+ faces[i].gazStatus = STB_STATUS_NO_DATA;
+ faces[i].gazLR = stbINPUTfaces->face[i].gaze.nLR;
+ faces[i].gazUD = stbINPUTfaces->face[i].gaze.nUD;
+ }
+ }
+ if( execFlg->fr == STB_TRUE ) /*Face recognition*/
+ {
+ for (i = 0; i < nCount; i++)
+ {
+ faces[i].frConf = stbINPUTfaces->face[i].recognition.nScore;
+ faces[i].frStatus = STB_STATUS_NO_DATA;
+ faces[i].frVal = stbINPUTfaces->face[i].recognition.nUID;
+ }
+ }
+ if( execFlg->bli == STB_TRUE ) //blink
+ {
+ for (i = 0; i < nCount; i++)
+ {
+ faces[i].bliL = stbINPUTfaces->face[i].blink.nLeftEye;
+ faces[i].bliR = stbINPUTfaces->face[i].blink.nRightEye;
+ }
+ }
+
+ /*The results exceeding the detection number are initialized*/
+ for ( i = nCount; i < nTraCntMax; i++)
+ {
+ ClearFace ( faces , i , execFlg );
+ }
+
+}
+
+
+/*------------------------------------------------------------------------------------------------------------------*/
+/* SetTrackingIDToFace : Tracking result ID is linked to face information */
+/*------------------------------------------------------------------------------------------------------------------*/
+VOID SetTrackingIDToFace(STB_INT32 TrackingNum,STB_INT32 DetectNum, TraObj *track,FaceObj *faces , const STBExecFlg *execFlg )
+{
+ STB_INT32 i,j;
+
+
+ /*If there is a detection result erased in the tracking result, it is deleted from the face information.*/
+ for( i = 0 ; i < DetectNum; i++)
+ {
+ /*termination if no more detected results*/
+ if(faces[i].nDetID < 0)
+ {
+ break;
+ }
+
+ /*Search for the same ID as the detection result from the tracking result*/
+ for( j = 0; j < TrackingNum ; j++)
+ {
+ if(track[j].nDetID == faces[i].nDetID)
+ {
+ faces[i].nTraID = track[j].nTraID;
+ break;
+ }
+ }
+
+ if( j >= TrackingNum){
+ /*If the detection ID is not included in the ID under tracking*/
+ ClearFace ( faces , i , execFlg);
+ for(j = j + 1 ; j < DetectNum; j++)
+ {
+ if(faces[j].nDetID < 0)
+ {
+ /*Repeat until detection result disappears*/
+ break;
+ }
+ /*Stuff up ahead of erasure*/
+ CopyFace ( (faces+j),(faces+j-1), execFlg );
+ }
+ }
+ }
+ /*After that, the processing for the face only during tracking (retry status)*/
+ for( j = 0 ; j < TrackingNum; j++)
+ {
+ if( track[j].nDetID < 0)
+ {
+ ClearFace ( faces , i , execFlg );/*It should have been cleared but just in case*/
+ faces[i].nDetID = track[j].nDetID;
+ faces[i].nTraID = track[j].nTraID;
+ i++;
+ }
+ }
+
+ return;
+}
+/*------------------------------------------------------------------------------------------------------------------*/
+/* SetFaceToPeInfo : Create input data for stabilization of property estimation from face information */
+/*------------------------------------------------------------------------------------------------------------------*/
+VOID SetFaceToPeInfo(STB_INT32 TrackingNum,FaceObj *faces,STB_PE_DET *peInfo)
+{
+ STB_INT32 nIdx,nIdx1;
+
+ peInfo->num = TrackingNum;
+ for(nIdx=0 ; nIdx < TrackingNum;nIdx++)
+ {
+ /*tracking result*/
+ peInfo->fcDet[nIdx].nDetID = faces[nIdx].nDetID ;
+ peInfo->fcDet[nIdx].nTraID = faces[nIdx].nTraID ;
+ /*Face direction estimation*/
+ peInfo->fcDet[nIdx].dirDetConf = faces[nIdx].dirConf ;
+ peInfo->fcDet[nIdx].dirDetYaw = faces[nIdx].dirYaw ;
+ peInfo->fcDet[nIdx].dirDetPitch = faces[nIdx].dirPitch ;
+ peInfo->fcDet[nIdx].dirDetRoll = faces[nIdx].dirRoll ;
+ /*Age estimation*/
+ peInfo->fcDet[nIdx].ageDetVal = faces[nIdx].ageVal ;
+ peInfo->fcDet[nIdx].ageDetConf = faces[nIdx].ageConf ;
+ /*Gaze estimation*/
+ peInfo->fcDet[nIdx].gazDetLR = faces[nIdx].gazLR ;
+ peInfo->fcDet[nIdx].gazDetUD = faces[nIdx].gazUD ;
+ /*Gender estimation*/
+ peInfo->fcDet[nIdx].genDetVal = faces[nIdx].genVal ;
+ peInfo->fcDet[nIdx].genDetConf = faces[nIdx].genConf ;
+ /*estimation of facial expression*/
+ peInfo->fcDet[nIdx].expDetConf = faces[nIdx].expConf ;
+ for( nIdx1 = 0; nIdx1 < STB_EX_MAX; nIdx1++)
+ {
+ peInfo->fcDet[nIdx].expDetVal[nIdx1] = faces[nIdx].expScore[nIdx1];
+ }
+ //blink
+ peInfo->fcDet[nIdx].bliDetL = faces[nIdx].bliL ;
+ peInfo->fcDet[nIdx].bliDetR = faces[nIdx].bliR ;
+
+
+ }
+ return;
+}
+/*------------------------------------------------------------------------------------------------------------------*/
+/* SetFaceToFrInfo : Create input data for stabilization of face recognition from face information */
+/*------------------------------------------------------------------------------------------------------------------*/
+VOID SetFaceToFrInfo(STB_INT32 TrackingNum,FaceObj *faces,STB_FR_DET *frInfo)
+{
+ STB_INT32 nIdx;
+
+
+ frInfo->num = TrackingNum;
+ for(nIdx=0 ; nIdx < TrackingNum;nIdx++)
+ {
+ /*tracking result*/
+ frInfo->fcDet[nIdx].nDetID = faces[nIdx].nDetID ;
+ frInfo->fcDet[nIdx].nTraID = faces[nIdx].nTraID ;
+
+ /*Face direction estimation*/
+ frInfo->fcDet[nIdx].dirDetConf = faces[nIdx].dirConf ;
+ frInfo->fcDet[nIdx].dirDetYaw = faces[nIdx].dirYaw ;
+ frInfo->fcDet[nIdx].dirDetPitch = faces[nIdx].dirPitch ;
+ frInfo->fcDet[nIdx].dirDetRoll = faces[nIdx].dirRoll ;
+
+ /*recognition result*/
+ frInfo->fcDet[nIdx].frDetConf = faces[nIdx].frConf ;
+ frInfo->fcDet[nIdx].frDetID = faces[nIdx].frVal ;
+
+ }
+ return;
+}
+/*------------------------------------------------------------------------------------------------------------------*/
+/* SetPeInfoToFace : Copy stabilization result of property estimation to face information */
+/*------------------------------------------------------------------------------------------------------------------*/
+VOID SetPeInfoToFace(STB_INT32 TrackingNum,STB_PE_RES *peInfo,FaceObj *faces, const STBExecFlg *execFlg )
+{
+ STB_INT32 i,j;
+
+ for( i = 0 ; i < TrackingNum; i++)
+ {
+ for( j = 0 ; j < TrackingNum; j++)
+ {
+ if(peInfo->peFace[j].nTraID == faces[i].nTraID )
+ {
+ if( execFlg->gen == STB_TRUE )
+ {
+ faces[i].genStatus = peInfo->peFace[j].gen.status ;
+ faces[i].genVal = peInfo->peFace[j].gen.value ;
+ faces[i].genConf = peInfo->peFace[j].gen.conf ;
+ }
+ if( execFlg->age == STB_TRUE )
+ {
+ faces[i].ageStatus = peInfo->peFace[j].age.status ;
+ faces[i].ageVal = peInfo->peFace[j].age.value ;
+ faces[i].ageConf = peInfo->peFace[j].age.conf ;
+ }
+ if( execFlg->exp == STB_TRUE )
+ {
+ faces[i].expStatus = peInfo->peFace[j].exp.status ;
+ faces[i].expVal = peInfo->peFace[j].exp.value ;
+ faces[i].expConf = peInfo->peFace[j].exp.conf ;
+ }
+ if( execFlg->gaz == STB_TRUE )
+ {
+ faces[i].gazStatus = peInfo->peFace[j].gaz.status ;
+ faces[i].gazConf = peInfo->peFace[j].gaz.conf ;
+ faces[i].gazLR = peInfo->peFace[j].gaz.LR ;
+ faces[i].gazUD = peInfo->peFace[j].gaz.UD ;
+ }
+ if( execFlg->dir == STB_TRUE )
+ {
+ faces[i].dirPitch = peInfo->peFace[j].dir.pitch ;
+ faces[i].dirRoll = peInfo->peFace[j].dir.roll ;
+ faces[i].dirYaw = peInfo->peFace[j].dir.yaw ;
+ faces[i].dirStatus = peInfo->peFace[j].dir.status ;
+ faces[i].dirConf = peInfo->peFace[j].dir.conf ;
+ }
+ if( execFlg->bli == STB_TRUE )
+ {
+ faces[i].bliL = peInfo->peFace[j].bli.ratioL ;
+ faces[i].bliR = peInfo->peFace[j].bli.ratioR ;
+ faces[i].bliStatus = peInfo->peFace[j].bli.status ;
+ }
+ break;
+ }
+ }
+ }
+
+ return;
+}
+/*------------------------------------------------------------------------------------------------------------------*/
+/* SetFrInfoToFace : Copy stabilization result of face recognition to face information */
+/*------------------------------------------------------------------------------------------------------------------*/
+VOID SetFrInfoToFace(STB_INT32 TrackingNum,STB_FR_RES *frInfo,FaceObj *faces)
+{
+ STB_INT32 i,j;
+
+ for( i = 0 ; i < TrackingNum; i++)
+ {
+ for( j = 0 ; j < TrackingNum; j++)
+ {
+ if(frInfo->frFace[j].nTraID == faces[i].nTraID)
+ {
+ faces[i].frStatus = frInfo->frFace[j].frRecog.status ;
+ faces[i].frVal = frInfo->frFace[j].frRecog.value ;
+ faces[i].frConf = frInfo->frFace[j].frRecog.conf ;
+ break;
+ }
+ }
+ }
+ return;
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HVC/STBLib/src/STB/STBMakeResult.c Tue Sep 05 10:01:51 2017 +0000
@@ -0,0 +1,119 @@
+/*---------------------------------------------------------------------------*/
+/* Copyright(C) 2017 OMRON Corporation */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
+/* See the License for the specific language governing permissions and */
+/* limitations under the License. */
+/*---------------------------------------------------------------------------*/
+
+#include "STBMakeResult.h"
+
+
+/*------------------------------------------------------------------------------------------------------------------*/
+/* SetFaceToResult */
+/*------------------------------------------------------------------------------------------------------------------*/
+VOID SetFaceToResult ( STB_INT32 TraCnt , TraObj* trObj , FaceObj* faceObj, STB_FACE* result, const STBExecFlg* execFlg )
+{
+ STB_INT32 i,j;
+ STB_INT32 tmpFlg;
+
+ tmpFlg = execFlg->gen
+ || execFlg->age
+ || execFlg->fr
+ || execFlg->exp
+ || execFlg->dir
+ || execFlg->gaz
+ || execFlg->bli ;
+
+
+ for( i = 0; i < TraCnt; i++)
+ {
+ result[i].nDetectID = trObj[i].nDetID ;
+ result[i].nTrackingID = trObj[i].nTraID ;
+ result[i].center.x = trObj[i].pos .x ;
+ result[i].center.y = trObj[i].pos .y ;
+ result[i].nSize = trObj[i].size ;
+ result[i].conf = trObj[i].conf ;
+
+ if( tmpFlg )
+ {
+ for( j = 0; j < TraCnt; j++)
+ {
+ if( trObj[i].nTraID == faceObj[j].nTraID )
+ {
+ if( execFlg->age == STB_TRUE )
+ {
+ result[i].age.status = faceObj[j].ageStatus ;
+ result[i].age.value = faceObj[j].ageVal ;
+ result[i].age.conf = faceObj[j].ageConf ;
+ }
+ if( execFlg->bli == STB_TRUE )
+ {
+ result[i].blink.ratioL = faceObj[j].bliL ;
+ result[i].blink.ratioR = faceObj[j].bliR ;
+ result[i].blink.status = faceObj[j].bliStatus ;
+ }
+ if( execFlg->dir == STB_TRUE )
+ {
+ result[i].direction.pitch = faceObj[j].dirPitch ;
+ result[i].direction.roll = faceObj[j].dirRoll ;
+ result[i].direction.yaw = faceObj[j].dirYaw ;
+ result[i].direction.status = faceObj[j].dirStatus ;
+ result[i].direction.conf = faceObj[j].dirConf ;
+ }
+ if( execFlg->exp == STB_TRUE )
+ {
+ result[i].expression.status = faceObj[j].expStatus ;
+ result[i].expression.value = faceObj[j].expVal ;
+ result[i].expression.conf = faceObj[j].expConf ;
+ }
+ if( execFlg->gaz == STB_TRUE )
+ {
+ result[i].gaze.status = faceObj[j].gazStatus ;
+ result[i].gaze.LR = faceObj[j].gazLR ;
+ result[i].gaze.UD = faceObj[j].gazUD ;
+ result[i].gaze.conf = faceObj[j].gazConf ;
+ }
+ if( execFlg->gen == STB_TRUE )
+ {
+ result[i].gender.status = faceObj[j].genStatus ;
+ result[i].gender.value = faceObj[j].genVal ;
+ result[i].gender.conf = faceObj[j].genConf ;
+ }
+ if( execFlg->fr == STB_TRUE )
+ {
+ result[i].recognition.status = faceObj[j].frStatus ;
+ result[i].recognition.value = faceObj[j].frVal ;
+ result[i].recognition.conf = faceObj[j].frConf ;
+ }
+ break;
+ }//if( trObj[i].nTraID == faceObj[j].nTraID )
+ }//for( j = 0; j < TraCnt; j++)
+ }//if( tmpFlg )
+ }//for( i = 0; i < TraCnt; i++)
+}
+/*------------------------------------------------------------------------------------------------------------------*/
+/* SetBodyToResult */
+/*------------------------------------------------------------------------------------------------------------------*/
+VOID SetBodyToResult(STB_INT32 TraCnt,TraObj* trObj, STB_BODY* result)
+{
+ STB_INT32 i;
+ for( i = 0; i < TraCnt; i++)
+ {
+ result[i].nDetectID = trObj[i].nDetID ;
+ result[i].nTrackingID = trObj[i].nTraID ;
+ result[i].center.x = trObj[i].pos.x ;
+ result[i].center.y = trObj[i].pos.y ;
+ result[i].nSize = trObj[i].size ;
+ result[i].conf = trObj[i].conf ;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HVC/STBLib/src/STB/STBTracking.c Tue Sep 05 10:01:51 2017 +0000
@@ -0,0 +1,138 @@
+/*---------------------------------------------------------------------------*/
+/* Copyright(C) 2017 OMRON Corporation */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
+/* See the License for the specific language governing permissions and */
+/* limitations under the License. */
+/*---------------------------------------------------------------------------*/
+
+#include "STBTracking.h"
+#include "STB_Debug.h"
+
+/*------------------------------------------------------------------------------------------------------------------*/
+/* SetTrackingObjectBody */
+/*------------------------------------------------------------------------------------------------------------------*/
+VOID SetTrackingObjectBody(const STB_FRAME_RESULT_BODYS* stbINPUTbodys,TraObj *bodys)
+{
+
+ STB_INT32 nCount;
+ STB_INT32 i;
+
+
+ /*make the human body information*/
+ nCount = stbINPUTbodys->nCount;
+
+ for ( i = 0; i < nCount; i++)
+ {
+ bodys[i].nDetID = i;
+ bodys[i].pos.x = stbINPUTbodys->body[i].center.nX ;
+ bodys[i].pos.y = stbINPUTbodys->body[i].center.nY ;
+ bodys[i].conf = stbINPUTbodys->body[i].nConfidence;
+ bodys[i].size = stbINPUTbodys->body[i].nSize ;
+ bodys[i].nTraID = STB_STATUS_NO_DATA;
+ }
+
+}
+/*------------------------------------------------------------------------------------------------------------------*/
+/* SetTrackingObjectFace */
+/*------------------------------------------------------------------------------------------------------------------*/
+VOID SetTrackingObjectFace ( const STB_FRAME_RESULT_FACES *stbINPUTfaces ,TraObj *faces )
+{
+
+ STB_INT32 nCount;
+ STB_INT32 i;
+
+
+ /*make the human body information*/
+ nCount = stbINPUTfaces->nCount;
+ for ( i = 0; i < nCount; i++)
+ {
+ faces[i].nDetID = i;
+ faces[i].pos.x = stbINPUTfaces->face[i].center.nX ;
+ faces[i].pos.y = stbINPUTfaces->face[i].center.nY ;
+ faces[i].conf = stbINPUTfaces->face[i].nConfidence;
+ faces[i].size = stbINPUTfaces->face[i].nSize ;
+ faces[i].nTraID = STB_STATUS_NO_DATA;
+ }
+
+}
+/*------------------------------------------------------------------------------------------------------------------*/
+/* SetSrcTrFace */
+/*------------------------------------------------------------------------------------------------------------------*/
+VOID SetSrcTrFace ( STB_INT32 nDetCntFace , TraObj *trFace, STB_TR_DET *trSrcInfo)
+{
+ STB_INT32 i;
+
+ trSrcInfo->fcNum = nDetCntFace;
+ for( i = 0; i < nDetCntFace; i++)
+ {
+ trSrcInfo->fcDet[i].conf = trFace[i].conf ;
+ trSrcInfo->fcDet[i].posX = trFace[i].pos .x ;
+ trSrcInfo->fcDet[i].posY = trFace[i].pos .y ;
+ trSrcInfo->fcDet[i].size = trFace[i].size ;
+ }
+}
+/*------------------------------------------------------------------------------------------------------------------*/
+/* SetSrcTrBody */
+/*------------------------------------------------------------------------------------------------------------------*/
+VOID SetSrcTrBody ( STB_INT32 nDetCntBody , TraObj *trBody, STB_TR_DET *trSrcInfo)
+{
+ STB_INT32 i;
+
+ trSrcInfo->bdNum = nDetCntBody;
+
+ for( i = 0; i < nDetCntBody; i++)
+ {
+ trSrcInfo->bdDet[i].conf = trBody[i].conf ;
+ trSrcInfo->bdDet[i].posX = trBody[i].pos .x ;
+ trSrcInfo->bdDet[i].posY = trBody[i].pos .y ;
+ trSrcInfo->bdDet[i].size = trBody[i].size ;
+ }
+}
+
+/*------------------------------------------------------------------------------------------------------------------*/
+/* SetTrackingInfoToFace : Reflect tracking result in structure of detection result */
+/*------------------------------------------------------------------------------------------------------------------*/
+VOID SetTrackingInfoToFace( STB_TR_RES_FACES *fdResult ,STB_INT32 *pnTrackingNum ,TraObj *faces )
+{
+ STB_INT32 nIdx;
+
+ *pnTrackingNum = fdResult->cnt;
+ for (nIdx = 0; nIdx < *pnTrackingNum; nIdx++)
+ {
+ faces[nIdx].nDetID = fdResult->face[nIdx].nDetID ;
+ faces[nIdx].nTraID = fdResult->face[nIdx].nTraID ;
+ faces[nIdx].pos .x = fdResult->face[nIdx].pos.x ;
+ faces[nIdx].pos .y = fdResult->face[nIdx].pos.y ;
+ faces[nIdx].size = fdResult->face[nIdx].size ;
+ faces[nIdx].conf = fdResult->face[nIdx].conf ;
+ }
+
+ return;
+}
+
+VOID SetTrackingInfoToBody(STB_TR_RES_BODYS *bdResult,STB_INT32 *pnTrackingNum,TraObj *bodys)
+{
+ STB_INT32 nIdx;
+
+ *pnTrackingNum = bdResult->cnt;
+ for (nIdx = 0; nIdx < *pnTrackingNum; nIdx++)
+ {
+ bodys[nIdx].nDetID = bdResult->body[nIdx].nDetID ;
+ bodys[nIdx].nTraID = bdResult->body[nIdx].nTraID ;
+ bodys[nIdx].pos .x = bdResult->body[nIdx].pos.x ;
+ bodys[nIdx].pos .y = bdResult->body[nIdx].pos.y ;
+ bodys[nIdx].size = bdResult->body[nIdx].size ;
+ bodys[nIdx].conf = bdResult->body[nIdx].conf ;
+ }
+
+ return;
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HVC/STBLib/src/STB/STBValidValue.c Tue Sep 05 10:01:51 2017 +0000
@@ -0,0 +1,138 @@
+/*---------------------------------------------------------------------------*/
+/* Copyright(C) 2017 OMRON Corporation */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
+/* See the License for the specific language governing permissions and */
+/* limitations under the License. */
+/*---------------------------------------------------------------------------*/
+
+#include "STBValidValue.h"
+
+/*Value range check*/
+#define IS_OUT_RANGE( val , min , max ) ( ( (val) < (min) ) || ( (max) < (val) ) )
+#define IS_OUT_VALUE( val , min , max , accept ) ( IS_OUT_RANGE( val , min , max ) && ( (val) != (accept) ) )
+#define IS_OUT_FR_UID( val , min , max , acceptA , acceptB , acceptC ) ( IS_OUT_RANGE( val , min , max ) && ( (val) != (acceptA) ) && ( (val) != (acceptB) ) && ( (val) != (acceptC) ) )
+#define IS_OUT_FR_SCORE( val , min , max , acceptA , acceptB ) ( IS_OUT_RANGE( val , min , max ) && ( (val) != (acceptA) ) && ( (val) != (acceptB) ) )
+
+/*------------------------------------------------------------------------------------------------------------------*/
+/* STB_IsValidValue */
+/*------------------------------------------------------------------------------------------------------------------*/
+STB_INT32 STB_IsValidValue(const STB_FRAME_RESULT *input, STBExecFlg *execFlg)
+{
+ STB_INT32 i ,j;
+
+
+
+ if( execFlg->bodyTr == STB_TRUE )
+ {
+ if( IS_OUT_RANGE( input->bodys.nCount , STB_BODY_CNT_MIN , STB_BODY_CNT_MAX ) ){ return STB_FALSE;}
+ for( i = 0 ; i < input->bodys.nCount ; i++)
+ {
+ if( IS_OUT_RANGE( input->bodys.body[i].center.nX , STB_BODY_XY_MIN , STB_BODY_XY_MAX ) ){ return STB_FALSE;}
+ if( IS_OUT_RANGE( input->bodys.body[i].center.nY , STB_BODY_XY_MIN , STB_BODY_XY_MAX ) ){ return STB_FALSE;}
+ if( IS_OUT_RANGE( input->bodys.body[i].nSize , STB_BODY_SIZE_MIN , STB_BODY_SIZE_MAX ) ){ return STB_FALSE;}
+ if( IS_OUT_RANGE( input->bodys.body[i].nConfidence , STB_BODY_CONF_MIN , STB_BODY_CONF_MAX ) ){ return STB_FALSE;}
+ }
+
+ }
+
+ if( execFlg->faceTr == STB_TRUE )
+ {
+ if( IS_OUT_RANGE( input->faces.nCount , STB_FACE_CNT_MIN , STB_FACE_CNT_MAX ) ){ return STB_FALSE;}
+ for( i = 0 ; i < input->faces.nCount ; i++)
+ {
+ if( IS_OUT_RANGE( input->faces.face[i].center.nX , STB_FACE_XY_MIN , STB_FACE_XY_MAX ) ){ return STB_FALSE;}
+ if( IS_OUT_RANGE( input->faces.face[i].center.nY , STB_FACE_XY_MIN , STB_FACE_XY_MAX ) ){ return STB_FALSE;}
+ if( IS_OUT_RANGE( input->faces.face[i].nSize , STB_FACE_SIZE_MIN , STB_FACE_SIZE_MAX ) ){ return STB_FALSE;}
+ if( IS_OUT_RANGE( input->faces.face[i].nConfidence , STB_FACE_CONF_MIN , STB_FACE_CONF_MAX ) ){ return STB_FALSE;}
+ }
+ }
+
+ if( execFlg->gen == STB_TRUE
+ || execFlg->age == STB_TRUE
+ || execFlg->fr == STB_TRUE
+ || execFlg->exp == STB_TRUE
+ || execFlg->dir == STB_TRUE
+ || execFlg->gaz == STB_TRUE
+ || execFlg->bli == STB_TRUE
+ )
+ {
+ for( i = 0 ; i < input->faces.nCount ; i++)
+ {
+ if( IS_OUT_RANGE( input->faces.face[i].direction.nLR , STB_FACE_DIR_LR_MIN , STB_FACE_DIR_LR_MAX ) ){ return STB_FALSE;}
+ if( IS_OUT_RANGE( input->faces.face[i].direction.nUD , STB_FACE_DIR_UD_MIN , STB_FACE_DIR_UD_MAX ) ){ return STB_FALSE;}
+ if( IS_OUT_RANGE( input->faces.face[i].direction.nRoll , STB_FACE_DIR_ROLL_MIN , STB_FACE_DIR_ROLL_MAX ) ){ return STB_FALSE;}
+ if( IS_OUT_RANGE( input->faces.face[i].direction.nConfidence , STB_FACE_DIR_CONF_MIN , STB_FACE_DIR_CONF_MAX ) ){ return STB_FALSE;}
+ }
+ }
+
+
+ if( execFlg->age == STB_TRUE )
+ {
+ for( i = 0 ; i < input->faces.nCount ; i++)
+ {
+ if( IS_OUT_VALUE( input->faces.face[i].age.nAge , STB_FACE_AGE_VAL_MIN , STB_FACE_AGE_VAL_MAX ,STB_ERR_PE_CANNOT ) ){ return STB_FALSE;}
+ if( IS_OUT_VALUE( input->faces.face[i].age.nConfidence , STB_FACE_AGE_CONF_MIN , STB_FACE_AGE_CONF_MAX ,STB_ERR_PE_CANNOT ) ){ return STB_FALSE;}
+ }
+ }
+
+ if( execFlg->gen == STB_TRUE )
+ {
+ for( i = 0 ; i < input->faces.nCount ; i++)
+ {
+ if( IS_OUT_VALUE( input->faces.face[i].gender.nGender , STB_FACE_GEN_VAL_MIN , STB_FACE_GEN_VAL_MAX ,STB_ERR_PE_CANNOT ) ){ return STB_FALSE;}
+ if( IS_OUT_VALUE( input->faces.face[i].gender.nConfidence , STB_FACE_GEN_CONF_MIN , STB_FACE_GEN_CONF_MAX ,STB_ERR_PE_CANNOT ) ){ return STB_FALSE;}
+ }
+ }
+
+ if( execFlg->gaz == STB_TRUE )
+ {
+ for( i = 0 ; i < input->faces.nCount ; i++)
+ {
+ if( IS_OUT_VALUE( input->faces.face[i].gaze.nLR , STB_FACE_GAZE_LR_MIN , STB_FACE_GAZE_LR_MAX ,STB_ERR_PE_CANNOT ) ){ return STB_FALSE;}
+ if( IS_OUT_VALUE( input->faces.face[i].gaze.nUD , STB_FACE_GAZE_UD_MIN , STB_FACE_GAZE_UD_MAX ,STB_ERR_PE_CANNOT ) ){ return STB_FALSE;}
+ }
+ }
+
+ if( execFlg->bli == STB_TRUE )
+ {
+ for( i = 0 ; i < input->faces.nCount ; i++)
+ {
+ if( IS_OUT_VALUE( input->faces.face[i].blink.nLeftEye , STB_FACE_BLI_L_MIN , STB_FACE_BLI_L_MAX ,STB_ERR_PE_CANNOT) ){ return STB_FALSE;}
+ if( IS_OUT_VALUE( input->faces.face[i].blink.nRightEye , STB_FACE_BLI_R_MIN , STB_FACE_BLI_R_MAX ,STB_ERR_PE_CANNOT) ){ return STB_FALSE;}
+ }
+ }
+
+ if( execFlg->exp == STB_TRUE )
+ {
+ for( i = 0 ; i < input->faces.nCount ; i++)
+ {
+ if( IS_OUT_VALUE( input->faces.face[i].expression.nDegree , STB_FACE_EXP_DEG_MIN , STB_FACE_EXP_DEG_MAX ,STB_ERR_PE_CANNOT) ){ return STB_FALSE;}
+ for( j = 0 ; j < STB_EX_MAX ; j++)
+ {
+ if( IS_OUT_VALUE( input->faces.face[i].expression.anScore[j] ,STB_FACE_EXP_SCORE_MIN , STB_FACE_EXP_SCORE_MAX ,STB_ERR_PE_CANNOT) ){ return STB_FALSE;}
+ }
+
+ }
+ }
+
+ if( execFlg->fr == STB_TRUE )
+ {
+ for( i = 0 ; i < input->faces.nCount ; i++)
+ {
+ if( IS_OUT_FR_UID( input->faces.face[i].recognition.nUID , STB_FACE_FR_UID_MIN , STB_FACE_FR_UID_MAX ,STB_ERR_FR_CANNOT ,STB_ERR_FR_NOID ,STB_ERR_FR_NOALBUM ) ){ return STB_FALSE;}
+ if( IS_OUT_FR_SCORE( input->faces.face[i].recognition.nScore , STB_FACE_FR_SCORE_MIN , STB_FACE_FR_SCORE_MAX ,STB_ERR_FR_CANNOT ,STB_ERR_FR_NOALBUM) ){ return STB_FALSE;}
+ }
+ }
+
+
+ return STB_TRUE;
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HVC/STBLib/src/STB/STBValidValue.h Tue Sep 05 10:01:51 2017 +0000 @@ -0,0 +1,94 @@ +/*---------------------------------------------------------------------------*/ +/* Copyright(C) 2017 OMRON Corporation */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ +/* See the License for the specific language governing permissions and */ +/* limitations under the License. */ +/*---------------------------------------------------------------------------*/ + +#ifndef STBVALIDVALUE_H__ +#define STBVALIDVALUE_H__ + +#include "STBTypedefInput.h" +#include "STBCommonDef.h" +#include "STBCommonType.h" + +/*-------------------------------------------------------------------*/ +/*Threshold for checking input value*/ +/*-------------------------------------------------------------------*/ +#define STB_BODY_CNT_MIN 0 // body +#define STB_BODY_CNT_MAX 35 +#define STB_BODY_XY_MIN 0 +#define STB_BODY_XY_MAX 8191 +#define STB_BODY_SIZE_MIN 20 +#define STB_BODY_SIZE_MAX 8192 +#define STB_BODY_CONF_MIN 0 +#define STB_BODY_CONF_MAX 1000 +#define STB_FACE_CNT_MIN 0 // face +#define STB_FACE_CNT_MAX 35 +#define STB_FACE_XY_MIN 0 +#define STB_FACE_XY_MAX 8191 +#define STB_FACE_SIZE_MIN 20 +#define STB_FACE_SIZE_MAX 8192 +#define STB_FACE_CONF_MIN 0 +#define STB_FACE_CONF_MAX 1000 +#define STB_FACE_DIR_LR_MIN -180 +#define STB_FACE_DIR_LR_MAX 179 +#define STB_FACE_DIR_UD_MIN -180 +#define STB_FACE_DIR_UD_MAX 179 +#define STB_FACE_DIR_ROLL_MIN -180 +#define STB_FACE_DIR_ROLL_MAX 179 +#define STB_FACE_DIR_CONF_MIN 0 +#define STB_FACE_DIR_CONF_MAX 1000 +#define STB_FACE_AGE_VAL_MIN 0 +#define STB_FACE_AGE_VAL_MAX 75 +#define STB_FACE_AGE_CONF_MIN 0 +#define STB_FACE_AGE_CONF_MAX 1000 +#define STB_FACE_GEN_VAL_MIN 0 +#define STB_FACE_GEN_VAL_MAX 1 +#define STB_FACE_GEN_CONF_MIN 0 +#define STB_FACE_GEN_CONF_MAX 1000 +#define STB_FACE_GAZE_LR_MIN -90 +#define STB_FACE_GAZE_LR_MAX 90 +#define STB_FACE_GAZE_UD_MIN -90 +#define STB_FACE_GAZE_UD_MAX 90 +#define STB_FACE_BLI_L_MIN 1 +#define STB_FACE_BLI_L_MAX 1000 +#define STB_FACE_BLI_R_MIN 1 +#define STB_FACE_BLI_R_MAX 1000 +#define STB_FACE_EXP_SCORE_MIN 0 +#define STB_FACE_EXP_SCORE_MAX 100 /* not 1000 */ +#define STB_FACE_EXP_DEG_MIN -100 +#define STB_FACE_EXP_DEG_MAX 100 +#define STB_FACE_FR_UID_MIN 0 +#define STB_FACE_FR_UID_MAX 499 +#define STB_FACE_FR_SCORE_MIN 0 +#define STB_FACE_FR_SCORE_MAX 1000 + +/*-------------------------------------------------------------------*/ +/*Permitted input value*/ +/*-------------------------------------------------------------------*/ +#define STB_ERR_PE_CANNOT -128 /*Estimation is not possible.*/ +#define STB_ERR_FR_CANNOT -128 /*Recognition impossible*/ +#define STB_ERR_FR_NOID -1 /*No corresponding ID*/ +#define STB_ERR_FR_NOALBUM -127 /*Not-registered in Album*/ +/*-------------------------------------------------------------------*/ +/*For collaboration with child library*/ +/*-------------------------------------------------------------------*/ +#define STB_ERR_DIR_CANNOT -256 /*Unable to angle estimation*/ + +/*-------------------------------------------------------------------*/ +/* Func */ +/*-------------------------------------------------------------------*/ +STB_INT32 STB_IsValidValue(const STB_FRAME_RESULT *input, STBExecFlg *execFlg); + +#endif /* COMMONDEF_H__ */ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HVC/STBLib/src/STB_FaceRecognition/FrInterface.c Tue Sep 05 10:01:51 2017 +0000
@@ -0,0 +1,509 @@
+/*---------------------------------------------------------------------------*/
+/* Copyright(C) 2017 OMRON Corporation */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
+/* See the License for the specific language governing permissions and */
+/* limitations under the License. */
+/*---------------------------------------------------------------------------*/
+
+#include "FrInterface.h"
+#include "STBFrAPI.h"
+
+/*Value range check*/
+#define ISVALID_RANGE( val , min , max ) ( ( (min) <= (val) ) && ( (val) <= (max) ) )
+
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+/*error check*/
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+static STB_INT32 FrIsValidValue(
+ const STB_INT32 nValue ,
+ const STB_INT32 nLimitMin ,
+ const STB_INT32 nLimitMax )
+{
+ STB_INT32 nRet;
+ for( nRet = STB_ERR_INVALIDPARAM; nRet != STB_NORMAL; nRet = STB_NORMAL ){
+ if( ! ISVALID_RANGE( nValue , nLimitMin , nLimitMax ) ){ break; }
+ }
+ return nRet;
+}
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+static STB_INT32 FrIsValidPointer( const VOID* pPointer )
+{
+ STB_INT32 nRet;
+ for( nRet = STB_ERR_INVALIDPARAM; nRet != STB_NORMAL; nRet = STB_NORMAL ){
+ if( NULL == pPointer ){ break; }
+ }
+ return nRet;
+}
+
+/*------------------------------------------------------------------------------------------------------------------*/
+/* CalcFrSize */
+/*------------------------------------------------------------------------------------------------------------------*/
+STB_UINT32 CalcFrSize ( STB_UINT32 nTraCntMax )
+{
+ STB_UINT32 retVal ;
+
+ retVal = 0 ;
+
+ retVal += 100 ;///Margin : alignment
+
+
+
+ retVal += sizeof( FR_DET ) * nTraCntMax ; // frDet.fcDet
+ retVal += sizeof( STB_FR_DET ) * STB_FR_BACK_MAX ; // frDetRec
+ retVal += sizeof( FR_DET ) * nTraCntMax * nTraCntMax ; // frDetRec[t].fcDet
+ retVal += sizeof( FR_RES ) * nTraCntMax ; // frRes.frFace
+
+ return retVal;
+}
+/*------------------------------------------------------------------------------------------------------------------*/
+/* ShareFrSize */
+/*------------------------------------------------------------------------------------------------------------------*/
+void ShareFrSize ( FRHANDLE handle )
+{
+
+ STB_UINT32 t;
+ STB_INT8 *stbPtr = handle->frPtr ;
+ STB_UINT32 nTraCntMax = handle->frCntMax ;
+
+ handle->frDet.fcDet = ( FR_DET* ) stbPtr; stbPtr += ( sizeof( FR_DET ) * nTraCntMax );
+ handle->frDetRec = ( STB_FR_DET* ) stbPtr; stbPtr += ( sizeof( STB_FR_DET ) * STB_FR_BACK_MAX);
+ for( t = 0 ; t < STB_FR_BACK_MAX ; t++ )
+ {
+ handle->frDetRec[t].fcDet = ( FR_DET* ) stbPtr; stbPtr += ( sizeof( FR_DET ) * nTraCntMax );
+ }
+ handle->frRes.frFace = ( FR_RES * ) stbPtr; stbPtr += ( sizeof( FR_RES ) * nTraCntMax );
+
+}
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+/*Create handle*/
+FRHANDLE FrCreateHandle( const STB_INT32 nTraCntMax )
+
+{
+
+ FRHANDLE handle;
+ STB_INT32 t , i ;
+ STB_INT32 tmpVal;
+
+
+
+ if( nTraCntMax < 1 || STB_FR_TRA_CNT_MAX < nTraCntMax )
+ {
+ return NULL;
+ }
+
+ /*do handle's Malloc here*/
+ handle = (FRHANDLE)malloc(sizeof(*handle));
+ if(handle == NULL)
+ {
+ return NULL;
+ }
+
+
+ /*initial value---------------------------------------------------------------------*/
+ handle->frFaceDirUDMax = STB_FR_DIR_MAX_UD_INI ;
+ handle->frFaceDirUDMin = STB_FR_DIR_MIN_UD_INI ;
+ handle->frFaceDirLRMax = STB_FR_DIR_MAX_LR_INI ;
+ handle->frFaceDirLRMin = STB_FR_DIR_MIN_LR_INI ;
+ handle->frCntMax = nTraCntMax ;//Maximum number of tracking people
+ handle->frFaceDirThr = STB_FR_DIR_THR_INI ;//If the confidence of Face direction estimation doesn't exceed the reference value, the recognition result isn't trusted.
+ handle->frFrameCount = STB_FR_FRAME_CNT_INI ;
+ handle->frFrameRatio = STB_FR_FRAME_RATIO_INI ;
+ handle->frPtr = NULL;
+ handle->frDet.num = 0;
+ handle->frDet.fcDet = NULL;
+ handle->frDetRec = NULL;
+ handle->frRes.frCnt = 0;
+ handle->frRes.frFace = NULL;
+
+ tmpVal = CalcFrSize ( nTraCntMax ); /*calculate necessary amount in the Fr handle*/
+ handle->frPtr = NULL;
+ handle->frPtr = ( STB_INT8 * )malloc( tmpVal ); /*keeping necessary amount in the Fr handle*/
+ if( handle->frPtr == NULL )
+ {
+ free ( handle->frPtr );
+ free ( handle );
+ return NULL;
+ }
+
+ /* Malloc-area is allocated to things that need Malloc in FR handle */
+ ShareFrSize ( handle );
+
+
+
+
+ for( t = 0 ; t < STB_FR_BACK_MAX ; t++ )
+ {
+ handle->frDetRec [ t ].num = 0;
+ for( i = 0 ; i < handle->frCntMax ; i++ )
+ {
+ handle->frDetRec [ t ].fcDet[i].nDetID = STB_STATUS_NO_DATA ;
+ handle->frDetRec [ t ].fcDet[i].nTraID = STB_STATUS_NO_DATA ;
+ handle->frDetRec [ t ].fcDet[i].dirDetPitch = STB_STATUS_NO_DATA ;
+ handle->frDetRec [ t ].fcDet[i].dirDetRoll = STB_STATUS_NO_DATA ;
+ handle->frDetRec [ t ].fcDet[i].dirDetYaw = STB_STATUS_NO_DATA ;
+ handle->frDetRec [ t ].fcDet[i].frDetConf = STB_STATUS_NO_DATA ;
+ handle->frDetRec [ t ].fcDet[i].frDetID = STB_STATUS_NO_DATA ;
+ handle->frDetRec [ t ].fcDet[i].frDetConf = STB_STATUS_NO_DATA ;
+ handle->frDetRec [ t ].fcDet[i].frStatus = STB_STATUS_NO_DATA ;
+
+ }
+ }
+
+ return handle;
+}
+
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+/*Delete handle*/
+STB_INT32 FrDeleteHandle(FRHANDLE handle){
+ STB_INT32 nRet;
+
+ /*NULL check*/
+ nRet = FrIsValidPointer(handle);
+ if(nRet != STB_ERR_NOHANDLE){
+ return nRet;
+ }
+
+ free ( handle->frPtr );
+ free ( handle );
+
+ return STB_NORMAL;
+}
+
+
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+/*Set the result*/
+STB_INT32 FrSetDetect(FRHANDLE handle,const STB_FR_DET *stbFrDet){
+
+ STB_INT32 nRet;
+ STB_INT32 i;
+
+ /*NULL check*/
+ nRet = FrIsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+
+ nRet = FrIsValidPointer(stbFrDet);
+ if(nRet != STB_NORMAL){
+ return nRet;
+ }
+
+ /*Input value check*/
+ nRet = STB_FrIsValidValue ( stbFrDet );
+ if(nRet != STB_TRUE)
+ {
+ return STB_ERR_INVALIDPARAM;
+ }
+
+
+ /*Set the received result to the handle*/
+ /* Face */
+ if( stbFrDet->num > handle->frCntMax )
+ {
+ return STB_ERR_PROCESSCONDITION;
+ }
+ handle->frDet.num = stbFrDet->num;
+ for( i = 0 ; i < handle->frDet.num ; i++ )
+ {
+
+ handle->frDet.fcDet[i].nDetID = stbFrDet->fcDet[i].nDetID ;
+ handle->frDet.fcDet[i].nTraID = stbFrDet->fcDet[i].nTraID ;
+ handle->frDet.fcDet[i].dirDetPitch = stbFrDet->fcDet[i].dirDetPitch;
+ handle->frDet.fcDet[i].dirDetRoll = stbFrDet->fcDet[i].dirDetRoll ;
+ handle->frDet.fcDet[i].dirDetYaw = stbFrDet->fcDet[i].dirDetYaw ;
+ handle->frDet.fcDet[i].dirDetConf = stbFrDet->fcDet[i].dirDetConf ;
+ handle->frDet.fcDet[i].frDetID = stbFrDet->fcDet[i].frDetID ;
+ handle->frDet.fcDet[i].frDetConf = stbFrDet->fcDet[i].frDetConf ;
+
+ }
+
+
+
+ return STB_NORMAL;
+}
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+/*Main process execution*/
+STB_INT32 FrExecute(FRHANDLE handle){
+ STB_INT32 nRet;
+ /*NULL check*/
+ nRet = FrIsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+
+ /*Main processing here*/
+ nRet = StbFrExec ( handle );
+
+ return STB_NORMAL;
+}
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+/*Get-Function of results*/
+STB_INT32 FrGetResult(FRHANDLE handle,STB_FR_RES* frResult){
+ STB_INT32 nRet;
+ int i;
+
+ /*NULL check*/
+ nRet = FrIsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+
+ nRet = FrIsValidPointer(frResult);
+ if(nRet != STB_NORMAL){
+ return nRet;
+ }
+
+ /*Get result from handle*/
+ frResult->frCnt = handle->frRes.frCnt ;
+ for( i = 0 ; i < frResult->frCnt ; i++ ){
+ frResult->frFace[i].nTraID = handle->frRes.frFace[i].nTraID ;
+ frResult->frFace[i].frRecog.value = handle->frRes.frFace[i].frRecog.value ;
+ frResult->frFace[i].frRecog.status = handle->frRes.frFace[i].frRecog.status ;
+ frResult->frFace[i].frRecog.conf = handle->frRes.frFace[i].frRecog.conf ;
+ }
+
+ return STB_NORMAL;
+}
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+STB_INT32 FrSetFaceDirMinMax(FRHANDLE handle , STB_INT32 nMinUDAngle , STB_INT32 nMaxUDAngle ,STB_INT32 nMinLRAngle , STB_INT32 nMaxLRAngle)
+{
+
+ STB_INT32 nRet;
+ /*NULL check*/
+ nRet = FrIsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+
+ if( nMinUDAngle < STB_FR_DIR_MIN_UD_MIN || STB_FR_DIR_MIN_UD_MAX < nMinUDAngle)
+ {
+ return STB_ERR_INVALIDPARAM;
+ }
+ if( nMaxUDAngle < STB_FR_DIR_MAX_UD_MIN || STB_FR_DIR_MAX_UD_MAX < nMaxUDAngle)
+ {
+ return STB_ERR_INVALIDPARAM;
+ }
+ if( nMaxUDAngle < nMinUDAngle)
+ {
+ return STB_ERR_INVALIDPARAM;
+ }
+
+
+ if( nMinLRAngle < STB_FR_DIR_MIN_LR_MIN || STB_FR_DIR_MIN_LR_MAX < nMinLRAngle)
+ {
+ return STB_ERR_INVALIDPARAM;
+ }
+ if( nMaxLRAngle < STB_FR_DIR_MAX_LR_MIN || STB_FR_DIR_MAX_LR_MAX < nMaxLRAngle)
+ {
+ return STB_ERR_INVALIDPARAM;
+ }
+ if( nMaxLRAngle < nMinLRAngle)
+ {
+ return STB_ERR_INVALIDPARAM;
+ }
+
+
+ handle->frFaceDirUDMin = nMinUDAngle;
+ handle->frFaceDirUDMax = nMaxUDAngle;
+ handle->frFaceDirLRMin = nMinLRAngle;
+ handle->frFaceDirLRMax = nMaxLRAngle;
+ return STB_NORMAL;
+}
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+STB_INT32 FrGetFaceDirMinMax(FRHANDLE handle , STB_INT32 *pnMinUDAngle , STB_INT32 *pnMaxUDAngle ,STB_INT32 *pnMinLRAngle, STB_INT32 *pnMaxLRAngle )
+{
+ STB_INT32 nRet;
+ /*NULL check*/
+ nRet = FrIsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+ nRet = FrIsValidPointer(pnMinUDAngle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_INVALIDPARAM;
+ }
+ nRet = FrIsValidPointer(pnMaxUDAngle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_INVALIDPARAM;
+ }
+ nRet = FrIsValidPointer(pnMinLRAngle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_INVALIDPARAM;
+ }
+ nRet = FrIsValidPointer(pnMaxLRAngle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_INVALIDPARAM;
+ }
+
+
+ *pnMinUDAngle = handle->frFaceDirUDMin ;
+ *pnMaxUDAngle = handle->frFaceDirUDMax ;
+ *pnMinLRAngle = handle->frFaceDirLRMin ;
+ *pnMaxLRAngle = handle->frFaceDirLRMax ;
+ return STB_NORMAL;
+}
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+STB_INT32 FrClear ( FRHANDLE handle )
+{
+ //clear processing
+
+ STB_INT32 t , i ;
+ STB_INT32 nRet;
+
+ /*NULL check*/
+ nRet = FrIsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+
+ for( t = 0 ; t < STB_FR_BACK_MAX ; t++ )
+ {
+ handle->frDetRec [ t ].num = 0;
+ for( i = 0 ; i < handle->frCntMax ; i++ )
+ {
+ handle->frDetRec [ t ].fcDet[i].nDetID = STB_STATUS_NO_DATA ;
+ handle->frDetRec [ t ].fcDet[i].nTraID = STB_STATUS_NO_DATA ;
+ handle->frDetRec [ t ].fcDet[i].dirDetPitch = STB_STATUS_NO_DATA ;
+ handle->frDetRec [ t ].fcDet[i].dirDetRoll = STB_STATUS_NO_DATA ;
+ handle->frDetRec [ t ].fcDet[i].dirDetYaw = STB_STATUS_NO_DATA ;
+ handle->frDetRec [ t ].fcDet[i].dirDetConf = STB_STATUS_NO_DATA ;
+ handle->frDetRec [ t ].fcDet[i].frDetID = STB_STATUS_NO_DATA ;
+ handle->frDetRec [ t ].fcDet[i].frDetConf = STB_STATUS_NO_DATA ;
+ handle->frDetRec [ t ].fcDet[i].frStatus = STB_STATUS_NO_DATA ;
+
+ }
+ }
+ return STB_NORMAL;
+
+
+}
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+STB_INT32 FrSetFaceDirThreshold(FRHANDLE handle , STB_INT32 threshold )
+{
+ STB_INT32 nRet;
+ /*NULL check*/
+ nRet = FrIsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+
+ if( threshold < STB_FR_DIR_THR_MIN || STB_FR_DIR_THR_MAX < threshold)
+ {
+ return STB_ERR_INVALIDPARAM;
+ }
+ handle->frFaceDirThr = threshold;
+ return STB_NORMAL;
+}
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+STB_INT32 FrGetFaceDirThreshold(FRHANDLE handle , STB_INT32* threshold )
+{
+ STB_INT32 nRet;
+
+ /*NULL check*/
+ nRet = FrIsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+ nRet = FrIsValidPointer(threshold);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_INVALIDPARAM;
+ }
+
+ *threshold = handle->frFaceDirThr ;
+ return STB_NORMAL;
+}
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+STB_INT32 FrSetFrameCount(FRHANDLE handle , STB_INT32 nFrameCount )
+{
+
+ STB_INT32 nRet;
+ /*NULL check*/
+ nRet = FrIsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+ if( nFrameCount < STB_FR_FRAME_CNT_MIN || STB_FR_FRAME_CNT_MAX < nFrameCount)
+ {
+ return STB_ERR_INVALIDPARAM;
+ }
+ handle->frFrameCount = nFrameCount;
+ return STB_NORMAL;
+}
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+STB_INT32 FrGetFrameCount(FRHANDLE handle , STB_INT32* nFrameCount )
+{
+ STB_INT32 nRet;
+ /*NULL check*/
+ nRet = FrIsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+ nRet = FrIsValidPointer(nFrameCount);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_INVALIDPARAM;
+ }
+
+ *nFrameCount = handle->frFrameCount ;
+ return STB_NORMAL;
+}
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+STB_INT32 FrSetMinRatio(FRHANDLE handle , STB_INT32 nMinRatio )
+{
+ STB_INT32 nRet;
+ /*NULL check*/
+ nRet = FrIsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+ if( nMinRatio < STB_FR_FRAME_RATIO_MIN || STB_FR_FRAME_RATIO_MAX < nMinRatio)
+ {
+ return STB_ERR_INVALIDPARAM;
+ }
+ handle->frFrameRatio = nMinRatio;
+ return STB_NORMAL;
+}
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+STB_INT32 FrGetMinRatio(FRHANDLE handle , STB_INT32* nMinRatio )
+{
+ STB_INT32 nRet;
+ /*NULL check*/
+ nRet = FrIsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+ nRet = FrIsValidPointer(nMinRatio);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_INVALIDPARAM;
+ }
+
+ *nMinRatio = handle->frFrameRatio ;
+ return STB_NORMAL;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HVC/STBLib/src/STB_FaceRecognition/FrInterface.h Tue Sep 05 10:01:51 2017 +0000
@@ -0,0 +1,121 @@
+/*---------------------------------------------------------------------------*/
+/* Copyright(C) 2017 OMRON Corporation */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
+/* See the License for the specific language governing permissions and */
+/* limitations under the License. */
+/*---------------------------------------------------------------------------*/
+
+#if !defined( _INTERFACE_H_ )
+#define _INTERFACE_H_
+
+#include "STBFrTypedef.h"
+#include "STBCommonDef.h"
+#include "STBCommonType.h"
+#include "STBFrValidValue.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+//////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////
+/////////// Define //////////////
+//////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////
+
+
+#define STB_FR_BACK_MAX 20 /* refer to past "STB_BACK_MAX" frames of results */
+
+#define STB_FR_TRA_CNT_MAX 35
+
+#define STB_FR_INVALID_UID -999
+
+#define STB_FR_DIR_MIN_UD_INI -15
+#define STB_FR_DIR_MIN_UD_MIN -90
+#define STB_FR_DIR_MIN_UD_MAX 90
+
+#define STB_FR_DIR_MAX_UD_INI 20
+#define STB_FR_DIR_MAX_UD_MIN -90
+#define STB_FR_DIR_MAX_UD_MAX 90
+
+#define STB_FR_DIR_MIN_LR_INI -30
+#define STB_FR_DIR_MIN_LR_MIN -90
+#define STB_FR_DIR_MIN_LR_MAX 90
+
+#define STB_FR_DIR_MAX_LR_INI 30
+#define STB_FR_DIR_MAX_LR_MIN -90
+#define STB_FR_DIR_MAX_LR_MAX 90
+
+#define STB_FR_DIR_THR_INI 300
+#define STB_FR_DIR_THR_MIN 0
+#define STB_FR_DIR_THR_MAX 1000
+
+#define STB_FR_FRAME_CNT_INI 5
+#define STB_FR_FRAME_CNT_MIN 0
+#define STB_FR_FRAME_CNT_MAX 20
+
+#define STB_FR_FRAME_RATIO_INI 60
+#define STB_FR_FRAME_RATIO_MIN 0
+#define STB_FR_FRAME_RATIO_MAX 100
+
+//////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////
+/////////// Struct //////////////
+//////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////
+typedef struct tagFRHANDLE {
+
+ STB_INT8 *frPtr ;
+
+ /* param */
+ STB_INT32 frCntMax ;//Maximum number of tracking people
+ STB_INT32 frFaceDirUDMax ;//The face on top/down allowable range max.
+ STB_INT32 frFaceDirUDMin ;//The face on top/down allowable range min.
+ STB_INT32 frFaceDirLRMax ;//The face on left /right side allowable range max.
+ STB_INT32 frFaceDirLRMin ;//The face on left /right side allowable range min.
+ STB_INT32 frFaceDirThr ;//If the confidence of Face direction estimation doesn't exceed the reference value, the recognition result isn't trusted.
+ STB_INT32 frFrameCount ;
+ STB_INT32 frFrameRatio ;
+ /* FR_Face */
+ STB_FR_DET frDet ;//Present data before the stabilization(input).
+ STB_FR_DET *frDetRec ;//past data before the stabilization
+ STB_FR_RES frRes ;//present data after the stabilization(output)
+
+} *FRHANDLE;
+
+
+//////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////
+/////////// Func //////////////
+//////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////
+FRHANDLE FrCreateHandle ( const STB_INT32 nTraCntMax );
+STB_INT32 FrDeleteHandle ( FRHANDLE handle);
+STB_INT32 FrSetDetect ( FRHANDLE handle,const STB_FR_DET *stbPeDet);
+STB_INT32 FrExecute ( FRHANDLE handle);
+STB_INT32 FrClear ( FRHANDLE handle );
+STB_INT32 FrGetResult ( FRHANDLE handle , STB_FR_RES* peResult);
+
+STB_INT32 FrSetFaceDirMinMax( FRHANDLE handle , STB_INT32 nMinUDAngle , STB_INT32 nMaxUDAngle ,STB_INT32 nMinLRAngle , STB_INT32 nMaxLRAngle);
+STB_INT32 FrGetFaceDirMinMax( FRHANDLE handle , STB_INT32 *pnMinUDAngle , STB_INT32 *pnMaxUDAngle ,STB_INT32 *pnMinLRAngle, STB_INT32 *pnMaxLRAngle );
+STB_INT32 FrSetFaceDirThreshold ( FRHANDLE handle , STB_INT32 threshold );
+STB_INT32 FrGetFaceDirThreshold ( FRHANDLE handle , STB_INT32* threshold );
+STB_INT32 FrSetFrameCount ( FRHANDLE handle , STB_INT32 nFrameCount );
+STB_INT32 FrGetFrameCount ( FRHANDLE handle , STB_INT32* nFrameCount );
+STB_INT32 FrSetMinRatio ( FRHANDLE handle , STB_INT32 nMinRatio );
+STB_INT32 FrGetMinRatio ( FRHANDLE handle , STB_INT32* nMinRatio );
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HVC/STBLib/src/STB_FaceRecognition/STBFrAPI.c Tue Sep 05 10:01:51 2017 +0000
@@ -0,0 +1,326 @@
+/*---------------------------------------------------------------------------*/
+/* Copyright(C) 2017 OMRON Corporation */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
+/* See the License for the specific language governing permissions and */
+/* limitations under the License. */
+/*---------------------------------------------------------------------------*/
+
+#include "STBFrAPI.h"
+
+/*---------------------------------------------------------------------*/
+// FrSlideFacesRec
+/*---------------------------------------------------------------------*/
+void FrSlideFacesRec ( STB_FR_DET *facesRec )
+{
+ STB_INT32 t , i ;
+
+ for( t = STB_FR_BACK_MAX - 2 ; t >= 0 ; t-- )
+ {
+ facesRec [ t + 1 ].num = facesRec[ t + 0 ].num;
+ for( i = 0 ; i < facesRec [ t + 1 ].num ; i++ )
+ {
+ facesRec [ t + 1 ].fcDet[i].nDetID = facesRec [ t ].fcDet[i].nDetID ;
+ facesRec [ t + 1 ].fcDet[i].nTraID = facesRec [ t ].fcDet[i].nTraID ;
+
+ facesRec [ t + 1 ].fcDet[i].dirDetPitch = facesRec [ t ].fcDet[i].dirDetPitch ;
+ facesRec [ t + 1 ].fcDet[i].dirDetRoll = facesRec [ t ].fcDet[i].dirDetRoll ;
+ facesRec [ t + 1 ].fcDet[i].dirDetYaw = facesRec [ t ].fcDet[i].dirDetYaw ;
+ facesRec [ t + 1 ].fcDet[i].dirDetConf = facesRec [ t ].fcDet[i].dirDetConf ;
+ facesRec [ t + 1 ].fcDet[i].frDetID = facesRec [ t ].fcDet[i].frDetID ;
+ facesRec [ t + 1 ].fcDet[i].frDetConf = facesRec [ t ].fcDet[i].frDetConf ;
+ facesRec [ t + 1 ].fcDet[i].frStatus = facesRec [ t ].fcDet[i].frStatus ;
+
+ }
+ }
+}
+/*---------------------------------------------------------------------*/
+// FrCurFaces
+/*---------------------------------------------------------------------*/
+void FrCurFaces ( STB_FR_DET *facesRec , STB_FR_DET *srcFace )
+{
+ STB_INT32 i ;
+
+
+ facesRec [ 0 ].num = srcFace->num;
+ for( i = 0 ; i < facesRec [ 0 ].num ; i++ )
+ {
+ facesRec [ 0 ].fcDet[i].nDetID = srcFace->fcDet[i].nDetID ;
+ facesRec [ 0 ].fcDet[i].nTraID = srcFace->fcDet[i].nTraID ;
+ facesRec [ 0 ].fcDet[i].dirDetPitch = srcFace->fcDet[i].dirDetPitch ;
+ facesRec [ 0 ].fcDet[i].dirDetRoll = srcFace->fcDet[i].dirDetRoll ;
+ facesRec [ 0 ].fcDet[i].dirDetYaw = srcFace->fcDet[i].dirDetYaw ;
+ facesRec [ 0 ].fcDet[i].dirDetConf = srcFace->fcDet[i].dirDetConf ;
+ facesRec [ 0 ].fcDet[i].frDetID = srcFace->fcDet[i].frDetID ;
+ facesRec [ 0 ].fcDet[i].frDetConf = srcFace->fcDet[i].frDetConf ;
+ facesRec [ 0 ].fcDet[i].frStatus = STB_STATUS_NO_DATA ;
+
+ }
+
+}
+
+
+/*---------------------------------------------------------------------*/
+// FrStbFaceEasy
+/*---------------------------------------------------------------------*/
+void
+FrStbFaceEasy
+ (
+ STB_FR_RES* peRes ,
+ STB_FR_DET* peRec ,
+ STB_INT32 dirThr ,
+ STB_INT32 dirUDMax ,
+ STB_INT32 dirUDMin ,
+ STB_INT32 dirLRMax ,
+ STB_INT32 dirLRMin ,
+ STB_INT32 frmCnt ,
+ STB_INT32 frmRatio
+
+
+ )
+{
+ STB_INT32 i, t, k;
+ STB_INT32 trID;
+ STB_INT32 recCnt;
+ STB_INT32 recUID [STB_FR_BACK_MAX];
+ STB_INT32 recConf [STB_FR_BACK_MAX];
+
+ STB_INT32 accUID [STB_FR_BACK_MAX];
+ STB_INT32 accCnt [STB_FR_BACK_MAX];
+ STB_INT32 accKind;
+ STB_INT32 tmpUID;
+ STB_INT32 tmpCnt;
+ STB_INT32 tmpConf;
+ STB_INT32 topUID;
+ STB_INT32 topCnt;
+ STB_STATUS preStatus ;
+ STB_INT32 preUID ;
+ STB_INT32 preConf ;
+
+
+ for( t = 0; t < STB_FR_BACK_MAX ; t++)
+ {
+ recUID [t] = STB_FR_INVALID_UID;
+ recConf [t] = 0;
+ accUID [t] = STB_FR_INVALID_UID;
+ accCnt [t] = 0;
+ }
+
+
+ /*Checking the past data here, fill in all peRes.*/
+ /*do stabilization processing each tracking person*/
+
+ peRes->frCnt = peRec[0].num;
+ for( k = 0; k < peRes->frCnt; k++)
+ {
+ /*Tracking person number in the through frame*/
+ trID = peRec[0].fcDet[k].nTraID;
+
+ // peRes Add -------------------------------------------------------------------------------------------------
+ peRes->frFace[k].nTraID = trID;
+
+
+ //in case of unregistered album for present UID(no album files)
+ if( peRec[0].fcDet[k].frDetID == STB_ERR_FR_NOALBUM )
+ {
+ peRes->frFace[k].frRecog.value = STB_ERR_FR_NOALBUM ;
+ peRes->frFace[k].frRecog.status = STB_STATUS_NO_DATA ;
+ peRes->frFace[k].frRecog.conf = STB_CONF_NO_DATA ;
+ peRec[0].fcDet[k].frDetID = STB_ERR_FR_NOALBUM ;
+ peRec[0].fcDet[k].frStatus = STB_STATUS_NO_DATA ;
+ peRec[0].fcDet[k].frDetConf = STB_CONF_NO_DATA ;
+ continue;
+ }
+
+ // preStatus -------------------------------------------------------------------------------------------------
+ preStatus = STB_STATUS_NO_DATA ;
+ preUID = STB_FR_INVALID_UID ;
+ preConf = 0 ;
+ for( i = 0; i < peRec[1].num ; i++)
+ {
+ if( peRec[1].fcDet[i].nTraID == trID )
+ {
+ preUID = peRec[1].fcDet[i].frDetID ;
+ preStatus = peRec[1].fcDet[i].frStatus ;
+ preConf = peRec[1].fcDet[i].frDetConf ;
+ break;
+ }
+ }
+
+
+ // -------------------------------------------------------------------------------------------------
+ // -------------------------------------------------------------------------------------------------
+ if ( preStatus == STB_STATUS_NO_DATA //stabilization impossible: no data of the relevant people
+ || preStatus == STB_STATUS_CALCULATING //during stabilization : a number of data for relevant people aren't enough(a number of frames that relevant people are taken)
+ )
+ {
+ // -------------------------------------------------------------------------------------------------
+ //Setting "recUID" to past data of Tracking ID(trID) : (Up to "frmCnt")
+ // -------------------------------------------------------------------------------------------------
+ recCnt = 0;
+ for( t = 0; t < STB_FR_BACK_MAX ; t++) //previous t frame
+ {
+ for( i = 0; i < peRec[t].num ; i++) //a number of tracking people(previous t frame)
+ {
+ if(
+ peRec [ t ].fcDet[i].nTraID == trID //the same tracking number
+ && peRec [ t ].fcDet[i].nDetID >= 0 //not lost
+ && peRec [ t ].fcDet[i].dirDetConf >= dirThr // Face angle : confidence
+ && peRec [ t ].fcDet[i].dirDetPitch >= dirUDMin // Face angle : pitch
+ && peRec [ t ].fcDet[i].dirDetPitch <= dirUDMax // Face angle : pitch
+ && peRec [ t ].fcDet[i].dirDetYaw >= dirLRMin // Face angle : yaw
+ && peRec [ t ].fcDet[i].dirDetYaw <= dirLRMax // Face angle : yaw
+ && peRec [ t ].fcDet[i].frDetID != STB_ERR_FR_CANNOT //Recognition impossible
+ && peRec [ t ].fcDet[i].frDetID != STB_ERR_FR_NOALBUM // Not-registered in Album
+ )
+ {
+ recUID [ recCnt ] = peRec [ t ].fcDet[ i ].frDetID ;
+ recConf[ recCnt ] = peRec [ t ].fcDet[ i ].frDetConf;
+ recCnt++;
+ break;
+ }
+ }
+ if( recCnt == frmCnt )
+ {
+ break ;//Maximum number is frmCnt
+ }
+ }
+ // -------------------------------------------------------------------------------------------------
+ // tmpConf
+ // -------------------------------------------------------------------------------------------------
+ tmpConf = 0;
+ for( i = 0 ; i < recCnt ; i++)
+ {
+ tmpConf += recConf[ i ];
+ }
+ if( recCnt > 0 )
+ {
+ tmpConf /= recCnt;
+ }else
+ {
+ tmpConf = 0 ;
+ }
+ // -------------------------------------------------------------------------------------------------
+ //Create a cumulative frequency distribution of recUID and set it to accUID [accKind] accCnt [accKind].
+ //AccCnt [i] pieces of data (in the past) determined to be "accUID [i]".
+ // -------------------------------------------------------------------------------------------------
+ accKind = 0;
+ for(;;)
+ {
+ tmpUID = STB_FR_INVALID_UID;
+ for( i = 0 ; i < recCnt ; i++)
+ {
+ if( recUID[ i ] != STB_FR_INVALID_UID )
+ {
+ tmpUID = recUID[ i ];
+ break;
+ }
+ }
+ if( tmpUID == STB_FR_INVALID_UID )
+ {
+ break;
+ }
+ tmpCnt = 0;
+ for( i = 0 ; i < recCnt ; i++)
+ {
+ if( recUID[ i ] == tmpUID )
+ {
+ recUID[ i ] = STB_FR_INVALID_UID ;
+ tmpCnt++;
+ }
+ }
+ accUID[accKind] = tmpUID;
+ accCnt[accKind] = tmpCnt;
+ accKind++;
+ }
+ // -------------------------------------------------------------------------------------------------
+ //Find the ID whose frequency is the maximum from the cumulative frequency distribution and set it to topUID.
+ // -------------------------------------------------------------------------------------------------
+ topUID = STB_FR_INVALID_UID ;
+ topCnt = 0 ;
+ for( i = 0 ; i < accKind ; i++)
+ {
+ if( topCnt < accCnt[i] )
+ {
+ topCnt = accCnt[i] ;
+ topUID = accUID[i] ;
+ }
+ }
+ if( topUID == STB_FR_INVALID_UID )
+ {
+ peRes->frFace[k].frRecog.value = STB_STATUS_NO_DATA ;
+ peRes->frFace[k].frRecog.conf = STB_CONF_NO_DATA ;
+ peRes->frFace[k].frRecog.status = STB_STATUS_NO_DATA;//during stabilization : a number of data for relevant people aren't enough(a number of frames that relevant people are taken)
+ peRec[0].fcDet[k].frStatus = STB_STATUS_NO_DATA;
+ }else
+ {
+ if( topCnt < frmCnt * frmRatio / 100 )
+ {
+ peRes->frFace[k].frRecog.value = topUID ;
+ peRes->frFace[k].frRecog.conf = STB_CONF_NO_DATA ;
+ peRes->frFace[k].frRecog.status = STB_STATUS_CALCULATING;//during stabilization : a number of data for relevant people aren't enough(a number of frames that relevant people are taken)
+ peRec[0].fcDet[k].frStatus = STB_STATUS_CALCULATING;
+ }else
+ {
+ peRes->frFace[k].frRecog.value = topUID ;
+ peRes->frFace[k].frRecog.conf = tmpConf ;
+ peRes->frFace[k].frRecog.status = STB_STATUS_COMPLETE ;//Just after stabilization : The state immediately after the number of data of the relevant person is sufficient and fixed. When creating an entry log, it is better to log data immediately after stabilization.
+ peRec[0].fcDet[k].frDetID = topUID ;
+ peRec[0].fcDet[k].frStatus = STB_STATUS_COMPLETE ;
+ peRec[0].fcDet[k].frDetConf = tmpConf ;
+ }
+ }
+ }else if ( preStatus == STB_STATUS_COMPLETE //Just after stabilization
+ || preStatus == STB_STATUS_FIXED //already stabilized
+ )
+ {
+ peRes->frFace[k].frRecog.value = preUID ;
+ peRes->frFace[k].frRecog.status = STB_STATUS_FIXED ;
+ peRes->frFace[k].frRecog.conf = preConf;
+ peRec[0].fcDet[k].frDetID = preUID ;
+ peRec[0].fcDet[k].frStatus = STB_STATUS_FIXED ;
+ peRec[0].fcDet[k].frDetConf = preConf;
+
+ }
+
+
+ }
+}
+/*---------------------------------------------------------------------*/
+// StbFrExec
+/*---------------------------------------------------------------------*/
+int StbFrExec ( FRHANDLE handle )
+{
+
+ int retVal = 0 ;
+
+ /* Face --------------------------------------*/
+ FrSlideFacesRec ( handle->frDetRec );//Shift the time series of past data before stabilization.
+ FrCurFaces ( handle->frDetRec ,
+ &(handle->frDet) );//Setting "present data before the stabilization" to past data before the stabilization.
+
+ FrStbFaceEasy ( &(handle->frRes) ,
+ handle->frDetRec ,
+ handle->frFaceDirThr ,
+ handle->frFaceDirUDMax ,
+ handle->frFaceDirUDMin ,
+ handle->frFaceDirLRMax ,
+ handle->frFaceDirLRMin ,
+ handle->frFrameCount ,
+ handle->frFrameRatio );//Calculate "current data after stabilization" from "past data before stabilization".
+
+
+
+ return retVal;
+}
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HVC/STBLib/src/STB_FaceRecognition/STBFrAPI.h Tue Sep 05 10:01:51 2017 +0000 @@ -0,0 +1,22 @@ +/*---------------------------------------------------------------------------*/ +/* Copyright(C) 2017 OMRON Corporation */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ +/* See the License for the specific language governing permissions and */ +/* limitations under the License. */ +/*---------------------------------------------------------------------------*/ + +#include "FrInterface.h" + +int StbFrExec ( FRHANDLE handle ); + + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HVC/STBLib/src/STB_FaceRecognition/STBFrValidValue.c Tue Sep 05 10:01:51 2017 +0000
@@ -0,0 +1,51 @@
+/*---------------------------------------------------------------------------*/
+/* Copyright(C) 2017 OMRON Corporation */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
+/* See the License for the specific language governing permissions and */
+/* limitations under the License. */
+/*---------------------------------------------------------------------------*/
+
+#include "STBFrValidValue.h"
+
+/*Value range check*/
+#define IS_OUT_RANGE( val , min , max ) ( ( (val) < (min) ) || ( (max) < (val) ) )
+#define IS_OUT_VALUE( val , min , max , accept ) ( IS_OUT_RANGE( val , min , max ) && ( (val) != (accept) ) )
+#define IS_OUT_FR_UID( val , min , max , acceptA , acceptB , acceptC ) ( IS_OUT_RANGE( val , min , max ) && ( (val) != (acceptA) ) && ( (val) != (acceptB) ) && ( (val) != (acceptC) ) )
+#define IS_OUT_FR_SCORE( val , min , max , acceptA , acceptB ) ( IS_OUT_RANGE( val , min , max ) && ( (val) != (acceptA) ) && ( (val) != (acceptB) ) )
+
+/*------------------------------------------------------------------------------------------------------------------*/
+/* STB_IsValidValue */
+/*------------------------------------------------------------------------------------------------------------------*/
+STB_INT32 STB_FrIsValidValue(const STB_FR_DET *input)
+{
+ STB_INT32 i ;
+
+ for( i = 0 ; i < input->num ; i++)
+ {
+
+ if( IS_OUT_VALUE( input->fcDet[i].dirDetYaw , STB_FACE_DIR_LR_MIN , STB_FACE_DIR_LR_MAX , STB_ERR_DIR_CANNOT ) ){ return STB_FALSE;}
+ if( IS_OUT_VALUE( input->fcDet[i].dirDetPitch , STB_FACE_DIR_UD_MIN , STB_FACE_DIR_UD_MAX , STB_ERR_DIR_CANNOT ) ){ return STB_FALSE;}
+ if( IS_OUT_VALUE( input->fcDet[i].dirDetRoll , STB_FACE_DIR_ROLL_MIN , STB_FACE_DIR_ROLL_MAX , STB_ERR_DIR_CANNOT ) ){ return STB_FALSE;}
+ if( IS_OUT_VALUE( input->fcDet[i].dirDetConf , STB_FACE_DIR_CONF_MIN , STB_FACE_DIR_CONF_MAX , STB_ERR_PE_CANNOT ) ){ return STB_FALSE;}
+
+ }
+
+ for( i = 0 ; i < input->num ; i++)
+ {
+ if( IS_OUT_FR_UID( input->fcDet[i].frDetID , STB_FACE_FR_UID_MIN , STB_FACE_FR_UID_MAX ,STB_ERR_FR_CANNOT ,STB_ERR_FR_NOID ,STB_ERR_FR_NOALBUM ) ){ return STB_FALSE;}
+ if( IS_OUT_FR_SCORE( input->fcDet[i].frDetConf , STB_FACE_FR_SCORE_MIN , STB_FACE_FR_SCORE_MAX ,STB_ERR_FR_CANNOT ,STB_ERR_FR_NOALBUM) ){ return STB_FALSE;}
+ }
+
+
+
+ return STB_TRUE;
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HVC/STBLib/src/STB_FaceRecognition/STBFrValidValue.h Tue Sep 05 10:01:51 2017 +0000 @@ -0,0 +1,97 @@ +/*---------------------------------------------------------------------------*/ +/* Copyright(C) 2017 OMRON Corporation */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ +/* See the License for the specific language governing permissions and */ +/* limitations under the License. */ +/*---------------------------------------------------------------------------*/ + +#ifndef STBFRVALIDVALUE_H__ +#define STBFRVALIDVALUE_H__ + + +#include "STBCommonDef.h" +#include "STBCommonType.h" +#include "STBFrTypedef.h" + + +/*-------------------------------------------------------------------*/ +/*Threshold for checking input value*/ +/*-------------------------------------------------------------------*/ +#define STB_BODY_CNT_MIN 0 // body +#define STB_BODY_CNT_MAX 35 +#define STB_BODY_XY_MIN 0 +#define STB_BODY_XY_MAX 8191 +#define STB_BODY_SIZE_MIN 20 +#define STB_BODY_SIZE_MAX 8192 +#define STB_BODY_CONF_MIN 0 +#define STB_BODY_CONF_MAX 1000 +#define STB_FACE_CNT_MIN 0 // face +#define STB_FACE_CNT_MAX 35 +#define STB_FACE_XY_MIN 0 +#define STB_FACE_XY_MAX 8191 +#define STB_FACE_SIZE_MIN 20 +#define STB_FACE_SIZE_MAX 8192 +#define STB_FACE_CONF_MIN 0 +#define STB_FACE_CONF_MAX 1000 +#define STB_FACE_DIR_LR_MIN -180 +#define STB_FACE_DIR_LR_MAX 179 +#define STB_FACE_DIR_UD_MIN -180 +#define STB_FACE_DIR_UD_MAX 179 +#define STB_FACE_DIR_ROLL_MIN -180 +#define STB_FACE_DIR_ROLL_MAX 179 +#define STB_FACE_DIR_CONF_MIN 0 +#define STB_FACE_DIR_CONF_MAX 1000 +#define STB_FACE_AGE_VAL_MIN 0 +#define STB_FACE_AGE_VAL_MAX 75 +#define STB_FACE_AGE_CONF_MIN 0 +#define STB_FACE_AGE_CONF_MAX 1000 +#define STB_FACE_GEN_VAL_MIN 0 +#define STB_FACE_GEN_VAL_MAX 1 +#define STB_FACE_GEN_CONF_MIN 0 +#define STB_FACE_GEN_CONF_MAX 1000 +#define STB_FACE_GAZE_LR_MIN -90 +#define STB_FACE_GAZE_LR_MAX 90 +#define STB_FACE_GAZE_UD_MIN -90 +#define STB_FACE_GAZE_UD_MAX 90 +#define STB_FACE_BLI_L_MIN 1 +#define STB_FACE_BLI_L_MAX 1000 +#define STB_FACE_BLI_R_MIN 1 +#define STB_FACE_BLI_R_MAX 1000 +#define STB_FACE_EXP_SCORE_MIN 0 +#define STB_FACE_EXP_SCORE_MAX 100 /* not 1000 */ +#define STB_FACE_EXP_DEG_MIN -100 +#define STB_FACE_EXP_DEG_MAX 100 +#define STB_FACE_FR_UID_MIN 0 +#define STB_FACE_FR_UID_MAX 499 +#define STB_FACE_FR_SCORE_MIN 0 +#define STB_FACE_FR_SCORE_MAX 1000 + +/*-------------------------------------------------------------------*/ +/*Permitted input value*/ +/*-------------------------------------------------------------------*/ +#define STB_ERR_PE_CANNOT -128 /*Estimation is not possible.*/ +#define STB_ERR_FR_CANNOT -128 /*Recognition impossible*/ +#define STB_ERR_FR_NOID -1 /*No corresponding ID*/ +#define STB_ERR_FR_NOALBUM -127 /*Not-registered in Album*/ + +/*-------------------------------------------------------------------*/ +/*For collaboration with child library*/ +/*-------------------------------------------------------------------*/ +#define STB_ERR_DIR_CANNOT -256 /*Unable to angle estimation*/ + +/*-------------------------------------------------------------------*/ +/* Func */ +/*-------------------------------------------------------------------*/ +STB_INT32 STB_FrIsValidValue(const STB_FR_DET *input); + +#endif /* COMMONDEF_H__ */ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HVC/STBLib/src/STB_FaceRecognition/SdkSTBFr.c Tue Sep 05 10:01:51 2017 +0000
@@ -0,0 +1,87 @@
+/*---------------------------------------------------------------------------*/
+/* Copyright(C) 2017 OMRON Corporation */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
+/* See the License for the specific language governing permissions and */
+/* limitations under the License. */
+/*---------------------------------------------------------------------------*/
+
+#include "SdkSTBFr.h"
+#include "FrInterface.h"
+
+/*This layer only defines the API function */
+
+/*Create/Delete handle*/
+STB_FR_HANDLE STB_Fr_CreateHandle( const STB_INT32 nTraCntMax ){
+ return (STB_FR_HANDLE)FrCreateHandle( nTraCntMax );
+}
+
+STB_INT32 STB_Fr_DeleteHandle(STB_FR_HANDLE handle){
+ return FrDeleteHandle((FRHANDLE)handle);
+}
+
+/*set frame information*/
+STB_INT32 STB_Fr_SetDetect(STB_FR_HANDLE handle,const STB_FR_DET *stbFrDet){
+ return FrSetDetect((FRHANDLE)handle,stbFrDet);
+}
+
+/*Main process execution*/
+STB_INT32 STB_Fr_Execute(STB_FR_HANDLE handle){
+ return FrExecute((FRHANDLE)handle);
+}
+
+/*get the result*/
+STB_INT32 STB_Fr_GetResult(STB_FR_HANDLE handle, STB_FR_RES* peResult){
+ return FrGetResult((FRHANDLE)handle,peResult);
+}
+
+STB_INT32 STB_Fr_Clear(STB_FR_HANDLE handle){
+ return FrClear((FRHANDLE)handle);
+}
+
+/* FaceDirMinMax */
+STB_INT32 STB_Fr_SetFaceDirMinMax ( STB_FR_HANDLE handle , STB_INT32 nMinUDAngle , STB_INT32 nMaxUDAngle ,STB_INT32 nMinLRAngle , STB_INT32 nMaxLRAngle )
+{
+ return FrSetFaceDirMinMax((FRHANDLE)handle,nMinUDAngle,nMaxUDAngle,nMinLRAngle,nMaxLRAngle );
+}
+STB_INT32 STB_Fr_GetFaceDirMinMax ( STB_FR_HANDLE handle , STB_INT32 *pnMinUDAngle , STB_INT32 *pnMaxUDAngle ,STB_INT32 *pnMinLRAngle, STB_INT32 *pnMaxLRAngle )
+{
+ return FrGetFaceDirMinMax((FRHANDLE)handle,pnMinUDAngle,pnMaxUDAngle,pnMinLRAngle,pnMaxLRAngle );
+}
+
+/* FaceDirThreshold */
+STB_INT32 STB_Fr_SetFaceDirThreshold ( STB_FR_HANDLE handle , STB_INT32 threshold )
+{
+ return FrSetFaceDirThreshold((FRHANDLE)handle,threshold );
+}
+STB_INT32 STB_Fr_GetFaceDirThreshold ( STB_FR_HANDLE handle , STB_INT32* threshold )
+{
+ return FrGetFaceDirThreshold((FRHANDLE)handle,threshold );
+}
+/* FrameCount */
+STB_INT32 STB_Fr_SetFrameCount ( STB_FR_HANDLE handle , STB_INT32 nFrameCount )
+{
+ return FrSetFrameCount((FRHANDLE)handle,nFrameCount );
+}
+STB_INT32 STB_Fr_GetFrameCount ( STB_FR_HANDLE handle , STB_INT32* nFrameCount )
+{
+ return FrGetFrameCount((FRHANDLE)handle,nFrameCount );
+}
+
+/* FrameShare */
+STB_INT32 STB_Fr_SetMinRatio ( STB_FR_HANDLE handle , STB_INT32 nMinRatio )
+{
+ return FrSetMinRatio((FRHANDLE)handle,nMinRatio );
+}
+STB_INT32 STB_Fr_GetMinRatio ( STB_FR_HANDLE handle , STB_INT32* nMinRatio )
+{
+ return FrGetMinRatio((FRHANDLE)handle,nMinRatio );
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HVC/STBLib/src/STB_FaceRecognition/SdkSTBFr.h Tue Sep 05 10:01:51 2017 +0000 @@ -0,0 +1,44 @@ +/*---------------------------------------------------------------------------*/ +/* Copyright(C) 2017 OMRON Corporation */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ +/* See the License for the specific language governing permissions and */ +/* limitations under the License. */ +/*---------------------------------------------------------------------------*/ + +#if !defined( _SDK_STBFR_H_ ) +#define _SDK_STBFR_H_ +#include "STBFrTypedef.h" + +#if !defined( STB_DEF_FR_HANDLE ) + #define STB_DEF_FR_HANDLE + typedef VOID* STB_FR_HANDLE; +#endif + +STB_FR_HANDLE STB_Fr_CreateHandle ( const STB_INT32 nTraCntMax );/*Create/Delete handle*/ +STB_INT32 STB_Fr_DeleteHandle ( STB_FR_HANDLE handle );/*Create/Delete handle*/ +STB_INT32 STB_Fr_SetDetect ( STB_FR_HANDLE handle, const STB_FR_DET *stbFrDet );/*Frame information settings*/ +STB_INT32 STB_Fr_Execute ( STB_FR_HANDLE handle );/*Main process execution*/ +STB_INT32 STB_Fr_GetResult ( STB_FR_HANDLE handle, STB_FR_RES* frResult );/*Get result*/ +STB_INT32 STB_Fr_Clear ( STB_FR_HANDLE handle );/*Clear*/ + +/*parameter*/ +STB_INT32 STB_Fr_SetFaceDirMinMax ( STB_FR_HANDLE handle , STB_INT32 nMinUDAngle , STB_INT32 nMaxUDAngle ,STB_INT32 nMinLRAngle , STB_INT32 nMaxLRAngle );/* FaceDirMinMax */ +STB_INT32 STB_Fr_GetFaceDirMinMax ( STB_FR_HANDLE handle , STB_INT32 *pnMinUDAngle, STB_INT32 *pnMaxUDAngle ,STB_INT32 *pnMinLRAngle, STB_INT32 *pnMaxLRAngle); +STB_INT32 STB_Fr_Clear ( STB_FR_HANDLE handle );/* ClearID */ +STB_INT32 STB_Fr_SetFaceDirThreshold ( STB_FR_HANDLE handle , STB_INT32 threshold );/* FaceDirThreshold */ +STB_INT32 STB_Fr_GetFaceDirThreshold ( STB_FR_HANDLE handle , STB_INT32* threshold ); +STB_INT32 STB_Fr_SetFrameCount ( STB_FR_HANDLE handle , STB_INT32 nFrameCount ); +STB_INT32 STB_Fr_GetFrameCount ( STB_FR_HANDLE handle , STB_INT32* nFrameCount ); +STB_INT32 STB_Fr_SetMinRatio ( STB_FR_HANDLE handle , STB_INT32 nMinRatio ); +STB_INT32 STB_Fr_GetMinRatio ( STB_FR_HANDLE handle , STB_INT32* nMinRatio ); + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HVC/STBLib/src/STB_Property/PeInterface.c Tue Sep 05 10:01:51 2017 +0000
@@ -0,0 +1,574 @@
+/*---------------------------------------------------------------------------*/
+/* Copyright(C) 2017 OMRON Corporation */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
+/* See the License for the specific language governing permissions and */
+/* limitations under the License. */
+/*---------------------------------------------------------------------------*/
+
+#include "PeInterface.h"
+#include "STBPeAPI.h"
+
+/*Value range check*/
+#define ISVALID_RANGE( val , min , max ) ( ( (min) <= (val) ) && ( (val) <= (max) ) )
+
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+/*error check*/
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+static STB_INT32 PeIsValidValue(
+ const STB_INT32 nValue ,
+ const STB_INT32 nLimitMin ,
+ const STB_INT32 nLimitMax )
+{
+ STB_INT32 nRet;
+ for( nRet = STB_ERR_INVALIDPARAM; nRet != STB_NORMAL; nRet = STB_NORMAL ){
+ if( ! ISVALID_RANGE( nValue , nLimitMin , nLimitMax ) ){ break; }
+ }
+ return nRet;
+}
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+static STB_INT32 PeIsValidPointer( const VOID* pPointer )
+{
+ STB_INT32 nRet;
+ for( nRet = STB_ERR_INVALIDPARAM; nRet != STB_NORMAL; nRet = STB_NORMAL ){
+ if( NULL == pPointer ){ break; }
+ }
+ return nRet;
+}
+
+/*------------------------------------------------------------------------------------------------------------------*/
+/* PeCalcPeSize */
+/*------------------------------------------------------------------------------------------------------------------*/
+STB_UINT32 PeCalcPeSize ( STB_UINT32 nTraCntMax )
+{
+ STB_UINT32 retVal ;
+
+ retVal = 0 ;
+
+ retVal += 100 ;///Margin : alignment
+
+
+
+ retVal += sizeof( FACE_DET ) * nTraCntMax ; // peDet.fcDet
+ retVal += sizeof( STB_PE_DET ) * STB_PE_BACK_MAX ; // peDetRec
+ retVal += sizeof( FACE_DET ) * nTraCntMax * STB_PE_BACK_MAX; // handle->peDetRec[t].fcDet
+ retVal += sizeof( STB_PE_FACE ) * nTraCntMax ; // peRes.peFace
+ retVal += sizeof( STBExecFlg ) ; // execFlg
+
+ return retVal;
+}
+/*------------------------------------------------------------------------------------------------------------------*/
+/* PeSharePeSize */
+/*------------------------------------------------------------------------------------------------------------------*/
+void PeSharePeSize ( PEHANDLE handle )
+{
+
+ STB_UINT32 t;
+ STB_INT8 *stbPtr = handle->pePtr ;
+ STB_UINT32 nTraCntMax = handle->peCntMax;
+
+ handle->peDet.fcDet = ( FACE_DET* ) stbPtr; stbPtr += ( sizeof( FACE_DET ) * nTraCntMax );
+ handle->peDetRec = ( STB_PE_DET* ) stbPtr; stbPtr += ( sizeof( STB_PE_DET ) * STB_PE_BACK_MAX);
+ for( t = 0 ; t < STB_PE_BACK_MAX ; t++ )
+ {
+ handle->peDetRec[t].fcDet = ( FACE_DET* ) stbPtr; stbPtr += ( sizeof( FACE_DET ) * nTraCntMax );
+ }
+ handle->peRes.peFace = ( STB_PE_FACE* ) stbPtr; stbPtr += ( sizeof( STB_PE_FACE) * nTraCntMax );
+ handle->execFlg = ( STBExecFlg* ) stbPtr; stbPtr += ( sizeof( STBExecFlg ) );
+
+}
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+/*Create handle*/
+PEHANDLE PeCreateHandle( const STBExecFlg* execFlg ,const STB_INT32 nTraCntMax ){
+
+ PEHANDLE handle;
+ STB_INT32 t , i ,j;
+ STB_INT32 tmpVal ;
+ STB_INT32 nRet ;
+
+ nRet = PeIsValidPointer(execFlg);
+ if(nRet != STB_NORMAL)
+ {
+ return NULL;
+ }
+
+ if( nTraCntMax < 1 || STB_PE_TRA_CNT_MAX < nTraCntMax )
+ {
+ return NULL;
+ }
+
+
+
+ /*do handle's Malloc here*/
+ handle = ( PEHANDLE )malloc( sizeof(*handle) );
+ if(handle == NULL)
+ {
+ return NULL;
+ }
+
+ /*initial value---------------------------------------------------------------------*/
+ handle->peFaceDirUDMin = STB_PE_DIR_MIN_UD_INI;//The face on top/down allowable range min.
+ handle->peFaceDirUDMax = STB_PE_DIR_MAX_UD_INI;//The face on top/down allowable range max.
+ handle->peFaceDirLRMin = STB_PE_DIR_MIN_LR_INI;//The face on left /right side allowable range min.
+ handle->peFaceDirLRMax = STB_PE_DIR_MAX_LR_INI;//The face on left /right side allowable range max.
+ handle->peFaceDirThr = STB_PE_DIR_THR_INI ;//If the confidence of Face direction estimation doesn't exceed the reference value, the recognition result isn't trusted.
+ handle->peFrameCount = STB_PE_FRAME_CNT_INI ;
+ handle->peCntMax = nTraCntMax ;//Maximum number of tracking people
+ handle->pePtr = NULL;
+ handle->peDet.num = 0;
+ handle->peDet.fcDet = NULL;
+ handle->peDetRec = NULL;
+ handle->peRes.peCnt = 0;
+ handle->peRes.peFace = NULL;
+ handle->execFlg = NULL;
+
+ tmpVal = PeCalcPeSize ( nTraCntMax ); /*calculate necessary amount in the Pe handle*/
+ handle->pePtr = NULL;
+ handle->pePtr = ( STB_INT8 * )malloc( tmpVal ); /*keeping necessary amount in the Pe handle*/
+ if( handle->pePtr == NULL )
+ {
+ free ( handle->pePtr );
+ free ( handle );
+ return NULL;
+ }
+
+ /*Malloc-area is allocated to things that need Malloc in TR handle*/
+ PeSharePeSize ( handle );
+
+ for( t = 0 ; t < STB_PE_BACK_MAX ; t++ )
+ {
+ handle->peDetRec [ t ].num = 0;
+ for( i = 0 ; i < handle->peCntMax ; i++ )
+ {
+ handle->peDetRec[t].fcDet[i].nDetID = STB_STATUS_NO_DATA ;
+ handle->peDetRec[t].fcDet[i].nTraID = STB_STATUS_NO_DATA ;
+ handle->peDetRec[t].fcDet[i].dirDetRoll = STB_STATUS_NO_DATA ;
+ handle->peDetRec[t].fcDet[i].dirDetPitch = STB_STATUS_NO_DATA ;
+ handle->peDetRec[t].fcDet[i].dirDetYaw = STB_STATUS_NO_DATA ;
+ handle->peDetRec[t].fcDet[i].dirDetConf = STB_STATUS_NO_DATA ;
+ handle->peDetRec[t].fcDet[i].ageDetVal = STB_STATUS_NO_DATA ;
+ handle->peDetRec[t].fcDet[i].ageStatus = STB_STATUS_NO_DATA ;
+ handle->peDetRec[t].fcDet[i].ageDetConf = STB_STATUS_NO_DATA ;
+ handle->peDetRec[t].fcDet[i].genDetVal = STB_STATUS_NO_DATA ;
+ handle->peDetRec[t].fcDet[i].genStatus = STB_STATUS_NO_DATA ;
+ handle->peDetRec[t].fcDet[i].genDetConf = STB_STATUS_NO_DATA ;
+ handle->peDetRec[t].fcDet[i].gazDetLR = STB_STATUS_NO_DATA ;
+ handle->peDetRec[t].fcDet[i].gazDetUD = STB_STATUS_NO_DATA ;
+ handle->peDetRec[t].fcDet[i].bliDetL = STB_STATUS_NO_DATA ;
+ handle->peDetRec[t].fcDet[i].bliDetR = STB_STATUS_NO_DATA ;
+
+ handle->peDetRec[t].fcDet[i].expDetConf = STB_STATUS_NO_DATA ;
+ for( j = 0 ; j < STB_EX_MAX ; j++)
+ {
+ handle->peDetRec[t].fcDet[i].expDetVal[ j ] = STB_STATUS_NO_DATA;
+ }
+ }
+ }
+
+ handle->execFlg->pet = execFlg->pet ;
+ handle->execFlg->hand = execFlg->hand ;
+ handle->execFlg->bodyTr = execFlg->bodyTr ;
+ handle->execFlg->faceTr = execFlg->faceTr ;
+ handle->execFlg->gen = execFlg->gen ;
+ handle->execFlg->age = execFlg->age ;
+ handle->execFlg->fr = execFlg->fr ;
+ handle->execFlg->exp = execFlg->exp ;
+ handle->execFlg->gaz = execFlg->gaz ;
+ handle->execFlg->dir = execFlg->dir ;
+ handle->execFlg->bli = execFlg->bli ;
+
+
+ return handle;
+}
+
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+/*Delete handle*/
+STB_INT32 PeDeleteHandle(PEHANDLE handle){
+ STB_INT32 nRet;
+ /*NULL check*/
+ nRet = PeIsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+
+ free ( handle->pePtr );
+ free ( handle );
+
+ return STB_NORMAL;
+}
+
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+/*Set the result*/
+STB_INT32 PeSetDetect(PEHANDLE handle,const STB_PE_DET *stbPeDet){
+
+ STB_INT32 nRet;
+ STB_INT32 i,j;
+
+ /*NULL check*/
+ nRet = PeIsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+
+ nRet = PeIsValidPointer(stbPeDet);
+ if(nRet != STB_NORMAL){
+ return nRet;
+ }
+
+ /*Input value check*/
+ nRet = STB_PeIsValidValue ( stbPeDet ,handle->execFlg );
+ if(nRet != STB_TRUE)
+ {
+ return STB_ERR_INVALIDPARAM;
+ }
+
+
+ /*Set the received result to the handle*/
+ /* Face */
+ if( stbPeDet->num > handle->peCntMax )
+ {
+ return STB_ERR_PROCESSCONDITION;
+ }
+
+
+ handle->peDet.num = stbPeDet->num;
+ for( i = 0 ; i < handle->peDet.num ; i++ )
+ {
+ handle->peDet.fcDet[i].nDetID = stbPeDet->fcDet[i].nDetID ;
+ handle->peDet.fcDet[i].nTraID = stbPeDet->fcDet[i].nTraID ;
+ if( handle->execFlg->gen == STB_TRUE )
+ {
+ handle->peDet.fcDet[i].genDetVal = stbPeDet->fcDet[i].genDetVal ;
+ handle->peDet.fcDet[i].genDetConf = stbPeDet->fcDet[i].genDetConf ;
+ handle->peDet.fcDet[i].genStatus = STB_STATUS_NO_DATA ;
+ }
+ if( handle->execFlg->age == STB_TRUE )
+ {
+ handle->peDet.fcDet[i].ageDetVal = stbPeDet->fcDet[i].ageDetVal ;
+ handle->peDet.fcDet[i].ageDetConf = stbPeDet->fcDet[i].ageDetConf ;
+ handle->peDet.fcDet[i].ageStatus = STB_STATUS_NO_DATA ;
+ }
+ if( handle->execFlg->exp == STB_TRUE )
+ {
+ handle->peDet.fcDet[i].expDetConf = stbPeDet->fcDet[i].expDetConf ;
+ for( j = 0 ; j < STB_EX_MAX ; j++)
+ {
+ handle->peDet.fcDet[i].expDetVal[ j ] = stbPeDet->fcDet[i].expDetVal[ j ];
+ }
+ }
+ if( handle->execFlg->gaz == STB_TRUE )
+ {
+ handle->peDet.fcDet[i].gazDetLR = stbPeDet->fcDet[i].gazDetLR ;
+ handle->peDet.fcDet[i].gazDetUD = stbPeDet->fcDet[i].gazDetUD ;
+ }
+ //if( handle->execFlg->dir == STB_TRUE )// dir is obligation.
+ //{
+ handle->peDet.fcDet[i].dirDetRoll = stbPeDet->fcDet[i].dirDetRoll ;
+ handle->peDet.fcDet[i].dirDetPitch = stbPeDet->fcDet[i].dirDetPitch ;
+ handle->peDet.fcDet[i].dirDetYaw = stbPeDet->fcDet[i].dirDetYaw ;
+ handle->peDet.fcDet[i].dirDetConf = stbPeDet->fcDet[i].dirDetConf ;
+ //}
+ if( handle->execFlg->bli == STB_TRUE )
+ {
+ handle->peDet.fcDet[i].bliDetL = stbPeDet->fcDet[i].bliDetL ;
+ handle->peDet.fcDet[i].bliDetR = stbPeDet->fcDet[i].bliDetR ;
+ }
+ }
+
+
+ return STB_NORMAL;
+}
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+/*Main process execution*/
+STB_INT32 PeExecute(PEHANDLE handle){
+ STB_INT32 nRet;
+ /*NULL check*/
+ nRet = PeIsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+
+ /*Main processing here*/
+ nRet = StbPeExec ( handle );
+
+
+ return STB_NORMAL;
+}
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+/*Get-Function of results*/
+STB_INT32 PeGetResult( PEHANDLE handle, STB_PE_RES* peResult){
+
+ STB_INT32 nRet;
+ STB_INT32 i;
+
+ /*NULL check*/
+ nRet = PeIsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+
+ nRet = PeIsValidPointer(peResult);
+ if(nRet != STB_NORMAL){
+ return nRet;
+ }
+
+ /*Get result from handle*/
+ peResult->peCnt = handle->peRes.peCnt ;
+ for( i = 0 ; i < peResult->peCnt ; i++ )
+ {
+ peResult->peFace[i].nTraID = handle->peRes.peFace[i].nTraID ;
+ peResult->peFace[i].gen.status = handle->peRes.peFace[i].gen.status ;
+ peResult->peFace[i].gen.value = handle->peRes.peFace[i].gen.value ;
+ peResult->peFace[i].gen.conf = handle->peRes.peFace[i].gen.conf ;
+ peResult->peFace[i].age.status = handle->peRes.peFace[i].age.status ;
+ peResult->peFace[i].age.value = handle->peRes.peFace[i].age.value ;
+ peResult->peFace[i].age.conf = handle->peRes.peFace[i].age.conf ;
+ peResult->peFace[i].exp.status = handle->peRes.peFace[i].exp.status ;
+ peResult->peFace[i].exp.value = handle->peRes.peFace[i].exp.value ;
+ peResult->peFace[i].exp.conf = handle->peRes.peFace[i].exp.conf ;
+ peResult->peFace[i].gaz.status = handle->peRes.peFace[i].gaz.status ;
+ peResult->peFace[i].gaz.LR = handle->peRes.peFace[i].gaz.LR ;
+ peResult->peFace[i].gaz.UD = handle->peRes.peFace[i].gaz.UD ;
+ peResult->peFace[i].gaz.conf = handle->peRes.peFace[i].gaz.conf ;
+ peResult->peFace[i].dir.status = handle->peRes.peFace[i].dir.status ;
+ peResult->peFace[i].dir.pitch = handle->peRes.peFace[i].dir.pitch ;
+ peResult->peFace[i].dir.roll = handle->peRes.peFace[i].dir.roll ;
+ peResult->peFace[i].dir.yaw = handle->peRes.peFace[i].dir.yaw ;
+ peResult->peFace[i].dir.conf = handle->peRes.peFace[i].dir.conf ;
+ peResult->peFace[i].bli.status = handle->peRes.peFace[i].bli.status ;
+ peResult->peFace[i].bli.ratioL = handle->peRes.peFace[i].bli.ratioL ;
+ peResult->peFace[i].bli.ratioR = handle->peRes.peFace[i].bli.ratioR ;
+ }
+
+
+
+ return STB_NORMAL;
+}
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+STB_INT32 PeSetFaceDirMinMax(PEHANDLE handle , STB_INT32 nMinUDAngle , STB_INT32 nMaxUDAngle ,STB_INT32 nMinLRAngle , STB_INT32 nMaxLRAngle )
+{
+
+ STB_INT32 nRet;
+ nRet = PeIsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+
+ if( nMinUDAngle < STB_PE_DIR_MIN_UD_MIN || STB_PE_DIR_MIN_UD_MAX < nMinUDAngle)
+ {
+ return STB_ERR_INVALIDPARAM;
+ }
+ if( nMaxUDAngle < STB_PE_DIR_MAX_UD_MIN || STB_PE_DIR_MAX_UD_MAX < nMaxUDAngle)
+ {
+ return STB_ERR_INVALIDPARAM;
+ }
+ if( nMaxUDAngle < nMinUDAngle)
+ {
+ return STB_ERR_INVALIDPARAM;
+ }
+
+
+ if( nMinLRAngle < STB_PE_DIR_MIN_LR_MIN || STB_PE_DIR_MIN_LR_MAX < nMinLRAngle)
+ {
+ return STB_ERR_INVALIDPARAM;
+ }
+ if( nMaxLRAngle < STB_PE_DIR_MAX_LR_MIN || STB_PE_DIR_MAX_LR_MAX < nMaxLRAngle)
+ {
+ return STB_ERR_INVALIDPARAM;
+ }
+ if( nMaxLRAngle < nMinLRAngle)
+ {
+ return STB_ERR_INVALIDPARAM;
+ }
+
+ handle->peFaceDirUDMin = nMinUDAngle;
+ handle->peFaceDirUDMax = nMaxUDAngle;
+ handle->peFaceDirLRMin = nMinLRAngle;
+ handle->peFaceDirLRMax = nMaxLRAngle;
+
+
+ return STB_NORMAL;
+}
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+STB_INT32 PeGetFaceDirMinMax(PEHANDLE handle ,STB_INT32 *pnMinUDAngle, STB_INT32 *pnMaxUDAngle ,STB_INT32 *pnMinLRAngle, STB_INT32 *pnMaxLRAngle )
+{
+ STB_INT32 nRet;
+ nRet = PeIsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+ nRet = PeIsValidPointer(pnMinUDAngle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_INVALIDPARAM;
+ }
+ nRet = PeIsValidPointer(pnMaxUDAngle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_INVALIDPARAM;
+ }
+ nRet = PeIsValidPointer(pnMinLRAngle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_INVALIDPARAM;
+ }
+ nRet = PeIsValidPointer(pnMaxLRAngle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_INVALIDPARAM;
+ }
+
+ *pnMinUDAngle = handle->peFaceDirUDMin ;
+ *pnMaxUDAngle = handle->peFaceDirUDMax ;
+
+ *pnMinLRAngle = handle->peFaceDirLRMin ;
+ *pnMaxLRAngle = handle->peFaceDirLRMax ;
+
+ return STB_NORMAL;
+}
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+STB_INT32 PeClear ( PEHANDLE handle )
+{
+ //clear processing
+ STB_INT32 t , i ,j;
+ STB_INT32 nRet;
+
+ /*NULL check*/
+ nRet = PeIsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+
+ for( t = 0 ; t < STB_PE_BACK_MAX ; t++ )
+ {
+ handle->peDetRec [ t ].num = 0;
+ for( i = 0 ; i < handle->peCntMax ; i++ )
+ {
+ handle->peDetRec[t].fcDet[i].nDetID = STB_STATUS_NO_DATA ;
+ handle->peDetRec[t].fcDet[i].nTraID = STB_STATUS_NO_DATA ;
+ if( handle->execFlg->dir == STB_TRUE )
+ {
+ handle->peDetRec[t].fcDet[i].dirDetRoll = STB_STATUS_NO_DATA ;
+ handle->peDetRec[t].fcDet[i].dirDetPitch = STB_STATUS_NO_DATA ;
+ handle->peDetRec[t].fcDet[i].dirDetYaw = STB_STATUS_NO_DATA ;
+ handle->peDetRec[t].fcDet[i].dirDetConf = STB_STATUS_NO_DATA ;
+ }
+ if( handle->execFlg->age == STB_TRUE )
+ {
+ handle->peDetRec[t].fcDet[i].ageDetVal = STB_STATUS_NO_DATA ;
+ handle->peDetRec[t].fcDet[i].ageStatus = STB_STATUS_NO_DATA ;
+ handle->peDetRec[t].fcDet[i].ageDetConf = STB_STATUS_NO_DATA ;
+ }
+ if( handle->execFlg->gen == STB_TRUE )
+ {
+ handle->peDetRec[t].fcDet[i].genDetVal = STB_STATUS_NO_DATA ;
+ handle->peDetRec[t].fcDet[i].genStatus = STB_STATUS_NO_DATA ;
+ handle->peDetRec[t].fcDet[i].genDetConf = STB_STATUS_NO_DATA ;
+ }
+ if( handle->execFlg->gaz == STB_TRUE )
+ {
+ handle->peDetRec[t].fcDet[i].gazDetLR = STB_STATUS_NO_DATA ;
+ handle->peDetRec[t].fcDet[i].gazDetUD = STB_STATUS_NO_DATA ;
+ }
+ if( handle->execFlg->bli == STB_TRUE )
+ {
+ handle->peDetRec[t].fcDet[i].bliDetL = STB_STATUS_NO_DATA ;
+ handle->peDetRec[t].fcDet[i].bliDetR = STB_STATUS_NO_DATA ;
+ }
+ if( handle->execFlg->exp == STB_TRUE )
+ {
+ handle->peDetRec[t].fcDet[i].expDetConf = STB_STATUS_NO_DATA ;
+ for( j = 0 ; j < STB_EX_MAX ; j++)
+ {
+ handle->peDetRec[t].fcDet[i].expDetVal[j] = STB_STATUS_NO_DATA ;
+ }
+ }
+ }
+ }
+
+ return STB_NORMAL;
+}
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+STB_INT32 PeSetFaceDirThreshold(PEHANDLE handle , STB_INT32 threshold )
+{
+ STB_INT32 nRet;
+ nRet = PeIsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+ if( threshold < STB_PE_DIR_THR_MIN || STB_PE_DIR_THR_MAX < threshold ){
+ return STB_ERR_INVALIDPARAM;
+ }
+
+ handle->peFaceDirThr = threshold;
+ return STB_NORMAL;
+}
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+STB_INT32 PeGetFaceDirThreshold(PEHANDLE handle , STB_INT32* threshold )
+{
+ STB_INT32 nRet;
+ nRet = PeIsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+ nRet = PeIsValidPointer(threshold);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_INVALIDPARAM;
+ }
+
+ *threshold = handle->peFaceDirThr ;
+ return STB_NORMAL;
+}
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+STB_INT32 PeSetFrameCount(PEHANDLE handle , STB_INT32 nFrameCount )
+{
+
+ STB_INT32 nRet;
+ nRet = PeIsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+
+ if( nFrameCount < 1 || nFrameCount > STB_PE_BACK_MAX )
+ {
+ return STB_ERR_INVALIDPARAM;
+ }
+
+ handle->peFrameCount = nFrameCount;
+ return STB_NORMAL;
+}
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+STB_INT32 PeGetFrameCount(PEHANDLE handle , STB_INT32* nFrameCount )
+{
+ STB_INT32 nRet;
+ nRet = PeIsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+ nRet = PeIsValidPointer(nFrameCount);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_INVALIDPARAM;
+ }
+
+ *nFrameCount = handle->peFrameCount ;
+ return STB_NORMAL;
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HVC/STBLib/src/STB_Property/PeInterface.h Tue Sep 05 10:01:51 2017 +0000
@@ -0,0 +1,111 @@
+/*---------------------------------------------------------------------------*/
+/* Copyright(C) 2017 OMRON Corporation */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
+/* See the License for the specific language governing permissions and */
+/* limitations under the License. */
+/*---------------------------------------------------------------------------*/
+
+#if !defined( _INTERFACE_H_ )
+#define _INTERFACE_H_
+#include "STBPeTypedef.h"
+#include "STBPeValidValue.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////
+/////////// Define //////////////
+//////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////
+
+
+#define STB_PE_BACK_MAX 20 /* refer to past "STB_BACK_MAX" frames of results */
+#define STB_PE_EX_MAX 5 //A type of Facial expression
+
+#define STB_PE_TRA_CNT_MAX 35
+
+#define STB_PE_DIR_MIN_UD_INI -15
+#define STB_PE_DIR_MIN_UD_MIN -90
+#define STB_PE_DIR_MIN_UD_MAX 90
+
+#define STB_PE_DIR_MAX_UD_INI 20
+#define STB_PE_DIR_MAX_UD_MIN -90
+#define STB_PE_DIR_MAX_UD_MAX 90
+
+#define STB_PE_DIR_MIN_LR_INI -30
+#define STB_PE_DIR_MIN_LR_MIN -90
+#define STB_PE_DIR_MIN_LR_MAX 90
+
+#define STB_PE_DIR_MAX_LR_INI 30
+#define STB_PE_DIR_MAX_LR_MIN -90
+#define STB_PE_DIR_MAX_LR_MAX 90
+
+
+#define STB_PE_FRAME_CNT_INI 5
+#define STB_PE_FRAME_CNT_MIN 1
+#define STB_PE_FRAME_CNT_MAX 20
+
+#define STB_PE_DIR_THR_INI 300
+#define STB_PE_DIR_THR_MIN 0
+#define STB_PE_DIR_THR_MAX 1000
+
+//////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////
+/////////// Struct //////////////
+//////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////
+typedef struct tagPEHANDLE {
+
+ STB_INT8 *pePtr ;
+ /* param */
+ STB_INT32 peCntMax ;//Maximum number of tracking people
+ STB_INT32 peFaceDirUDMin ;//The face on top/down allowable range min.
+ STB_INT32 peFaceDirUDMax ;//The face on top/down allowable range max.
+ STB_INT32 peFaceDirLRMin ;//The face on left /right side allowable range min.
+ STB_INT32 peFaceDirLRMax ;//The face on left /right side allowable range max.
+ STB_INT32 peFaceDirThr ;//If the confidence of Face direction estimation doesn't exceed the reference value, the recognition result isn't trusted.
+ STB_INT32 peFrameCount ;
+
+ /* PE_Face */
+ STB_PE_DET peDet ;//Present data before the stabilization(input).
+ STB_PE_DET *peDetRec ;//past data before the stabilization
+ STB_PE_RES peRes ;//present data after the stabilization(output)
+ STBExecFlg *execFlg ;
+
+} *PEHANDLE;
+
+//////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////
+/////////// Func //////////////
+//////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////
+PEHANDLE PeCreateHandle ( const STBExecFlg* execFlg ,const STB_INT32 nTraCntMax);
+STB_INT32 PeDeleteHandle ( PEHANDLE handle);
+STB_INT32 PeSetDetect ( PEHANDLE handle,const STB_PE_DET *stbPeDet);
+STB_INT32 PeExecute ( PEHANDLE handle);
+STB_INT32 PeGetResult ( PEHANDLE handle , STB_PE_RES* peResult);
+STB_INT32 PeSetFaceDirMinMax ( PEHANDLE handle , STB_INT32 nMinUDAngle , STB_INT32 nMaxUDAngle ,STB_INT32 nMinLRAngle , STB_INT32 nMaxLRAngle );
+STB_INT32 PeGetFaceDirMinMax ( PEHANDLE handle , STB_INT32 *pnMinUDAngle, STB_INT32 *pnMaxUDAngle ,STB_INT32 *pnMinLRAngle, STB_INT32 *pnMaxLRAngle );
+STB_INT32 PeClear ( PEHANDLE handle );
+STB_INT32 PeSetFaceDirThreshold ( PEHANDLE handle , STB_INT32 threshold );
+STB_INT32 PeGetFaceDirThreshold ( PEHANDLE handle , STB_INT32* threshold );
+STB_INT32 PeSetFrameCount ( PEHANDLE handle , STB_INT32 nFrameCount );
+STB_INT32 PeGetFrameCount ( PEHANDLE handle , STB_INT32* nFrameCount );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HVC/STBLib/src/STB_Property/STBPeAPI.c Tue Sep 05 10:01:51 2017 +0000
@@ -0,0 +1,647 @@
+/*---------------------------------------------------------------------------*/
+/* Copyright(C) 2017 OMRON Corporation */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
+/* See the License for the specific language governing permissions and */
+/* limitations under the License. */
+/*---------------------------------------------------------------------------*/
+
+#include "STBPeAPI.h"
+
+
+/*---------------------------------------------------------------------*/
+// PeSlideFacesRec
+/*---------------------------------------------------------------------*/
+void PeSlideFacesRec ( STB_PE_DET *facesRec , STBExecFlg *execFlg)
+{
+ STB_INT32 t , i ,j;
+
+ for( t = STB_PE_BACK_MAX -2 ; t >= 0 ; t-- )
+ {
+ facesRec [ t + 1 ].num = facesRec[ t + 0 ].num;
+ for( i = 0 ; i < facesRec [ t + 1 ].num ; i++ )
+ {
+ facesRec[ t + 1 ].fcDet[i].nDetID = facesRec[ t ].fcDet[i].nDetID ;
+ facesRec[ t + 1 ].fcDet[i].nTraID = facesRec[ t ].fcDet[i].nTraID ;
+ if( execFlg->gen == STB_TRUE )
+ {
+ facesRec[ t + 1 ].fcDet[i].genDetVal = facesRec[ t ].fcDet[i].genDetVal ;
+ facesRec[ t + 1 ].fcDet[i].genStatus = facesRec[ t ].fcDet[i].genStatus ;
+ facesRec[ t + 1 ].fcDet[i].genDetConf = facesRec[ t ].fcDet[i].genDetConf ;
+ }
+ if( execFlg->age == STB_TRUE )
+ {
+ facesRec[ t + 1 ].fcDet[i].ageDetVal = facesRec[ t ].fcDet[i].ageDetVal ;
+ facesRec[ t + 1 ].fcDet[i].ageStatus = facesRec[ t ].fcDet[i].ageStatus ;
+ facesRec[ t + 1 ].fcDet[i].ageDetConf = facesRec[ t ].fcDet[i].ageDetConf ;
+ }
+ if( execFlg->exp == STB_TRUE )
+ {
+ facesRec[ t + 1 ].fcDet[i].expDetConf = facesRec[ t ].fcDet[i].expDetConf ;
+ for( j = 0 ; j < STB_EX_MAX ; j++)
+ {
+ facesRec[ t + 1 ].fcDet[ i ].expDetVal[ j ]
+ = facesRec[ t + 0 ].fcDet[ i ].expDetVal[ j ];
+ }
+ }
+ if( execFlg->gaz == STB_TRUE )
+ {
+ facesRec[ t + 1 ].fcDet[i].gazDetLR = facesRec[ t ].fcDet[i].gazDetLR ;
+ facesRec[ t + 1 ].fcDet[i].gazDetUD = facesRec[ t ].fcDet[i].gazDetUD ;
+ }
+ //if( execFlg->dir == STB_TRUE )
+ //{
+ facesRec[ t + 1 ].fcDet[i].dirDetRoll = facesRec[ t ].fcDet[i].dirDetRoll ;
+ facesRec[ t + 1 ].fcDet[i].dirDetPitch = facesRec[ t ].fcDet[i].dirDetPitch;
+ facesRec[ t + 1 ].fcDet[i].dirDetYaw = facesRec[ t ].fcDet[i].dirDetYaw ;
+ facesRec[ t + 1 ].fcDet[i].dirDetConf = facesRec[ t ].fcDet[i].dirDetConf ;
+ //}
+ if( execFlg->bli == STB_TRUE )
+ {
+ facesRec[ t + 1 ].fcDet[i].bliDetL = facesRec[ t ].fcDet[i].bliDetL ;
+ facesRec[ t + 1 ].fcDet[i].bliDetR = facesRec[ t ].fcDet[i].bliDetR ;
+ }
+ }
+ }
+
+}
+/*---------------------------------------------------------------------*/
+// PeCurFaces
+/*---------------------------------------------------------------------*/
+void PeCurFaces ( STB_PE_DET *facesRec , STB_PE_DET *srcFace ,STBExecFlg *execFlg)
+{
+ STB_INT32 i ,j;
+
+
+ facesRec [ 0 ].num = srcFace->num;
+ for( i = 0 ; i < facesRec [ 0 ].num ; i++ )
+ {
+ facesRec[ 0 ].fcDet[ i ].nDetID = srcFace[ 0 ].fcDet[ i ].nDetID ;
+ facesRec[ 0 ].fcDet[ i ].nTraID = srcFace[ 0 ].fcDet[ i ].nTraID ;
+ if( execFlg->gen == STB_TRUE )
+ {
+ facesRec[ 0 ].fcDet[ i ].genDetVal = srcFace[ 0 ].fcDet[ i ].genDetVal ;
+ facesRec[ 0 ].fcDet[ i ].genStatus = STB_STATUS_NO_DATA ;
+ facesRec[ 0 ].fcDet[ i ].genDetConf = srcFace[ 0 ].fcDet[ i ].genDetConf;
+ }
+ if( execFlg->age == STB_TRUE )
+ {
+ facesRec[ 0 ].fcDet[ i ].ageDetVal = srcFace[ 0 ].fcDet[ i ].ageDetVal ;
+ facesRec[ 0 ].fcDet[ i ].ageStatus = STB_STATUS_NO_DATA ;
+ facesRec[ 0 ].fcDet[ i ].ageDetConf = srcFace[ 0 ].fcDet[ i ].ageDetConf;
+ }
+ if( execFlg->exp == STB_TRUE )
+ {
+ facesRec[ 0 ].fcDet[ i ].expDetConf = srcFace[ 0 ].fcDet[ i ].expDetConf ;
+ for( j = 0 ; j < STB_EX_MAX ; j++)
+ {
+ facesRec[ 0 ].fcDet[ i ].expDetVal[ j] = srcFace[ 0 ].fcDet[ i ].expDetVal[ j];
+ }
+ }
+ if( execFlg->gaz == STB_TRUE )
+ {
+ facesRec[ 0 ].fcDet[ i ].gazDetLR = srcFace[ 0 ].fcDet[ i ].gazDetLR ;
+ facesRec[ 0 ].fcDet[ i ].gazDetUD = srcFace[ 0 ].fcDet[ i ].gazDetUD ;
+ }
+ //if( execFlg->dir == STB_TRUE )
+ //{
+ facesRec[ 0 ].fcDet[ i ].dirDetRoll = srcFace[ 0 ].fcDet[ i ].dirDetRoll ;
+ facesRec[ 0 ].fcDet[ i ].dirDetYaw = srcFace[ 0 ].fcDet[ i ].dirDetYaw ;
+ facesRec[ 0 ].fcDet[ i ].dirDetPitch = srcFace[ 0 ].fcDet[ i ].dirDetPitch ;
+ facesRec[ 0 ].fcDet[ i ].dirDetConf = srcFace[ 0 ].fcDet[ i ].dirDetConf ;
+ //}
+ if( execFlg->bli == STB_TRUE )
+ {
+ facesRec[ 0 ].fcDet[ i ].bliDetL = srcFace[ 0 ].fcDet[ i ].bliDetL ;
+ facesRec[ 0 ].fcDet[ i ].bliDetR = srcFace[ 0 ].fcDet[ i ].bliDetR ;
+ }
+ }
+}
+
+/*----------------------------------------------------------------------------------------------------*/
+/* PeExpressID */
+/*----------------------------------------------------------------------------------------------------*/
+STB_INT32 PeExpressID( STB_INT32* exp )
+{
+ int i;
+ int tmpVal;
+ int retVal;
+
+ retVal = 0;
+ tmpVal = 0;
+ for( i = 0 ; i < STB_EX_MAX ; i++)
+ {
+ if( tmpVal < exp[i] && exp[i] != STB_ERR_PE_CANNOT )
+ {
+ tmpVal = exp[i];
+ retVal = i;
+ }
+ }
+ return retVal;
+}
+/*---------------------------------------------------------------------*/
+// PeStbFaceEasy
+/*---------------------------------------------------------------------*/
+void PeStbFaceEasy
+ (
+ STB_PE_RES *peRes ,
+ STB_PE_DET *peRec ,
+ STB_INT32 dirThr ,
+ STB_INT32 dirUDMax ,
+ STB_INT32 dirUDMin ,
+ STB_INT32 dirLRMax ,
+ STB_INT32 dirLRMin ,
+ STB_INT32 frmMax ,
+ STBExecFlg *execFlg
+ )
+{
+
+
+ /*Checking the past data here, fill in all peRes.*/
+ STB_INT32 k ,t,i ;
+ STB_INT32 trID;
+
+ STB_INT32 recCnt;
+ STB_INT32 recVal [STB_PE_BACK_MAX];
+ STB_INT32 recConf [STB_PE_BACK_MAX];
+ STB_INT32 tmpVal;
+ STB_INT32 tmpConf;
+ STB_INT32 expVal [STB_EX_MAX] = {0};
+
+ STB_STATUS preSAge ;
+ STB_STATUS preSGen ;
+ STB_INT32 preVAge ;
+ STB_INT32 preVGen ;
+ STB_INT32 preCAge ;
+ STB_INT32 preCGen ;
+ STB_STATUS tmpS ;
+
+
+
+ for( t = 0; t < STB_PE_BACK_MAX ; t++)
+ {
+ recVal [t] = 0;
+ recConf[t] = 0;
+ }
+
+
+ /*do stabilization processing each tracking person*/
+ peRes->peCnt = peRec[0].num ;//a number of tracking people(present)
+ for( k = 0; k < peRes->peCnt ; k++)
+ {
+ trID = peRec[0].fcDet[k].nTraID;/*Tracking person number in the through frame*/
+
+
+ // peRes Add -------------------------------------------------------------------------------------------------
+ peRes->peFace[k].nTraID = trID;
+
+
+ // preStatus -------------------------------------------------------------------------------------------------
+ preSAge = STB_STATUS_NO_DATA ;
+ preSGen = STB_STATUS_NO_DATA ;
+ preVAge = 0 ;
+ preVGen = 0 ;
+ preCAge = 0 ;
+ preCGen = 0 ;
+ if( execFlg->age == STB_TRUE || execFlg->gen == STB_TRUE )
+ {
+ for( i = 0; i < peRec[1].num ; i++)
+ {
+ if( peRec[1].fcDet[i].nTraID == trID )
+ {
+ preSAge = peRec[1].fcDet[i].ageStatus ;
+ preSGen = peRec[1].fcDet[i].genStatus ;
+ preVAge = peRec[1].fcDet[i].ageDetVal ;
+ preVGen = peRec[1].fcDet[i].genDetVal ;
+ preCAge = peRec[1].fcDet[i].ageDetConf ;
+ preCGen = peRec[1].fcDet[i].genDetConf ;
+ break;
+ }
+ }
+ }
+
+ // age -------------------------------------------------------------------------------------------------
+ if( execFlg->age == STB_TRUE )
+ {
+ if ( preSAge == STB_STATUS_NO_DATA //stabilization impossible: no data of the relevant people
+ || preSAge == STB_STATUS_CALCULATING //during stabilization : a number of data for relevant people aren't enough(a number of frames that relevant people are taken)
+ )
+ {
+ recCnt = 0;
+ for( t = 0; t < STB_PE_BACK_MAX ; t++) //previous t frame
+ {
+ for( i = 0; i < peRec[t].num ; i++) //a number of tracking people(previous t frame)
+ {
+ if(
+ peRec[t].fcDet[i].nTraID == trID //the same tracking number
+ && peRec[t].fcDet[i].nDetID >= 0 //not lost
+ && peRec[t].fcDet[i].dirDetConf >= dirThr // Face angle : confidence
+ && peRec[t].fcDet[i].dirDetPitch >= dirUDMin // Face angle : pitch
+ && peRec[t].fcDet[i].dirDetPitch <= dirUDMax // Face angle : pitch
+ && peRec[t].fcDet[i].dirDetYaw >= dirLRMin // Face angle : yaw
+ && peRec[t].fcDet[i].dirDetYaw <= dirLRMax // Face angle : yaw
+ && peRec[t].fcDet[i].ageDetVal != STB_ERR_PE_CANNOT //
+ && peRec[t].fcDet[i].ageDetConf != STB_ERR_PE_CANNOT //
+ )
+ {
+ recVal [ recCnt ] = peRec[ t ].fcDet[ i ].ageDetVal ;
+ recConf[ recCnt ] = peRec[ t ].fcDet[ i ].ageDetConf ;
+ recCnt++;
+ }
+ }
+ }
+ tmpS = STB_STATUS_NO_DATA;
+ if ( recCnt == 0 ) { tmpS = STB_STATUS_NO_DATA ; }//stabilization impossible
+ else if ( recCnt < frmMax ) { tmpS = STB_STATUS_CALCULATING; }//during stabilization
+ else if ( recCnt >= frmMax ) { tmpS = STB_STATUS_COMPLETE ; }//Just after stabilization
+ tmpVal = 0;
+ tmpConf = 0;
+ for( i = 0; i < recCnt ; i++ )
+ {
+ tmpVal += recVal [ i ] ;
+ tmpConf += recConf[ i ] ;
+ }
+ if ( recCnt == 0 ) { recCnt = 1 ; }
+ tmpVal /= recCnt;
+ tmpConf /= recCnt;
+ peRes->peFace[k].age.value = tmpVal ;
+ peRes->peFace[k].age.conf = STB_CONF_NO_DATA ;
+ peRes->peFace[k].age.status = tmpS ;
+ peRec[0].fcDet[k].ageStatus = tmpS ;
+ if( tmpS == STB_STATUS_COMPLETE )//Just after stabilization
+ {
+ peRec[0].fcDet[k].ageDetVal = tmpVal ;
+ peRec[0].fcDet[k].ageDetConf = tmpConf ;
+ }
+ }else if ( preSAge == STB_STATUS_COMPLETE //Just after stabilization
+ || preSAge == STB_STATUS_FIXED //already stabilized
+ )
+ {
+ peRes->peFace[k].age.value = preVAge ;
+ peRes->peFace[k].age.conf = preCAge;
+ peRes->peFace[k].age.status = STB_STATUS_FIXED ;//already stabilized
+ peRec[0].fcDet[k].ageDetVal = preVAge ;
+ peRec[0].fcDet[k].ageDetConf = preCAge ;
+ peRec[0].fcDet[k].ageStatus = STB_STATUS_FIXED ;//already stabilized
+ }
+ }
+
+
+ // gender -------------------------------------------------------------------------------------------------
+ if( execFlg->gen == STB_TRUE )
+ {
+ if ( preSGen == STB_STATUS_NO_DATA //stabilization impossible: no data of the relevant people
+ || preSGen == STB_STATUS_CALCULATING //during stabilization : a number of data for relevant people aren't enough(a number of frames that relevant people are taken)
+ )
+ {
+ recCnt = 0;
+ for( t = 0; t < STB_PE_BACK_MAX ; t++)
+ {
+ for( i = 0; i < peRec[t].num ; i++) //a number of tracking people(previous t frame)
+ {
+ if(
+ peRec[t].fcDet[i].nTraID == trID //the same tracking number
+ && peRec[t].fcDet[i].nDetID >= 0 //not lost
+ && peRec[t].fcDet[i].dirDetConf >= dirThr // Face angle : confidence
+ && peRec[t].fcDet[i].dirDetPitch >= dirUDMin // Face angle : pitch
+ && peRec[t].fcDet[i].dirDetPitch <= dirUDMax // Face angle : pitch
+ && peRec[t].fcDet[i].dirDetYaw >= dirLRMin // Face angle : yaw
+ && peRec[t].fcDet[i].dirDetYaw <= dirLRMax // Face angle : yaw
+ && peRec[t].fcDet[i].genDetVal != STB_ERR_PE_CANNOT //
+ && peRec[t].fcDet[i].genDetConf != STB_ERR_PE_CANNOT //
+ )
+ {
+ recVal [ recCnt ] = peRec[ t ].fcDet[ i ].genDetVal ;// 1:man 0:woman
+ recConf[ recCnt ] = peRec[ t ].fcDet[ i ].genDetConf;
+ recCnt++;
+ }
+ }
+ }
+ tmpS = STB_STATUS_NO_DATA;
+ if ( recCnt == 0 ) { tmpS = STB_STATUS_NO_DATA ; }//stabilization impossible
+ else if ( recCnt < frmMax ) { tmpS = STB_STATUS_CALCULATING; }//during stabilization
+ else if ( recCnt >= frmMax ) { tmpS = STB_STATUS_COMPLETE ; }//Just after stabilization
+ tmpVal = 0;
+ tmpConf = 0;
+ for( i = 0; i < recCnt ; i++ )
+ {
+ tmpVal += recVal [ i ] ;
+ tmpConf += recConf[ i ] ;
+ }
+ if ( recCnt == 0 ) { recCnt = 1 ; }
+ tmpConf /= recCnt;
+ if ( tmpVal * 2 <= recCnt )
+ {
+ peRes->peFace[k].gen.value = 0 ;// 1:man 0:woman
+ peRes->peFace[k].gen.status = tmpS ;
+ peRes->peFace[k].gen.conf = STB_CONF_NO_DATA ;
+ peRec[0].fcDet[k].genStatus = tmpS ;
+ if( tmpS == STB_STATUS_COMPLETE )//Just after stabilization
+ {
+ peRec[0].fcDet[k].genDetVal = 0 ;
+ peRec[0].fcDet[k].genDetConf = tmpConf ;
+ }
+ }
+ else
+ {
+ peRes->peFace[k].gen.value = 1 ;// 1:man 0:woman
+ peRes->peFace[k].gen.status = tmpS ;
+ peRes->peFace[k].gen.conf = STB_CONF_NO_DATA ;
+ peRec[0].fcDet[k].genStatus = tmpS ;
+ if( tmpS == STB_STATUS_COMPLETE )//Just after stabilization
+ {
+ peRec[0].fcDet[k].genDetVal = 1 ;
+ peRec[0].fcDet[k].genDetConf = tmpConf ;
+ }
+ }
+ }else if ( preSGen == STB_STATUS_COMPLETE //Just after stabilization
+ || preSGen == STB_STATUS_FIXED //already stabilized
+ )
+ {
+ peRes->peFace[k].gen.value = preVGen ;
+ peRes->peFace[k].gen.conf = preCGen;
+ peRes->peFace[k].gen.status = STB_STATUS_FIXED ;//already stabilized
+ peRec[0].fcDet[k].genDetVal = preVGen ;
+ peRec[0].fcDet[k].genStatus = STB_STATUS_FIXED ;//already stabilized
+ peRec[0].fcDet[k].genDetConf = preCGen ;
+ }
+ }
+
+ // gazeLR -------------------------------------------------------------------------------------------------
+ if( execFlg->gaz == STB_TRUE )
+ {
+ recCnt = 0;
+ for( t = 0; t < STB_PE_BACK_MAX ; t++)
+ {
+ for( i = 0; i < peRec[t].num ; i++) //a number of tracking people(previous t frame)
+ {
+ if(
+ peRec[t].fcDet[i].nTraID == trID //the same tracking number
+ && peRec[t].fcDet[i].nDetID >= 0 //not lost
+ && peRec[t].fcDet[i].dirDetConf >= dirThr // Face angle : confidence
+ && peRec[t].fcDet[i].dirDetPitch >= dirUDMin // Face angle : pitch
+ && peRec[t].fcDet[i].dirDetPitch <= dirUDMax // Face angle : pitch
+ && peRec[t].fcDet[i].dirDetYaw >= dirLRMin // Face angle : yaw
+ && peRec[t].fcDet[i].dirDetYaw <= dirLRMax // Face angle : yaw
+ && peRec[t].fcDet[i].gazDetLR != STB_ERR_PE_CANNOT //
+ )
+ {
+ recVal[ recCnt ] = peRec[ t ].fcDet [ i ].gazDetLR ;
+ recCnt++;
+ }
+ }
+ }
+ if ( recCnt == 0 ) { peRes->peFace[k].gaz.status = STB_STATUS_NO_DATA ; }//stabilization impossible
+ else { peRes->peFace[k].gaz.status = STB_STATUS_CALCULATING; }//during stabilization
+ peRes->peFace[k].gaz.conf = STB_CONF_NO_DATA;//no Confidence
+ tmpVal = 0;
+ for( i = 0; i < recCnt ; i++ ) { tmpVal += recVal[ i ] ; }
+ if ( recCnt == 0 ) { recCnt = 1 ; }
+ peRes->peFace[k].gaz.LR = tmpVal / recCnt;
+ // gazeUD -------------------------------------------------------------------------------------------------
+ recCnt = 0;
+ for( t = 0; t < STB_PE_BACK_MAX ; t++)
+ {
+ for( i = 0; i < peRec[t].num ; i++) //a number of tracking people(previous t frame)
+ {
+ if(
+ peRec[t].fcDet[i].nTraID == trID //the same tracking number
+ && peRec[t].fcDet[i].nDetID >= 0 //not lost
+ && peRec[t].fcDet[i].dirDetConf >= dirThr // Face angle : confidence
+ && peRec[t].fcDet[i].dirDetPitch >= dirUDMin // Face angle : pitch
+ && peRec[t].fcDet[i].dirDetPitch <= dirUDMax // Face angle : pitch
+ && peRec[t].fcDet[i].dirDetYaw >= dirLRMin // Face angle : yaw
+ && peRec[t].fcDet[i].dirDetYaw <= dirLRMax // Face angle : yaw
+ && peRec[t].fcDet[i].gazDetUD != STB_ERR_PE_CANNOT //
+ )
+ {
+ recVal[ recCnt ] = peRec[ t ].fcDet [ i ].gazDetUD ;
+ recCnt++;
+ }
+ }
+ }
+ tmpVal = 0;
+ for( i = 0; i < recCnt ; i++ ) { tmpVal += recVal[ i ] ; }
+ if ( recCnt == 0 ) { recCnt = 1 ; }
+ peRes->peFace[k].gaz.UD = tmpVal / recCnt;
+ }
+
+
+ // expression -------------------------------------------------------------------------------------------------
+ if( execFlg->exp == STB_TRUE )
+ {
+ recCnt = 0;
+ for( t = 0; t < STB_PE_BACK_MAX ; t++)
+ {
+ for( i = 0; i < peRec[t].num ; i++) //a number of tracking people(previous t frame)
+ {
+ if(
+ peRec[t].fcDet[i].nTraID == trID //the same tracking number
+ && peRec[t].fcDet[i].nDetID >= 0 //not lost
+ && peRec[t].fcDet[i].dirDetConf >= dirThr // Face angle : confidence
+ && peRec[t].fcDet[i].dirDetPitch >= dirUDMin // Face angle : pitch
+ && peRec[t].fcDet[i].dirDetPitch <= dirUDMax // Face angle : pitch
+ && peRec[t].fcDet[i].dirDetYaw >= dirLRMin // Face angle : yaw
+ && peRec[t].fcDet[i].dirDetYaw <= dirLRMax // Face angle : yaw
+ && peRec[t].fcDet[i].expDetConf != STB_ERR_PE_CANNOT //
+ )
+ {
+ recVal[ recCnt ] = PeExpressID ( peRec[ t ].fcDet[i].expDetVal );
+ recCnt++;
+ }
+ }
+ }
+ for( i = 0; i < STB_EX_MAX; i++ ) { expVal[ i ] = 0 ; }
+ for( i = 0; i < recCnt ; i++ ) { expVal[ recVal[ i ] ] += 1 ; }
+ peRes->peFace[k].exp.value = PeExpressID ( expVal );
+ peRes->peFace[k].exp.conf = STB_CONF_NO_DATA;//no Confidence
+ if ( recCnt == 0 ) { peRes->peFace[k].exp.status = STB_STATUS_NO_DATA ; }//stabilization impossible
+ else { peRes->peFace[k].exp.status = STB_STATUS_CALCULATING; }//during stabilization
+ }
+
+ // blink L -------------------------------------------------------------------------------------------------
+ if( execFlg->bli == STB_TRUE )
+ {
+ recCnt = 0;
+ for( t = 0; t < STB_PE_BACK_MAX ; t++)
+ {
+ for( i = 0; i < peRec[t].num ; i++) //a number of tracking people(previous t frame)
+ {
+ if(
+ peRec[t].fcDet[i].nTraID == trID //the same tracking number
+ && peRec[t].fcDet[i].nDetID >= 0 //not lost
+ && peRec[t].fcDet[i].dirDetConf >= dirThr // Face angle : confidence
+ && peRec[t].fcDet[i].dirDetPitch >= dirUDMin // Face angle : pitch
+ && peRec[t].fcDet[i].dirDetPitch <= dirUDMax // Face angle : pitch
+ && peRec[t].fcDet[i].dirDetYaw >= dirLRMin // Face angle : yaw
+ && peRec[t].fcDet[i].dirDetYaw <= dirLRMax // Face angle : yaw
+ && peRec[t].fcDet[i].bliDetL != STB_ERR_PE_CANNOT //
+ )
+ {
+ recVal[ recCnt ] = peRec[ t ].fcDet[ i ].bliDetL ;
+ recCnt++;
+ }
+ }
+ }
+ if ( recCnt == 0 ) { peRes->peFace[k].bli.status = STB_STATUS_NO_DATA ; }//stabilization impossible
+ else { peRes->peFace[k].bli.status = STB_STATUS_CALCULATING; }//during stabilization
+ tmpVal = 0;
+ for( i = 0; i < recCnt ; i++ ) { tmpVal += recVal[ i ] ; }
+ if ( recCnt == 0 ) { recCnt = 1 ; }
+ peRes->peFace[k].bli.ratioL = tmpVal / recCnt;
+ // blink R -------------------------------------------------------------------------------------------------
+ recCnt = 0;
+ for( t = 0; t < STB_PE_BACK_MAX ; t++)
+ {
+ for( i = 0; i < peRec[t].num ; i++) //a number of tracking people(previous t frame)
+ {
+ if(
+ peRec[t].fcDet[i].nTraID == trID //the same tracking number
+ && peRec[t].fcDet[i].nDetID >= 0 //not lost
+ && peRec[t].fcDet[i].dirDetConf >= dirThr // Face angle : confidence
+ && peRec[t].fcDet[i].dirDetPitch >= dirUDMin // Face angle : pitch
+ && peRec[t].fcDet[i].dirDetPitch <= dirUDMax // Face angle : pitch
+ && peRec[t].fcDet[i].dirDetYaw >= dirLRMin // Face angle : yaw
+ && peRec[t].fcDet[i].dirDetYaw <= dirLRMax // Face angle : yaw
+ && peRec[t].fcDet[i].bliDetR != STB_ERR_PE_CANNOT //
+ )
+ {
+ recVal[ recCnt ] = peRec[ t ].fcDet [ i ].bliDetR;
+ recCnt++;
+ }
+ }
+ }
+ tmpVal = 0;
+ for( i = 0; i < recCnt ; i++ ) { tmpVal += recVal[ i ] ; }
+ if ( recCnt == 0 ) { recCnt = 1 ; }
+ peRes->peFace[k].bli.ratioR = tmpVal / recCnt;
+ }
+
+
+
+ // dirYaw -------------------------------------------------------------------------------------------------
+ if( execFlg->dir == STB_TRUE )
+ {
+ recCnt = 0;
+ for( t = 0; t < STB_PE_BACK_MAX ; t++)
+ {
+ for( i = 0; i < peRec[t].num ; i++) //a number of tracking people(previous t frame)
+ {
+ if(
+ peRec[t].fcDet[i].nTraID == trID //the same tracking number
+ && peRec[t].fcDet[i].nDetID >= 0 //not lost
+ && peRec[t].fcDet[i].dirDetConf >= dirThr // Face angle : confidence
+ && peRec[t].fcDet[i].dirDetPitch >= dirUDMin // Face angle : pitch
+ && peRec[t].fcDet[i].dirDetPitch <= dirUDMax // Face angle : pitch
+ && peRec[t].fcDet[i].dirDetYaw >= dirLRMin // Face angle : yaw
+ && peRec[t].fcDet[i].dirDetYaw <= dirLRMax // Face angle : yaw
+ )
+ {
+ recVal[ recCnt ] = peRec[ t ].fcDet [ i ].dirDetYaw ;
+ recCnt++;
+ }
+ }
+ }
+ if ( recCnt == 0 ) { peRes->peFace[k].dir.status = STB_STATUS_NO_DATA ; }//stabilization impossible
+ else { peRes->peFace[k].dir.status = STB_STATUS_CALCULATING; }//during stabilization
+ peRes->peFace[k].dir.conf = STB_CONF_NO_DATA;//no Confidence
+ tmpVal = 0;
+ for( i = 0; i < recCnt ; i++ ) { tmpVal += recVal[ i ] ; }
+ if ( recCnt == 0 ) { recCnt = 1 ; }
+ peRes->peFace[k].dir.yaw = tmpVal / recCnt;
+ // dirRoll -------------------------------------------------------------------------------------------------
+ recCnt = 0;
+ for( t = 0; t < STB_PE_BACK_MAX ; t++)
+ {
+ for( i = 0; i < peRec[t].num ; i++) //a number of tracking people(previous t frame)
+ {
+ if(
+ peRec[t].fcDet[i].nTraID == trID //the same tracking number
+ && peRec[t].fcDet[i].nDetID >= 0 //not lost
+ && peRec[t].fcDet[i].dirDetConf >= dirThr // Face angle : confidence
+ && peRec[t].fcDet[i].dirDetPitch >= dirUDMin // Face angle : pitch
+ && peRec[t].fcDet[i].dirDetPitch <= dirUDMax // Face angle : pitch
+ && peRec[t].fcDet[i].dirDetYaw >= dirLRMin // Face angle : yaw
+ && peRec[t].fcDet[i].dirDetYaw <= dirLRMax // Face angle : yaw
+ )
+ {
+ recVal[ recCnt ] = peRec[ t ].fcDet [ i ].dirDetRoll;
+ recCnt++;
+ }
+ }
+ }
+ tmpVal = 0;
+ for( i = 0; i < recCnt ; i++ ) { tmpVal += recVal[ i ] ; }
+ if ( recCnt == 0 ) { recCnt = 1 ; }
+ peRes->peFace[k].dir.roll = tmpVal / recCnt;
+ // dirPitch -------------------------------------------------------------------------------------------------
+ recCnt = 0;
+ for( t = 0; t < STB_PE_BACK_MAX ; t++)
+ {
+ for( i = 0; i < peRec[t].num ; i++) //a number of tracking people(previous t frame)
+ {
+ if(
+ peRec[t].fcDet[i].nTraID == trID //the same tracking number
+ && peRec[t].fcDet[i].nDetID >= 0 //not lost
+ && peRec[t].fcDet[i].dirDetConf >= dirThr // Face angle : confidence
+ && peRec[t].fcDet[i].dirDetPitch >= dirUDMin // Face angle : pitch
+ && peRec[t].fcDet[i].dirDetPitch <= dirUDMax // Face angle : pitch
+ && peRec[t].fcDet[i].dirDetYaw >= dirLRMin // Face angle : yaw
+ && peRec[t].fcDet[i].dirDetYaw <= dirLRMax // Face angle : yaw
+ )
+ {
+ recVal[ recCnt ] = peRec[ t ].fcDet [ i ].dirDetPitch ;
+ recCnt++;
+ }
+ }
+ }
+ tmpVal = 0;
+ for( i = 0; i < recCnt ; i++ ) { tmpVal += recVal[ i ] ; }
+ if ( recCnt == 0 ) { recCnt = 1 ; }
+ peRes->peFace[k].dir.pitch = tmpVal / recCnt;
+ }
+
+ }//for( k = 0; k < peRes->peCnt ; k++)
+
+}
+/*---------------------------------------------------------------------*/
+// StbPeExec
+/*---------------------------------------------------------------------*/
+int StbPeExec ( PEHANDLE handle )
+{
+
+ int retVal = 0 ;
+
+ /* Face --------------------------------------*/
+ PeSlideFacesRec ( handle->peDetRec ,
+ handle->execFlg );//Shift the time series of past data before stabilization.
+ PeCurFaces ( handle->peDetRec ,
+ &(handle->peDet) ,
+ handle->execFlg );//Setting "present data before the stabilization" to past data before the stabilization.
+
+ PeStbFaceEasy ( &(handle->peRes) ,
+ handle->peDetRec ,
+ handle->peFaceDirThr ,
+ handle->peFaceDirUDMax ,
+ handle->peFaceDirUDMin ,
+ handle->peFaceDirLRMax ,
+ handle->peFaceDirLRMin ,
+ handle->peFrameCount ,
+ handle->execFlg );//Calculate "current data after stabilization" from "past data before stabilization".
+
+
+
+
+ return retVal;
+}
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HVC/STBLib/src/STB_Property/STBPeAPI.h Tue Sep 05 10:01:51 2017 +0000 @@ -0,0 +1,22 @@ +/*---------------------------------------------------------------------------*/ +/* Copyright(C) 2017 OMRON Corporation */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ +/* See the License for the specific language governing permissions and */ +/* limitations under the License. */ +/*---------------------------------------------------------------------------*/ + +#include "PeInterface.h" + +int StbPeExec ( PEHANDLE handle ); + + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HVC/STBLib/src/STB_Property/STBPeValidValue.c Tue Sep 05 10:01:51 2017 +0000
@@ -0,0 +1,103 @@
+/*---------------------------------------------------------------------------*/
+/* Copyright(C) 2017 OMRON Corporation */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
+/* See the License for the specific language governing permissions and */
+/* limitations under the License. */
+/*---------------------------------------------------------------------------*/
+
+#include "STBPeValidValue.h"
+
+/*Value range check*/
+#define IS_OUT_RANGE( val , min , max ) ( ( (val) < (min) ) || ( (max) < (val) ) )
+#define IS_OUT_VALUE( val , min , max , accept ) ( IS_OUT_RANGE( val , min , max ) && ( (val) != (accept) ) )
+#define IS_OUT_FR_UID( val , min , max , acceptA , acceptB , acceptC ) ( IS_OUT_RANGE( val , min , max ) && ( (val) != (acceptA) ) && ( (val) != (acceptB) ) && ( (val) != (acceptC) ) )
+
+/*------------------------------------------------------------------------------------------------------------------*/
+/* STB_PeIsValidValue */
+/*------------------------------------------------------------------------------------------------------------------*/
+STB_INT32 STB_PeIsValidValue(const STB_PE_DET *input, STBExecFlg *execFlg)
+{
+ STB_INT32 i ,j;
+
+ if( execFlg->gen == STB_TRUE
+ || execFlg->age == STB_TRUE
+ || execFlg->fr == STB_TRUE
+ || execFlg->exp == STB_TRUE
+ || execFlg->dir == STB_TRUE
+ || execFlg->gaz == STB_TRUE
+ || execFlg->bli == STB_TRUE
+ )
+ {
+ for( i = 0 ; i < input->num ; i++)
+ {
+ if( IS_OUT_VALUE( input->fcDet[i].dirDetYaw , STB_FACE_DIR_LR_MIN , STB_FACE_DIR_LR_MAX , STB_ERR_DIR_CANNOT ) ){ return STB_FALSE;}
+ if( IS_OUT_VALUE( input->fcDet[i].dirDetPitch , STB_FACE_DIR_UD_MIN , STB_FACE_DIR_UD_MAX , STB_ERR_DIR_CANNOT ) ){ return STB_FALSE;}
+ if( IS_OUT_VALUE( input->fcDet[i].dirDetRoll , STB_FACE_DIR_ROLL_MIN , STB_FACE_DIR_ROLL_MAX , STB_ERR_DIR_CANNOT ) ){ return STB_FALSE;}
+ if( IS_OUT_VALUE( input->fcDet[i].dirDetConf , STB_FACE_DIR_CONF_MIN , STB_FACE_DIR_CONF_MAX , STB_ERR_PE_CANNOT ) ){ return STB_FALSE;}
+ }
+ }
+
+
+ if( execFlg->age == STB_TRUE )
+ {
+ for( i = 0 ; i < input->num ; i++)
+ {
+ if( IS_OUT_VALUE( input->fcDet[i].ageDetVal , STB_FACE_AGE_VAL_MIN , STB_FACE_AGE_VAL_MAX ,STB_ERR_PE_CANNOT ) ){ return STB_FALSE;}
+ if( IS_OUT_VALUE( input->fcDet[i].ageDetConf , STB_FACE_AGE_CONF_MIN , STB_FACE_AGE_CONF_MAX ,STB_ERR_PE_CANNOT ) ){ return STB_FALSE;}
+ }
+ }
+
+ if( execFlg->gen == STB_TRUE )
+ {
+ for( i = 0 ; i < input->num ; i++)
+ {
+ if( IS_OUT_VALUE( input->fcDet[i].genDetVal , STB_FACE_GEN_VAL_MIN , STB_FACE_GEN_VAL_MAX ,STB_ERR_PE_CANNOT ) ){ return STB_FALSE;}
+ if( IS_OUT_VALUE( input->fcDet[i].genDetConf , STB_FACE_GEN_CONF_MIN , STB_FACE_GEN_CONF_MAX ,STB_ERR_PE_CANNOT ) ){ return STB_FALSE;}
+ }
+ }
+
+ if( execFlg->gaz == STB_TRUE )
+ {
+ for( i = 0 ; i < input->num ; i++)
+ {
+ if( IS_OUT_VALUE( input->fcDet[i].gazDetLR , STB_FACE_GAZE_LR_MIN , STB_FACE_GAZE_LR_MAX ,STB_ERR_PE_CANNOT ) ){ return STB_FALSE;}
+ if( IS_OUT_VALUE( input->fcDet[i].gazDetUD , STB_FACE_GAZE_UD_MIN , STB_FACE_GAZE_UD_MAX ,STB_ERR_PE_CANNOT ) ){ return STB_FALSE;}
+ }
+ }
+
+ if( execFlg->bli == STB_TRUE )
+ {
+ for( i = 0 ; i < input->num ; i++)
+ {
+ if( IS_OUT_VALUE( input->fcDet[i].bliDetL , STB_FACE_BLI_L_MIN , STB_FACE_BLI_L_MAX ,STB_ERR_PE_CANNOT) ){ return STB_FALSE;}
+ if( IS_OUT_VALUE( input->fcDet[i].bliDetR , STB_FACE_BLI_R_MIN , STB_FACE_BLI_R_MAX ,STB_ERR_PE_CANNOT) ){ return STB_FALSE;}
+ }
+ }
+
+ if( execFlg->exp == STB_TRUE )
+ {
+ for( i = 0 ; i < input->num ; i++)
+ {
+ if( IS_OUT_VALUE( input->fcDet[i].expDetConf, STB_FACE_EXP_DEG_MIN , STB_FACE_EXP_DEG_MAX ,STB_ERR_PE_CANNOT) ){ return STB_FALSE;}
+ for( j = 0 ; j < STB_EX_MAX ; j++)
+ {
+ if( IS_OUT_VALUE( input->fcDet[i].expDetVal[j] ,STB_FACE_EXP_SCORE_MIN , STB_FACE_EXP_SCORE_MAX ,STB_ERR_PE_CANNOT) ){ return STB_FALSE;}
+ }
+
+ }
+ }
+
+
+
+
+ return STB_TRUE;
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HVC/STBLib/src/STB_Property/STBPeValidValue.h Tue Sep 05 10:01:51 2017 +0000 @@ -0,0 +1,96 @@ +/*---------------------------------------------------------------------------*/ +/* Copyright(C) 2017 OMRON Corporation */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ +/* See the License for the specific language governing permissions and */ +/* limitations under the License. */ +/*---------------------------------------------------------------------------*/ + +#ifndef STBPEVALIDVALUE_H__ +#define STBPEVALIDVALUE_H__ + + +#include "STBCommonDef.h" +#include "STBCommonType.h" +#include "STBPeTypedef.h" + +/*-------------------------------------------------------------------*/ +/*Threshold for checking input value*/ +/*-------------------------------------------------------------------*/ +#define STB_BODY_CNT_MIN 0 // body +#define STB_BODY_CNT_MAX 35 +#define STB_BODY_XY_MIN 0 +#define STB_BODY_XY_MAX 8191 +#define STB_BODY_SIZE_MIN 20 +#define STB_BODY_SIZE_MAX 8192 +#define STB_BODY_CONF_MIN 0 +#define STB_BODY_CONF_MAX 1000 +#define STB_FACE_CNT_MIN 0 // face +#define STB_FACE_CNT_MAX 35 +#define STB_FACE_XY_MIN 0 +#define STB_FACE_XY_MAX 8191 +#define STB_FACE_SIZE_MIN 20 +#define STB_FACE_SIZE_MAX 8192 +#define STB_FACE_CONF_MIN 0 +#define STB_FACE_CONF_MAX 1000 +#define STB_FACE_DIR_LR_MIN -180 +#define STB_FACE_DIR_LR_MAX 179 +#define STB_FACE_DIR_UD_MIN -180 +#define STB_FACE_DIR_UD_MAX 179 +#define STB_FACE_DIR_ROLL_MIN -180 +#define STB_FACE_DIR_ROLL_MAX 179 +#define STB_FACE_DIR_CONF_MIN 0 +#define STB_FACE_DIR_CONF_MAX 1000 +#define STB_FACE_AGE_VAL_MIN 0 +#define STB_FACE_AGE_VAL_MAX 75 +#define STB_FACE_AGE_CONF_MIN 0 +#define STB_FACE_AGE_CONF_MAX 1000 +#define STB_FACE_GEN_VAL_MIN 0 +#define STB_FACE_GEN_VAL_MAX 1 +#define STB_FACE_GEN_CONF_MIN 0 +#define STB_FACE_GEN_CONF_MAX 1000 +#define STB_FACE_GAZE_LR_MIN -90 +#define STB_FACE_GAZE_LR_MAX 90 +#define STB_FACE_GAZE_UD_MIN -90 +#define STB_FACE_GAZE_UD_MAX 90 +#define STB_FACE_BLI_L_MIN 1 +#define STB_FACE_BLI_L_MAX 1000 +#define STB_FACE_BLI_R_MIN 1 +#define STB_FACE_BLI_R_MAX 1000 +#define STB_FACE_EXP_SCORE_MIN 0 +#define STB_FACE_EXP_SCORE_MAX 100 /* not 1000 */ +#define STB_FACE_EXP_DEG_MIN -100 +#define STB_FACE_EXP_DEG_MAX 100 +#define STB_FACE_FR_UID_MIN 0 +#define STB_FACE_FR_UID_MAX 499 +#define STB_FACE_FR_SCORE_MIN 0 +#define STB_FACE_FR_SCORE_MAX 1000 + +/*-------------------------------------------------------------------*/ +/*Permitted input value*/ +/*-------------------------------------------------------------------*/ +#define STB_ERR_PE_CANNOT -128 /*Estimation is not possible.*/ +#define STB_ERR_FR_CANNOT -128 /*Recognition impossible*/ +#define STB_ERR_FR_NOID -1 /*No corresponding ID*/ +#define STB_ERR_FR_NOALBUM -127 /*Not-registered in Album*/ + +/*-------------------------------------------------------------------*/ +/*For collaboration with child library*/ +/*-------------------------------------------------------------------*/ +#define STB_ERR_DIR_CANNOT -256 /*Unable to angle estimation*/ + +/*-------------------------------------------------------------------*/ +/* Func */ +/*-------------------------------------------------------------------*/ +STB_INT32 STB_PeIsValidValue(const STB_PE_DET *input, STBExecFlg *execFlg); + +#endif /* COMMONDEF_H__ */ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HVC/STBLib/src/STB_Property/SdkSTBPe.c Tue Sep 05 10:01:51 2017 +0000
@@ -0,0 +1,80 @@
+/*---------------------------------------------------------------------------*/
+/* Copyright(C) 2017 OMRON Corporation */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
+/* See the License for the specific language governing permissions and */
+/* limitations under the License. */
+/*---------------------------------------------------------------------------*/
+
+#include "SdkSTBPe.h"
+#include "PeInterface.h"
+
+/*This layer only defines the API function */
+
+/*Create/Delete handle*/
+STB_PE_HANDLE STB_Pe_CreateHandle( const STBExecFlg* execFlg ,const STB_INT32 nTraCntMax ){
+ return (STB_PE_HANDLE)PeCreateHandle( execFlg , nTraCntMax );
+}
+
+STB_INT32 STB_Pe_DeleteHandle(STB_PE_HANDLE handle){
+ return PeDeleteHandle((PEHANDLE)handle);
+}
+
+/*set frame information*/
+STB_INT32 STB_Pe_SetDetect(STB_PE_HANDLE handle,const STB_PE_DET *stbPeDet){
+ return PeSetDetect((PEHANDLE)handle,stbPeDet);
+}
+
+/*Main process execution*/
+STB_INT32 STB_Pe_Execute(STB_PE_HANDLE handle){
+ return PeExecute((PEHANDLE)handle);
+}
+
+/*get the result*/
+STB_INT32 STB_Pe_GetResult(STB_PE_HANDLE handle, STB_PE_RES* peResult){
+ return PeGetResult((PEHANDLE)handle,peResult);
+}
+STB_INT32 STB_Pe_Clear ( STB_PE_HANDLE handle )
+{
+ return PeClear((PEHANDLE)handle );
+}
+
+
+
+/* FaceDirMinMax */
+STB_INT32 STB_Pe_SetFaceDirMinMax ( STB_PE_HANDLE handle , STB_INT32 nMinUDAngle , STB_INT32 nMaxUDAngle ,STB_INT32 nMinLRAngle , STB_INT32 nMaxLRAngle )
+{
+ return PeSetFaceDirMinMax((PEHANDLE)handle,nMinUDAngle,nMaxUDAngle,nMinLRAngle,nMaxLRAngle );
+}
+STB_INT32 STB_Pe_GetFaceDirMinMax ( STB_PE_HANDLE handle , STB_INT32 *pnMinUDAngle, STB_INT32 *pnMaxUDAngle ,STB_INT32 *pnMinLRAngle, STB_INT32 *pnMaxLRAngle)
+{
+ return PeGetFaceDirMinMax((PEHANDLE)handle,pnMinUDAngle,pnMaxUDAngle, pnMinLRAngle,pnMaxLRAngle);
+}
+/* FaceDirThreshold */
+STB_INT32 STB_Pe_SetFaceDirThreshold ( STB_PE_HANDLE handle , STB_INT32 threshold )
+{
+ return PeSetFaceDirThreshold((PEHANDLE)handle,threshold );
+}
+STB_INT32 STB_Pe_GetFaceDirThreshold ( STB_PE_HANDLE handle , STB_INT32* threshold )
+{
+ return PeGetFaceDirThreshold((PEHANDLE)handle,threshold );
+}
+
+/* FrameCount */
+STB_INT32 STB_Pe_SetFrameCount ( STB_PE_HANDLE handle , STB_INT32 nFrameCount )
+{
+ return PeSetFrameCount((PEHANDLE)handle,nFrameCount );
+}
+STB_INT32 STB_Pe_GetFrameCount ( STB_PE_HANDLE handle , STB_INT32* nFrameCount )
+{
+ return PeGetFrameCount((PEHANDLE)handle,nFrameCount );
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HVC/STBLib/src/STB_Property/SdkSTBPe.h Tue Sep 05 10:01:51 2017 +0000 @@ -0,0 +1,41 @@ +/*---------------------------------------------------------------------------*/ +/* Copyright(C) 2017 OMRON Corporation */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ +/* See the License for the specific language governing permissions and */ +/* limitations under the License. */ +/*---------------------------------------------------------------------------*/ + +#if !defined( _SDK_STBPE_H_ ) +#define _SDK_STBPE_H_ +#include "STBPeTypedef.h" + +#if !defined( STB_DEF_PE_HANDLE ) + #define STB_DEF_PE_HANDLE + typedef VOID* STB_PE_HANDLE; +#endif + +STB_PE_HANDLE STB_Pe_CreateHandle ( const STBExecFlg* execFlg ,const STB_INT32 nTraCntMax );/*Create/Delete handle*/ +STB_INT32 STB_Pe_DeleteHandle ( STB_PE_HANDLE handle );/*Create/Delete handle*/ +STB_INT32 STB_Pe_SetDetect ( STB_PE_HANDLE handle, const STB_PE_DET *stbPeDet );/*Frame information settings*/ +STB_INT32 STB_Pe_Execute ( STB_PE_HANDLE handle );/*Main process execution*/ +STB_INT32 STB_Pe_GetResult ( STB_PE_HANDLE handle, STB_PE_RES* peResult );/*Get result*/ + +/*parameter*/ +STB_INT32 STB_Pe_SetFaceDirMinMax ( STB_PE_HANDLE handle , STB_INT32 nMinUDAngle , STB_INT32 nMaxUDAngle ,STB_INT32 nMinLRAngle , STB_INT32 nMaxLRAngle );/* FaceDirMinMax */ +STB_INT32 STB_Pe_GetFaceDirMinMax ( STB_PE_HANDLE handle , STB_INT32 *pnMinUDAngle, STB_INT32 *pnMaxUDAngle ,STB_INT32 *pnMinLRAngle, STB_INT32 *pnMaxLRAngle); +STB_INT32 STB_Pe_Clear ( STB_PE_HANDLE handle );/* Clear */ +STB_INT32 STB_Pe_SetFaceDirThreshold ( STB_PE_HANDLE handle , STB_INT32 threshold );/* FaceDirThreshold */ +STB_INT32 STB_Pe_GetFaceDirThreshold ( STB_PE_HANDLE handle , STB_INT32* threshold ); +STB_INT32 STB_Pe_SetFrameCount ( STB_PE_HANDLE handle , STB_INT32 nFrameCount ); +STB_INT32 STB_Pe_GetFrameCount ( STB_PE_HANDLE handle , STB_INT32* nFrameCount ); + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HVC/STBLib/src/STB_Tracker/STBTrAPI.c Tue Sep 05 10:01:51 2017 +0000
@@ -0,0 +1,469 @@
+/*---------------------------------------------------------------------------*/
+/* Copyright(C) 2017 OMRON Corporation */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
+/* See the License for the specific language governing permissions and */
+/* limitations under the License. */
+/*---------------------------------------------------------------------------*/
+
+#include "STBTrAPI.h"
+
+#define STB_INT_MAX 2147483647 /* maximum (signed) int value */
+
+/*---------------------------------------------------------------------*/
+// TrSlideRec
+/*---------------------------------------------------------------------*/
+void TrSlideRec ( ROI_SYS *rec )
+{
+ STB_INT32 t , i ;
+
+ for( t = STB_TR_BACK_MAX - 2 ; t >= 0 ; t-- )
+ {
+ rec [ t + 1 ].cnt = rec[ t + 0 ].cnt;
+ for( i = 0 ; i < rec [ t + 1 ].cnt ; i++ )
+ {
+ rec [ t + 1 ].nDetID [i] = rec [ t ].nDetID [i] ;
+ rec [ t + 1 ].nTraID [i] = rec [ t ].nTraID [i] ;
+ rec [ t + 1 ].posX [i] = rec [ t ].posX [i] ;
+ rec [ t + 1 ].posY [i] = rec [ t ].posY [i] ;
+ rec [ t + 1 ].size [i] = rec [ t ].size [i] ;
+ rec [ t + 1 ].conf [i] = rec [ t ].conf [i] ;
+ rec [ t + 1 ].retryN [i] = rec [ t ].retryN [i] ;
+ }
+ }
+}
+/*---------------------------------------------------------------------*/
+// TrCurRec
+/*---------------------------------------------------------------------*/
+void TrCurRec ( ROI_SYS *rec , ROI_DET *det , STB_INT32 num)
+{
+ STB_INT32 i ;
+
+
+ rec [ 0 ].cnt =num;
+ for( i = 0 ; i < rec [ 0 ].cnt ; i++ )
+ {
+ rec [ 0 ].nDetID [i] = i ;
+ rec [ 0 ].nTraID [i] = -1 ;
+ rec [ 0 ].posX [i] = det[i].posX ;
+ rec [ 0 ].posY [i] = det[i].posY ;
+ rec [ 0 ].size [i] = det[i].size ;
+ rec [ 0 ].conf [i] = det[i].conf ;
+ rec [ 0 ].retryN [i] = 0 ;
+ }
+
+}
+
+
+/*---------------------------------------------------------------------*/
+// TrDelRetry
+/*---------------------------------------------------------------------*/
+void
+TrDelRetry( ROI_SYS *preData , STB_INT32 thrRetryCnt )
+{
+ //delete data exceeding the number of retries
+ //If the face isn't find out during tracking, set until how many frames can look for it.
+ //If tracking fails for the specified number of consecutive frames, tracking is terminated assuming that face is lost.
+ STB_INT32 i, tmpCnt ;
+
+ tmpCnt = 0;
+ for( i = 0 ; i < preData->cnt ; i++ )
+ {
+ if( preData->retryN[i] <= thrRetryCnt )
+ {
+
+ preData->nDetID [tmpCnt ] = preData->nDetID [i] ;
+ preData->nTraID [tmpCnt ] = preData->nTraID [i] ;
+ preData->posX [tmpCnt ] = preData->posX [i] ;
+ preData->posY [tmpCnt ] = preData->posY [i] ;
+ preData->size [tmpCnt ] = preData->size [i] ;
+ preData->conf [tmpCnt ] = preData->conf [i] ;
+ preData->retryN [tmpCnt ] = preData->retryN [i] ;
+ tmpCnt++;
+ }
+ }
+ preData->cnt = tmpCnt ;
+
+
+}
+/*---------------------------------------------------------------------*/
+// TrCheckSameROI
+/*---------------------------------------------------------------------*/
+STB_INT32
+TrCheckSameROI( STB_INT32 curX ,STB_INT32 curY ,STB_INT32 curS ,
+ STB_INT32 preX ,STB_INT32 preY ,STB_INT32 preS
+ )
+{
+
+ STB_INT32 difP ;//the percentage of detection position change
+ STB_INT32 difS ;//the percentage of detection size change
+ float tmpVal;
+ STB_INT32 retVal;
+
+ if( preS < 1 )
+ {
+ return STB_INT_MAX;
+ }
+
+ //the percentage of detect position change
+ //It is "Absolute value of detected position change amount from previous frame / Detected size of previous frame * 100".
+ tmpVal = (float)sqrt( (float) (preX-curX)*(preX-curX) + (preY-curY)*(preY-curY) );
+ difP = (STB_INT32)( tmpVal * 100 / preS );
+ //the percentage of detect size change
+ //It is "Absolute value of detected size change amount from previous frame / Detected size of previous frame * 100".
+ tmpVal = (float)(preS-curS);
+ if( tmpVal < 0 )
+ {
+ tmpVal *= (-1);
+ }
+ difS = (STB_INT32)( tmpVal * 100 / preS );
+ retVal = (difP+1)*(difS+1);
+
+ return retVal;//The return value is the similarity of the rectangle. Always a value more than or equal to zero. The closer to zero, the more similar they are.
+
+}
+/*---------------------------------------------------------------------*/
+// TrSetDistTbl
+/*---------------------------------------------------------------------*/
+void
+TrSetDistTbl
+ (
+ STB_INT32 *dst ,
+ ROI_SYS *curData ,
+ ROI_SYS *preData ,
+ STB_INT32 traCntMax
+ )
+{
+ STB_INT32 ip ,ic ;
+ STB_INT32 distMax = STB_INT_MAX;
+
+ // init
+ for( ip = 0 ; ip < traCntMax ; ip++ )
+ {
+ for( ic = 0 ; ic < traCntMax ; ic++ )
+ {
+ dst [ ip * traCntMax + ic ] = distMax;
+ }
+ }
+
+
+ for( ip = 0 ; ip < preData->cnt ; ip++ )
+ {
+ for( ic = 0 ; ic < curData->cnt ; ic++ )
+ {
+ dst [ ip * traCntMax + ic ]
+ = TrCheckSameROI//The return value is the similarity of the rectangle. Always a value more than or equal to zero. The closer to zero, the more similar they are.
+ (
+ curData->posX[ic],curData->posY[ic],curData->size[ic],
+ preData->posX[ip],preData->posY[ip],preData->size[ip]
+ );
+ }
+ }
+
+}
+/*---------------------------------------------------------------------*/
+// TrSteadinessXYS
+/*---------------------------------------------------------------------*/
+void
+TrSteadinessXYS
+ (
+ STB_INT32 curX ,STB_INT32 curY ,STB_INT32 curS ,
+ STB_INT32 preX ,STB_INT32 preY ,STB_INT32 preS ,
+ STB_INT32* dstX ,STB_INT32* dstY ,STB_INT32* dstS ,
+ STB_INT32 thrP ,STB_INT32 thrS
+ )
+{
+
+ STB_INT32 difP ;//the percentage of detection position change
+ STB_INT32 difS ;//the percentage of detection size change
+ float tmpVal;
+
+
+ if( preS < 1 )
+ {
+ *dstX = curX ; *dstY = curY ; *dstS = curS ;
+ return ;
+ }
+
+ //the percentage of detect position change
+ //It is "Absolute value of detected position change amount from previous frame / Detected size of previous frame * 100".
+ tmpVal = (float)sqrt( (float) (preX-curX)*(preX-curX) + (preY-curY)*(preY-curY) );
+ difP = (STB_INT32)( tmpVal * 100 / preS );
+ if( difP <= thrP )
+ {
+ *dstX = preX ; *dstY = preY ;
+ }else
+ {
+ *dstX = curX ; *dstY = curY ;
+ }
+
+ //the percentage of detect size change
+ //It is "Absolute value of detected size change amount from previous frame / Detected size of previous frame * 100".
+ tmpVal = (float)(preS-curS);
+ if( tmpVal < 0 )
+ {
+ tmpVal *= (-1);
+ }
+ difS = (STB_INT32)( tmpVal * 100 / preS );
+ if( difS <= thrS )
+ {
+ *dstS = preS ;
+ }else
+ {
+ *dstS = curS ;
+ }
+
+}
+/*---------------------------------------------------------------------*/
+// TrStabilizeTR
+/*---------------------------------------------------------------------*/
+void TrStabilizeTR
+ (
+ ROI_SYS *wData , //present data after the stabilization
+ STB_INT32 *wCnt , //a number of present data after the stabilization
+ ROI_SYS *rec , //past data
+ STB_INT32 *cntAcc ,
+ TRHANDLE handle
+ )
+{
+
+ STB_INT32 stedinessPos = handle->stedPos ;
+ STB_INT32 stedinessSize = handle->stedSize ;
+ STB_INT32 thrRetryCnt = handle->retryCnt ;
+ STB_INT32 traCntMax = handle->traCntMax ;
+ STB_INT32 *idPreCur = handle->wIdPreCur ;
+ STB_INT32 *idCurPre = handle->wIdCurPre ;
+ STB_INT32 *dstTbl = handle->wDstTbl ;
+ ROI_SYS *curData = &rec[0];//current frame data
+ ROI_SYS *preData = &rec[1];//previous frame data
+ STB_INT32 tmpAccCnt ;
+ STB_INT32 ip ,ic ;
+ STB_INT32 ipp ,icc ;
+ STB_INT32 tmpWCnt ;
+ STB_INT32 tmpVal ;
+ STB_INT32 tmpX,tmpY,tmpS ;
+ const STB_INT32 LinkNot = -1 ;
+
+
+ //------------------------------------------------------------------------------//
+ //Initialization
+ //------------------------------------------------------------------------------//
+ for( ip = 0 ; ip < traCntMax ; ip++ )
+ {
+ idPreCur[ip] = LinkNot;
+ idCurPre[ip] = LinkNot;
+ }
+
+
+ //------------------------------------------------------------------------------//
+ //previous preparation
+ //------------------------------------------------------------------------------//
+ //Delete the data exceeding the retry count from the previous frame data.
+ TrDelRetry ( preData ,thrRetryCnt );
+
+
+ //------------------------------------------------------------------------------//
+ //main processing
+ //------------------------------------------------------------------------------//
+ tmpWCnt = 0 ;//a number of present data after the stabilization
+
+ // "It's reflected in the previous frame" and "It's reflected in the current frame".
+ //Create dstTbl. The value of dstTbl is the similarity of the rectangle. Always a value more than or equal to zero. The closer to zero, the more similar they are.
+ TrSetDistTbl( dstTbl,curData,preData, traCntMax);
+ for( ;; )
+ {
+ //Get the combination (icc, ipp) that minimizes the value of dstTbl.
+ tmpVal = STB_INT_MAX; icc = -1; ipp = -1;
+ for( ic = 0 ; ic < curData->cnt ; ic++ )
+ {
+ for( ip = 0 ; ip < preData->cnt ; ip++ )
+ {
+ if( tmpVal > dstTbl [ ip * traCntMax + ic ] )
+ {
+ tmpVal = dstTbl [ ip * traCntMax + ic ] ; icc = ic; ipp = ip;
+ }
+ }
+ }
+ if( tmpVal == STB_INT_MAX )
+ {
+ break;
+ }
+
+ //Link ipp and icc
+ idCurPre[ icc ] = ipp ;
+ idPreCur[ ipp ] = icc ;
+ // steadiness
+ TrSteadinessXYS
+ (
+ curData->posX[icc] ,curData->posY[icc] ,curData->size[icc] ,
+ preData->posX[ipp] ,preData->posY[ipp] ,preData->size[ipp] ,
+ &tmpX ,&tmpY ,&tmpS ,
+ stedinessPos ,stedinessSize
+ );
+ // set
+ wData->nTraID[tmpWCnt] = preData->nTraID[ipp];
+ wData->nDetID[tmpWCnt] = curData->nDetID[icc];
+ wData->posX [tmpWCnt] = tmpX ;
+ wData->posY [tmpWCnt] = tmpY ;
+ wData->size [tmpWCnt] = tmpS ;
+ wData->conf [tmpWCnt] = ( ( curData->conf[icc] + preData->conf[ipp] ) /2 );
+ wData->retryN[tmpWCnt] = 0 ;//"It's reflected(linked) in the current frame"so that 0.
+ tmpWCnt++;
+ //Renewal "dstTbl" not to refer the associated data.
+ for( ic = 0 ; ic < curData->cnt ; ic++ )
+ {
+ dstTbl [ ipp * traCntMax + ic ] = STB_INT_MAX ;
+ }
+ for( ip = 0 ; ip < preData->cnt ; ip++ )
+ {
+ dstTbl [ ip * traCntMax + icc ] = STB_INT_MAX ;
+ }
+
+ if( tmpWCnt == traCntMax )
+ {
+ *wCnt = tmpWCnt;
+ return;
+ }
+ }
+
+ // "It is reflected in the previous frame" and "It is not reflected in the current frame".
+ for( ip = 0 ; ip < preData->cnt ; ip++ ) //"It's reflected in the previous frame"
+ {
+ if( idPreCur[ip] == LinkNot ) //"It's not reflected in the current frame"
+ {
+ // set
+ wData->nTraID[tmpWCnt] = preData->nTraID[ip];
+ wData->nDetID[tmpWCnt] = -1;//"It's not reflected in the current frame so the detection number is -1"
+ wData->posX [tmpWCnt] = preData->posX [ip];
+ wData->posY [tmpWCnt] = preData->posY [ip];
+ wData->size [tmpWCnt] = preData->size [ip];
+ wData->conf [tmpWCnt] = preData->conf[ip];
+ wData->retryN[tmpWCnt] = preData->retryN[ip] + 1 ;//"It's not reflected in the current frame"so that +1.
+ tmpWCnt++;
+ }
+ if( tmpWCnt == traCntMax)
+ {
+ *wCnt = tmpWCnt ;
+ return;
+ }
+ }
+
+ // "It is not reflected in the previous frame" and "It is reflected in the current frame".
+ tmpAccCnt = *cntAcc;
+ for( ic = 0 ; ic < curData->cnt ; ic++ ) //"It's reflected in the current frame"
+ {
+ if( idCurPre[ic] == LinkNot ) //"It's not reflected in the previous frame"
+ {
+ // set
+ wData->nTraID[tmpWCnt] = tmpAccCnt;
+ wData->nDetID[tmpWCnt] = curData->nDetID[ic];
+ wData->posX [tmpWCnt] = curData->posX [ic];
+ wData->posY [tmpWCnt] = curData->posY [ic];
+ wData->size [tmpWCnt] = curData->size [ic];
+ wData->conf [tmpWCnt] = curData->conf[ic];
+ wData->retryN[tmpWCnt] = 0 ;//"It's reflected in the current frame" so that 0.
+ tmpWCnt++;
+ tmpAccCnt++;
+ }
+ if( tmpWCnt == traCntMax )
+ {
+ *wCnt = tmpWCnt;
+ *cntAcc = tmpAccCnt;
+ return;
+ }
+ }
+
+
+ *wCnt = tmpWCnt ;
+ *cntAcc = tmpAccCnt;
+
+
+}
+/*---------------------------------------------------------------------*/
+// TrSetRes
+/*---------------------------------------------------------------------*/
+void TrSetRes( ROI_SYS* wRoi,STB_TR_RES* resData , STB_INT32* resCnt )
+{
+ STB_INT32 i;
+
+ *resCnt = wRoi->cnt;
+ for( i = 0 ; i < wRoi->cnt ; i++ )
+ {
+ resData[i].nTraID = wRoi->nTraID[i];
+ resData[i].nDetID = wRoi->nDetID[i];
+ resData[i].pos.x = wRoi->posX [i];
+ resData[i].pos.y = wRoi->posY [i];
+ resData[i].size = wRoi->size [i];
+ resData[i].conf = wRoi->conf[i];
+ }
+}
+/*---------------------------------------------------------------------*/
+// TrEditCur
+/*---------------------------------------------------------------------*/
+void TrEditCur( ROI_SYS* wRoi,ROI_SYS* curData )
+{
+ STB_INT32 i;
+
+ curData->cnt = wRoi->cnt;
+ for( i = 0 ; i < wRoi->cnt ; i++ )
+ {
+ curData->nTraID[i] = wRoi->nTraID[i];
+ curData->nDetID[i] = wRoi->nDetID[i];
+ curData->posX [i] = wRoi->posX [i];
+ curData->posY [i] = wRoi->posY [i];
+ curData->size [i] = wRoi->size [i];
+ curData->conf [i] = wRoi->conf [i];
+ curData->retryN[i] = wRoi->retryN[i];
+ }
+}
+/*---------------------------------------------------------------------*/
+// StbTrExec
+/*---------------------------------------------------------------------*/
+int StbTrExec ( TRHANDLE handle )
+{
+
+
+ /* Face --------------------------------------*/
+ if( handle->execFlg->faceTr == STB_TRUE )
+ {
+ //Move the time series of past data.
+ TrSlideRec( handle->fcRec );
+ //"the present data" set to the past data
+ TrCurRec( handle->fcRec ,handle->stbTrDet->fcDet, handle->stbTrDet->fcNum );
+ //Calculate "stabilized current data wRoi" from "past data".
+ TrStabilizeTR( handle->wRoi ,&(handle->wRoi->cnt) ,handle->fcRec ,&(handle->fcCntAcc) ,handle );
+ //Set "wRoi" data to output data "resFaces".
+ TrSetRes( handle->wRoi, handle->resFaces->face, &(handle->resFaces->cnt) );
+ //set "wRoi" data to accumulated data (current) "fcRec [0]".
+ TrEditCur( handle->wRoi, &(handle->fcRec[0]) );
+ }
+
+ /* Body --------------------------------------*/
+ if( handle->execFlg->bodyTr == STB_TRUE )
+ {
+ //Move the time series of past data.
+ TrSlideRec( handle->bdRec );
+ //"the present data" set to the past data
+ TrCurRec( handle->bdRec ,handle->stbTrDet->bdDet ,handle->stbTrDet->bdNum );
+ //Calculate "stabilized current data wRoi" from "past data".
+ TrStabilizeTR( handle->wRoi ,&(handle->wRoi->cnt) , handle->bdRec, &(handle->bdCntAcc) , handle );
+ //Set "wRoi" data to output data "resFaces".
+ TrSetRes( handle->wRoi, handle->resBodys->body, &(handle->resBodys->cnt) );
+ //set "wRoi" data to accumulated data (current) "bdRec [0]".
+ TrEditCur( handle->wRoi, &(handle->bdRec[0]) );
+ }
+
+
+ return STB_NORMAL;
+}
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HVC/STBLib/src/STB_Tracker/STBTrAPI.h Tue Sep 05 10:01:51 2017 +0000 @@ -0,0 +1,29 @@ +/*---------------------------------------------------------------------------*/ +/* Copyright(C) 2017 OMRON Corporation */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ +/* See the License for the specific language governing permissions and */ +/* limitations under the License. */ +/*---------------------------------------------------------------------------*/ + +#include "TrInterface.h" +#include "math.h" + +#ifndef ABS + #define ABS(a) (((a) > (0)) ? (a) : (-1*a)) +#endif /* ABS */ + + + +int StbTrExec ( TRHANDLE handle ); + + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HVC/STBLib/src/STB_Tracker/STBTrValidValue.c Tue Sep 05 10:01:51 2017 +0000
@@ -0,0 +1,59 @@
+/*---------------------------------------------------------------------------*/
+/* Copyright(C) 2017 OMRON Corporation */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
+/* See the License for the specific language governing permissions and */
+/* limitations under the License. */
+/*---------------------------------------------------------------------------*/
+
+#include "STBTrValidValue.h"
+
+/*Value range check*/
+#define IS_OUT_RANGE( val , min , max )( ( (val) < (min) ) || ( (max) < (val) ) )
+
+/*------------------------------------------------------------------------------------------------------------------*/
+/* STB_TrIsValidValue */
+/*------------------------------------------------------------------------------------------------------------------*/
+STB_INT32 STB_TrIsValidValue(const STB_TR_DET *input, STBExecFlg *execFlg)
+{
+ STB_INT32 i ;
+
+
+
+ if( execFlg->bodyTr == STB_TRUE )
+ {
+ if( IS_OUT_RANGE( input->bdNum , STB_BODY_CNT_MIN , STB_BODY_CNT_MAX ) ){ return STB_FALSE;}
+ for( i = 0 ; i < input->bdNum ; i++)
+ {
+ if( IS_OUT_RANGE( input->bdDet[i].posX , STB_BODY_XY_MIN , STB_BODY_XY_MAX ) ){ return STB_FALSE;}
+ if( IS_OUT_RANGE( input->bdDet[i].posY , STB_BODY_XY_MIN , STB_BODY_XY_MAX ) ){ return STB_FALSE;}
+ if( IS_OUT_RANGE( input->bdDet[i].size , STB_BODY_SIZE_MIN , STB_BODY_SIZE_MAX ) ){ return STB_FALSE;}
+ if( IS_OUT_RANGE( input->bdDet[i].conf , STB_BODY_CONF_MIN , STB_BODY_CONF_MAX ) ){ return STB_FALSE;}
+ }
+
+ }
+
+ if( execFlg->faceTr == STB_TRUE )
+ {
+ if( IS_OUT_RANGE( input->fcNum , STB_FACE_CNT_MIN , STB_FACE_CNT_MAX ) ){ return STB_FALSE;}
+ for( i = 0 ; i < input->fcNum ; i++)
+ {
+ if( IS_OUT_RANGE( input->fcDet[i].posX , STB_FACE_XY_MIN , STB_FACE_XY_MAX ) ){ return STB_FALSE;}
+ if( IS_OUT_RANGE( input->fcDet[i].posY , STB_FACE_XY_MIN , STB_FACE_XY_MAX ) ){ return STB_FALSE;}
+ if( IS_OUT_RANGE( input->fcDet[i].size , STB_FACE_SIZE_MIN , STB_FACE_SIZE_MAX ) ){ return STB_FALSE;}
+ if( IS_OUT_RANGE( input->fcDet[i].conf , STB_FACE_CONF_MIN , STB_FACE_CONF_MAX ) ){ return STB_FALSE;}
+ }
+ }
+
+
+
+ return STB_TRUE;
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HVC/STBLib/src/STB_Tracker/STBTrValidValue.h Tue Sep 05 10:01:51 2017 +0000 @@ -0,0 +1,92 @@ +/*---------------------------------------------------------------------------*/ +/* Copyright(C) 2017 OMRON Corporation */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ +/* See the License for the specific language governing permissions and */ +/* limitations under the License. */ +/*---------------------------------------------------------------------------*/ + +#ifndef STBTRVALIDVALUE_H__ +#define STBTRVALIDVALUE_H__ + + +#include "STBCommonDef.h" +#include "STBCommonType.h" +#include "STBTrTypedef.h" + +/*-------------------------------------------------------------------*/ +/*Threshold for checking input value*/ +/*-------------------------------------------------------------------*/ +#define STB_BODY_CNT_MIN 0 // body +#define STB_BODY_CNT_MAX 35 +#define STB_BODY_XY_MIN 0 +#define STB_BODY_XY_MAX 8191 +#define STB_BODY_SIZE_MIN 20 +#define STB_BODY_SIZE_MAX 8192 +#define STB_BODY_CONF_MIN 0 +#define STB_BODY_CONF_MAX 1000 +#define STB_FACE_CNT_MIN 0 // face +#define STB_FACE_CNT_MAX 35 +#define STB_FACE_XY_MIN 0 +#define STB_FACE_XY_MAX 8191 +#define STB_FACE_SIZE_MIN 20 +#define STB_FACE_SIZE_MAX 8192 +#define STB_FACE_CONF_MIN 0 +#define STB_FACE_CONF_MAX 1000 +#define STB_FACE_DIR_LR_MIN -180 +#define STB_FACE_DIR_LR_MAX 179 +#define STB_FACE_DIR_UD_MIN -180 +#define STB_FACE_DIR_UD_MAX 179 +#define STB_FACE_DIR_ROLL_MIN -180 +#define STB_FACE_DIR_ROLL_MAX 179 +#define STB_FACE_DIR_CONF_MIN 0 +#define STB_FACE_DIR_CONF_MAX 1000 +#define STB_FACE_AGE_VAL_MIN 0 +#define STB_FACE_AGE_VAL_MAX 75 +#define STB_FACE_AGE_CONF_MIN 0 +#define STB_FACE_AGE_CONF_MAX 1000 +#define STB_FACE_GEN_VAL_MIN 0 +#define STB_FACE_GEN_VAL_MAX 1 +#define STB_FACE_GEN_CONF_MIN 0 +#define STB_FACE_GEN_CONF_MAX 1000 +#define STB_FACE_GAZE_LR_MIN -90 +#define STB_FACE_GAZE_LR_MAX 90 +#define STB_FACE_GAZE_UD_MIN -90 +#define STB_FACE_GAZE_UD_MAX 90 +#define STB_FACE_BLI_L_MIN 1 +#define STB_FACE_BLI_L_MAX 1000 +#define STB_FACE_BLI_R_MIN 1 +#define STB_FACE_BLI_R_MAX 1000 +#define STB_FACE_EXP_SCORE_MIN 0 +#define STB_FACE_EXP_SCORE_MAX 100 /* not 1000 */ +#define STB_FACE_EXP_DEG_MIN -100 +#define STB_FACE_EXP_DEG_MAX 100 +#define STB_FACE_FR_UID_MIN 0 +#define STB_FACE_FR_UID_MAX 499 +#define STB_FACE_FR_SCORE_MIN 0 +#define STB_FACE_FR_SCORE_MAX 1000 + +/*-------------------------------------------------------------------*/ +/*Permitted input value*/ +/*-------------------------------------------------------------------*/ +#define STB_ERR_PE_CANNOT -128 /*Estimation is not possible.*/ +#define STB_ERR_FR_CANNOT -128 /*Recognition impossible*/ +#define STB_ERR_FR_NOID -1 /*No corresponding ID*/ +#define STB_ERR_FR_NOALBUM -127 /*Not-registered in Album*/ + + +/*-------------------------------------------------------------------*/ +/* Func */ +/*-------------------------------------------------------------------*/ +STB_INT32 STB_TrIsValidValue(const STB_TR_DET *input, STBExecFlg *execFlg); + +#endif /* COMMONDEF_H__ */ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HVC/STBLib/src/STB_Tracker/SdkSTBTr.c Tue Sep 05 10:01:51 2017 +0000
@@ -0,0 +1,68 @@
+/*---------------------------------------------------------------------------*/
+/* Copyright(C) 2017 OMRON Corporation */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
+/* See the License for the specific language governing permissions and */
+/* limitations under the License. */
+/*---------------------------------------------------------------------------*/
+
+#include "SdkSTBTr.h"
+#include "TrInterface.h"
+
+/*This layer only defines the API function */
+
+/*Create/Delete handle*/
+STB_TR_HANDLE STB_Tr_CreateHandle( const STBExecFlg* execFlg ,const STB_INT32 nDetCntMax, const STB_INT32 nTraCntMax){
+ return (STB_TR_HANDLE)TrCreateHandle( execFlg , nDetCntMax, nTraCntMax );
+}
+
+STB_INT32 STB_Tr_DeleteHandle(STB_TR_HANDLE handle){
+ return TrDeleteHandle((TRHANDLE)handle);
+}
+
+/*set frame information*/
+STB_INT32 STB_Tr_SetDetect(STB_TR_HANDLE handle,const STB_TR_DET *stbTrDet){
+ return TrSetDetect((TRHANDLE)handle,stbTrDet);
+}
+
+/*Main process execution*/
+STB_INT32 STB_Tr_Execute(STB_TR_HANDLE handle){
+ return TrExecute((TRHANDLE)handle);
+}
+
+/*get the result*/
+STB_INT32 STB_Tr_GetResult(STB_TR_HANDLE handle,STB_TR_RES_FACES* fcResult,STB_TR_RES_BODYS* bdResult){
+ return TrGetResult((TRHANDLE)handle,fcResult,bdResult);
+}
+
+/*Clear*/
+STB_INT32 STB_Tr_Clear( STB_TR_HANDLE handle ){
+ return TrClear((TRHANDLE)handle);
+}
+
+/*RetryCount*/
+STB_INT32 STB_Tr_SetRetryCount(STB_TR_HANDLE handle , STB_INT32 nRetryCount){
+ return TrSetRetryCount((TRHANDLE)handle,nRetryCount);
+}
+STB_INT32 STB_Tr_GetRetryCount ( STB_TR_HANDLE handle , STB_INT32* nRetryCount )
+{
+ return TrGetRetryCount((TRHANDLE)handle,nRetryCount);
+}
+/* Stediness */
+STB_INT32 STB_Tr_SetStedinessParam ( STB_TR_HANDLE handle , STB_INT32 nStedinessPos , STB_INT32 nStedinessSize )
+{
+ return TrSetStedinessParam ((TRHANDLE)handle,nStedinessPos,nStedinessSize);
+}
+STB_INT32 STB_Tr_GetStedinessParam ( STB_TR_HANDLE handle , STB_INT32* nStedinessPos , STB_INT32* nStedinessSize )
+{
+ return TrGetStedinessParam((TRHANDLE)handle,nStedinessPos,nStedinessSize);
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HVC/STBLib/src/STB_Tracker/SdkSTBTr.h Tue Sep 05 10:01:51 2017 +0000 @@ -0,0 +1,41 @@ +/*---------------------------------------------------------------------------*/ +/* Copyright(C) 2017 OMRON Corporation */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ +/* See the License for the specific language governing permissions and */ +/* limitations under the License. */ +/*---------------------------------------------------------------------------*/ + +#if !defined( _SDK_STBTR_H_ ) +#define _SDK_STBTR_H_ + +#include "STBTrTypedef.h" + +#if !defined( STB_DEF_TR_HANDLE ) + #define STB_DEF_TR_HANDLE + typedef VOID* STB_TR_HANDLE; +#endif + +STB_TR_HANDLE STB_Tr_CreateHandle ( const STBExecFlg* execFlg ,const STB_INT32 nDetCntMax, const STB_INT32 nTraCntMax);/*Create/Delete handle*/ + +STB_INT32 STB_Tr_DeleteHandle ( STB_TR_HANDLE handle );/*Create/Delete handle*/ +STB_INT32 STB_Tr_SetDetect ( STB_TR_HANDLE handle,const STB_TR_DET *stbTrDet );/*Frame information settings*/ +STB_INT32 STB_Tr_Execute ( STB_TR_HANDLE handle );/*Main process execution*/ +STB_INT32 STB_Tr_GetResult ( STB_TR_HANDLE handle,STB_TR_RES_FACES* fcResult,STB_TR_RES_BODYS* bdResult);/*get the result*/ +STB_INT32 STB_Tr_Clear ( STB_TR_HANDLE handle); + +/*parameter*/ +STB_INT32 STB_Tr_SetRetryCount ( STB_TR_HANDLE handle , STB_INT32 nRetryCount );/*RetryCount*/ +STB_INT32 STB_Tr_GetRetryCount ( STB_TR_HANDLE handle , STB_INT32* nRetryCount ); +STB_INT32 STB_Tr_SetStedinessParam ( STB_TR_HANDLE handle , STB_INT32 nStedinessPos , STB_INT32 nStedinessSize );/* Stediness */ +STB_INT32 STB_Tr_GetStedinessParam ( STB_TR_HANDLE handle , STB_INT32* nStedinessPos , STB_INT32* nStedinessSize ); + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HVC/STBLib/src/STB_Tracker/TrInterface.c Tue Sep 05 10:01:51 2017 +0000
@@ -0,0 +1,603 @@
+/*---------------------------------------------------------------------------*/
+/* Copyright(C) 2017 OMRON Corporation */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
+/* See the License for the specific language governing permissions and */
+/* limitations under the License. */
+/*---------------------------------------------------------------------------*/
+
+#include "TrInterface.h"
+#include "STBTrAPI.h"
+/*Value range check*/
+#define ISVALID_RANGE( val , min , max ) ( ( (min) <= (val) ) && ( (val) <= (max) ) )
+
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+/*error check*/
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+static STB_INT32 TrIsValidValue(
+ const STB_INT32 nValue ,
+ const STB_INT32 nLimitMin ,
+ const STB_INT32 nLimitMax )
+{
+ STB_INT32 nRet;
+ for( nRet = STB_ERR_INVALIDPARAM; nRet != STB_NORMAL; nRet = STB_NORMAL ){
+ if( ! ISVALID_RANGE( nValue , nLimitMin , nLimitMax ) ){ break; }
+ }
+ return nRet;
+}
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+static STB_INT32 TrIsValidPointer( const VOID* pPointer )
+{
+ STB_INT32 nRet;
+ for( nRet = STB_ERR_INVALIDPARAM; nRet != STB_NORMAL; nRet = STB_NORMAL ){
+ if( NULL == pPointer ){ break; }
+ }
+ return nRet;
+}
+
+/*------------------------------------------------------------------------------------------------------------------*/
+/* TrCalcTrSize */
+/*------------------------------------------------------------------------------------------------------------------*/
+STB_UINT32 TrCalcTrSize ( const STBExecFlg *execFlg , STB_UINT32 nTraCntMax , STB_UINT32 nDetCntMax )
+{
+ STB_UINT32 retVal ;
+
+ retVal = 0 ;
+
+ retVal += 100 ;///Margin : alignment
+
+
+ retVal += sizeof( STB_TR_DET ); // stbTrDet
+
+ if( execFlg->bodyTr == STB_TRUE )
+ {
+ retVal += sizeof( ROI_SYS ) * STB_TR_BACK_MAX ;// bdRec
+ retVal += sizeof( STB_INT32 ) * STB_TR_BACK_MAX * nTraCntMax ;// bdRec[t].nDetID
+ retVal += sizeof( STB_INT32 ) * STB_TR_BACK_MAX * nTraCntMax ;// bdRec[t].nTraID
+ retVal += sizeof( STB_INT32 ) * STB_TR_BACK_MAX * nTraCntMax ;// bdRec[t].posX
+ retVal += sizeof( STB_INT32 ) * STB_TR_BACK_MAX * nTraCntMax ;// bdRec[t].posY
+ retVal += sizeof( STB_INT32 ) * STB_TR_BACK_MAX * nTraCntMax ;// bdRec[t].size
+ retVal += sizeof( STB_INT32 ) * STB_TR_BACK_MAX * nTraCntMax ;// bdRec[t].conf
+ retVal += sizeof( STB_INT32 ) * STB_TR_BACK_MAX * nTraCntMax ;// bdRec[t].retryN
+ retVal += sizeof( ROI_DET ) * nDetCntMax ;// stbTrDet->bdDet
+ retVal += sizeof( STB_TR_RES_BODYS) ;// resBodys
+ retVal += sizeof( STB_TR_RES ) * nTraCntMax ;// resBodys->body
+ }
+ if( execFlg->faceTr == STB_TRUE )
+ {
+ retVal += sizeof( ROI_SYS ) * STB_TR_BACK_MAX ;// fcRec
+ retVal += sizeof( STB_INT32 ) * STB_TR_BACK_MAX * nTraCntMax ;// fcRec[t].nDetID
+ retVal += sizeof( STB_INT32 ) * STB_TR_BACK_MAX * nTraCntMax ;// fcRec[t].nTraID
+ retVal += sizeof( STB_INT32 ) * STB_TR_BACK_MAX * nTraCntMax ;// fcRec[t].posX
+ retVal += sizeof( STB_INT32 ) * STB_TR_BACK_MAX * nTraCntMax ;// fcRec[t].posY
+ retVal += sizeof( STB_INT32 ) * STB_TR_BACK_MAX * nTraCntMax ;// fcRec[t].size
+ retVal += sizeof( STB_INT32 ) * STB_TR_BACK_MAX * nTraCntMax ;// fcRec[t].conf
+ retVal += sizeof( STB_INT32 ) * STB_TR_BACK_MAX * nTraCntMax ;// fcRec[t].retryN
+ retVal += sizeof( ROI_DET ) * nDetCntMax ;// stbTrDet->fcDet
+ retVal += sizeof( STB_TR_RES_FACES) ;// resFaces
+ retVal += sizeof( STB_TR_RES ) * nTraCntMax ;// resFaces->face
+ }
+
+ retVal += sizeof( STB_INT32 ) * nTraCntMax ; // wIdPreCur
+ retVal += sizeof( STB_INT32 ) * nTraCntMax ; // wIdCurPre
+ retVal += sizeof( STB_INT32 ) * nTraCntMax * nTraCntMax ; // wDstTbl
+ retVal += sizeof( STBExecFlg ) ; // execFlg
+
+ retVal += ( sizeof( ROI_SYS ) );//wRoi
+ retVal += ( sizeof( STB_INT32 ) * nTraCntMax );//wRoi->nDetID
+ retVal += ( sizeof( STB_INT32 ) * nTraCntMax );//wRoi->nTraID
+ retVal += ( sizeof( STB_INT32 ) * nTraCntMax );//wRoi->posX
+ retVal += ( sizeof( STB_INT32 ) * nTraCntMax );//wRoi->posY
+ retVal += ( sizeof( STB_INT32 ) * nTraCntMax );//wRoi->size
+ retVal += ( sizeof( STB_INT32 ) * nTraCntMax );//wRoi->conf
+ retVal += ( sizeof( STB_INT32 ) * nTraCntMax );//wRoi->retryN
+
+ return retVal;
+}
+/*------------------------------------------------------------------------------------------------------------------*/
+/* ShareTrSize */
+/*------------------------------------------------------------------------------------------------------------------*/
+void ShareTrSize ( TRHANDLE handle , const STBExecFlg* execFlg )
+{
+ STB_UINT32 t ;
+ STB_UINT32 nTraCntMax = handle->traCntMax ;
+ STB_UINT32 nDetCntMax = handle->detCntMax ;
+ STB_INT8 *stbPtr = handle->trPtr ;
+
+
+
+ handle->stbTrDet = ( STB_TR_DET*) stbPtr; stbPtr += ( sizeof( STB_TR_DET ) );
+
+ if( execFlg->bodyTr == STB_TRUE )
+ {
+ handle->bdRec = ( ROI_SYS* ) stbPtr; stbPtr += ( sizeof( ROI_SYS ) * STB_TR_BACK_MAX);
+ for( t = 0 ; t < STB_TR_BACK_MAX ; t++ )
+ {
+ handle->bdRec[t].nDetID = ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax );
+ handle->bdRec[t].nTraID = ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax );
+ handle->bdRec[t].posX = ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax );
+ handle->bdRec[t].posY = ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax );
+ handle->bdRec[t].size = ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax );
+ handle->bdRec[t].conf = ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax );
+ handle->bdRec[t].retryN = ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax );
+ }
+ handle->stbTrDet->bdDet = ( ROI_DET* ) stbPtr; stbPtr += ( sizeof( ROI_DET ) * nDetCntMax );
+ handle->resBodys = ( STB_TR_RES_BODYS* ) stbPtr; stbPtr += ( sizeof( STB_TR_RES_BODYS ) );
+ handle->resBodys->body = ( STB_TR_RES*) stbPtr; stbPtr += ( sizeof( STB_TR_RES ) * nTraCntMax );
+ }
+
+
+ if( execFlg->faceTr == STB_TRUE )
+ {
+ handle->fcRec = ( ROI_SYS* ) stbPtr; stbPtr += ( sizeof( ROI_SYS ) * STB_TR_BACK_MAX );
+ for( t = 0 ; t < STB_TR_BACK_MAX ; t++ )
+ {
+ handle->fcRec[t].nDetID = ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax );
+ handle->fcRec[t].nTraID = ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax );
+ handle->fcRec[t].posX = ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax );
+ handle->fcRec[t].posY = ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax );
+ handle->fcRec[t].size = ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax );
+ handle->fcRec[t].conf = ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax );
+ handle->fcRec[t].retryN = ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax );
+ }
+ handle->stbTrDet->fcDet = ( ROI_DET* ) stbPtr; stbPtr += ( sizeof( ROI_DET ) * nDetCntMax );
+
+ handle->resFaces = ( STB_TR_RES_FACES* ) stbPtr; stbPtr += ( sizeof( STB_TR_RES_FACES ) );
+ handle->resFaces->face = ( STB_TR_RES*) stbPtr; stbPtr += ( sizeof( STB_TR_RES ) * nTraCntMax );
+ }
+
+
+ handle->wIdPreCur = ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax );
+ handle->wIdCurPre = ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax );
+ handle->wDstTbl = ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax * nTraCntMax );
+ handle->execFlg = ( STBExecFlg*) stbPtr; stbPtr += sizeof( STBExecFlg );
+
+ handle->wRoi = ( ROI_SYS* ) stbPtr; stbPtr += ( sizeof( ROI_SYS ) );
+ handle->wRoi->nDetID= ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax );
+ handle->wRoi->nTraID= ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax );
+ handle->wRoi->posX = ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax );
+ handle->wRoi->posY = ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax );
+ handle->wRoi->size = ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax );
+ handle->wRoi->conf = ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax );
+ handle->wRoi->retryN= ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax );
+}
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+/*Create handle*/
+TRHANDLE TrCreateHandle( const STBExecFlg* execFlg ,const STB_INT32 nDetCntMax, const STB_INT32 nTraCntMax )
+{
+
+ TRHANDLE handle ;
+ STB_INT32 i ,j ;
+ STB_INT32 tmpVal ;
+ STB_INT32 nRet ;
+
+ nRet = TrIsValidPointer(execFlg);
+ if(nRet != STB_NORMAL)
+ {
+ return NULL;
+ }
+
+ if( nDetCntMax < 1 || STB_TR_DET_CNT_MAX < nDetCntMax )
+ {
+ return NULL;
+ }
+ if( nTraCntMax < 1 || STB_TR_TRA_CNT_MAX < nTraCntMax )
+ {
+ return NULL;
+ }
+
+ /*do handle's Malloc here*/
+ handle = ( TRHANDLE )malloc( sizeof(*handle) );
+ if(handle == NULL)
+ {
+ return NULL;
+ }
+
+ handle->detCntMax = nDetCntMax ;
+ handle->traCntMax = nTraCntMax ;
+ handle->retryCnt = STB_TR_INI_RETRY ;
+ handle->stedPos = STB_TR_INI_STEADINESS_SIZE ;//stabilization parameter(position)
+ handle->stedSize = STB_TR_INI_STEADINESS_POS ;//stabilization parameter(size)
+ handle->fcCntAcc = 0 ;
+ handle->bdCntAcc = 0 ;
+ handle->trPtr = NULL;
+ handle->stbTrDet = NULL;
+ handle->fcRec = NULL;
+ handle->bdRec = NULL;
+ handle->resFaces = NULL;
+ handle->resBodys = NULL;
+ handle->wIdPreCur = NULL;
+ handle->wIdCurPre = NULL;
+ handle->wDstTbl = NULL;
+ handle->execFlg = NULL;
+
+ tmpVal = TrCalcTrSize ( execFlg ,nTraCntMax , nDetCntMax); /*calculate necessary amount in the TR handle*/
+ handle->trPtr = NULL;
+ handle->trPtr = ( STB_INT8 * )malloc( tmpVal ) ; /*keep necessary amount in the TR handle*/
+ if( handle->trPtr == NULL )
+ {
+ free ( handle->trPtr );
+ free ( handle );
+ return NULL;
+ }
+ ShareTrSize ( handle , execFlg ); /*Malloc-area is allocated to things that need Malloc in TR handle*/
+
+ /*set initial value*/
+ if( execFlg->faceTr == STB_TRUE )
+ {
+ for( i = 0 ; i < STB_TR_BACK_MAX ; i++)
+ {
+ handle->fcRec[i].cnt= 0;
+ for( j = 0 ; j < handle->traCntMax ; j++)
+ {
+ handle->fcRec[i].nDetID [j] = -1;
+ handle->fcRec[i].nTraID [j] = -1;
+ handle->fcRec[i].posX [j] = 0;
+ handle->fcRec[i].posY [j] = 0;
+ handle->fcRec[i].size [j] = -1;
+ handle->fcRec[i].retryN [j] = -1;
+ handle->fcRec[i].conf [j] = -1;
+ }
+ }
+ }
+ if( execFlg->bodyTr == STB_TRUE )
+ {
+ for( i = 0 ; i < STB_TR_BACK_MAX ; i++)
+ {
+ handle->bdRec[i].cnt= 0;
+ for( j = 0 ; j < handle->traCntMax ; j++)
+ {
+ handle->bdRec[i].nDetID [j] = -1;
+ handle->bdRec[i].nTraID [j] = -1;
+ handle->bdRec[i].posX [j] = 0;
+ handle->bdRec[i].posY [j] = 0;
+ handle->bdRec[i].size [j] = -1;
+ handle->bdRec[i].retryN [j] = -1;
+ handle->bdRec[i].conf [j] = -1;
+ }
+ }
+ }
+
+
+
+ handle->execFlg->pet = execFlg->pet ;
+ handle->execFlg->hand = execFlg->hand ;
+ handle->execFlg->bodyTr = execFlg->bodyTr ;
+ handle->execFlg->faceTr = execFlg->faceTr ;
+ handle->execFlg->gen = execFlg->gen ;
+ handle->execFlg->age = execFlg->age ;
+ handle->execFlg->fr = execFlg->fr ;
+ handle->execFlg->exp = execFlg->exp ;
+ handle->execFlg->gaz = execFlg->gaz ;
+ handle->execFlg->dir = execFlg->dir ;
+ handle->execFlg->bli = execFlg->bli ;
+
+
+ return handle;
+}
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+
+/*Delete handle*/
+STB_INT32 TrDeleteHandle(TRHANDLE handle)
+{
+ STB_INT32 nRet;
+
+ /*NULL check*/
+ nRet = TrIsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+
+ free ( handle->trPtr );
+ free ( handle );
+
+ return STB_NORMAL;
+}
+
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+/*Set the result*/
+STB_INT32 TrSetDetect(TRHANDLE handle,const STB_TR_DET *stbTrDet){
+ STB_INT32 nRet;
+ STB_INT32 i;
+
+ /*NULL check*/
+ nRet = TrIsValidPointer(handle);
+ if(nRet != STB_NORMAL)
+ {
+ return STB_ERR_NOHANDLE;
+ }
+
+ nRet = TrIsValidPointer(stbTrDet);
+ if(nRet != STB_NORMAL)
+ {
+ return nRet;
+ }
+
+ /*Input value check*/
+ nRet = STB_TrIsValidValue ( stbTrDet ,handle->execFlg );
+ if(nRet != STB_TRUE)
+ {
+ return STB_ERR_INVALIDPARAM;
+ }
+
+ /*Set the received result to the handle (stbTrDet)*/
+ /* Face */
+ if( handle->execFlg->faceTr == STB_TRUE )
+ {
+ handle->stbTrDet->fcNum = stbTrDet->fcNum;
+ for( i = 0 ; i < handle->stbTrDet->fcNum ; i++ )
+ {
+ handle->stbTrDet->fcDet[i].posX = stbTrDet->fcDet[i].posX;
+ handle->stbTrDet->fcDet[i].posY = stbTrDet->fcDet[i].posY;
+ handle->stbTrDet->fcDet[i].size = stbTrDet->fcDet[i].size;
+ handle->stbTrDet->fcDet[i].conf = stbTrDet->fcDet[i].conf;
+ }
+ }else
+ {
+ handle->stbTrDet->fcNum = 0;
+ }
+
+ /* Body */
+ if( handle->execFlg->bodyTr == STB_TRUE )
+ {
+ handle->stbTrDet->bdNum = stbTrDet->bdNum;
+ for( i = 0 ; i < handle->stbTrDet->bdNum ; i++ )
+ {
+ handle->stbTrDet->bdDet[i].posX = stbTrDet->bdDet[i].posX;
+ handle->stbTrDet->bdDet[i].posY = stbTrDet->bdDet[i].posY;
+ handle->stbTrDet->bdDet[i].size = stbTrDet->bdDet[i].size;
+ handle->stbTrDet->bdDet[i].conf = stbTrDet->bdDet[i].conf;
+ }
+ }else
+ {
+ handle->stbTrDet->bdNum = 0;
+ }
+
+
+
+ return STB_NORMAL;
+}
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+/*Main process execution*/
+STB_INT32 TrExecute(TRHANDLE handle){
+
+ STB_INT32 nRet;
+ /*NULL check*/
+ nRet = TrIsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+
+ /*Main processing here*/
+ nRet = StbTrExec ( handle );
+
+
+ return STB_NORMAL;
+}
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+/*Get-Function of results*/
+STB_INT32 TrGetResult(TRHANDLE handle,STB_TR_RES_FACES* fcResult,STB_TR_RES_BODYS* bdResult){
+
+ STB_INT32 nRet;
+ STB_INT32 i;
+
+ /*NULL check*/
+ nRet = TrIsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+
+ if( handle->execFlg->faceTr == STB_TRUE )
+ {
+ nRet = TrIsValidPointer(fcResult);
+ if(nRet != STB_NORMAL){
+ return nRet;
+ }
+ }
+ if( handle->execFlg->bodyTr == STB_TRUE )
+ {
+ nRet = TrIsValidPointer(bdResult);
+ if(nRet != STB_NORMAL){
+ return nRet;
+ }
+ }
+
+ /*Get result from handle*/
+
+ /* Face */
+ if( handle->execFlg->faceTr == STB_TRUE )
+ {
+ fcResult->cnt = handle->resFaces->cnt ;
+ for( i = 0 ; i < handle->resFaces->cnt ; i++ )
+ {
+ fcResult->face[i].nDetID = handle->resFaces->face[i].nDetID ;
+ fcResult->face[i].nTraID = handle->resFaces->face[i].nTraID ;
+ fcResult->face[i].pos.x = handle->resFaces->face[i].pos.x ;
+ fcResult->face[i].pos.y = handle->resFaces->face[i].pos.y ;
+ fcResult->face[i].size = handle->resFaces->face[i].size ;
+ fcResult->face[i].conf = handle->resFaces->face[i].conf ;
+ }
+ for( i = handle->resFaces->cnt ; i < handle->traCntMax ; i++ )
+ {
+ fcResult->face[i].nDetID = -1 ;
+ fcResult->face[i].nTraID = -1 ;
+ fcResult->face[i].pos.x = 0 ;
+ fcResult->face[i].pos.y = 0 ;
+ fcResult->face[i].size = -1 ;
+ fcResult->face[i].conf = STB_CONF_NO_DATA ;
+ }
+ }
+
+ /* Body */
+ if( handle->execFlg->bodyTr == STB_TRUE )
+ {
+ bdResult->cnt = handle->resBodys->cnt ;
+ for( i = 0 ; i < handle->resBodys->cnt ; i++ )
+ {
+ bdResult->body[i].nDetID = handle->resBodys->body[i].nDetID ;
+ bdResult->body[i].nTraID = handle->resBodys->body[i].nTraID ;
+ bdResult->body[i].pos.x = handle->resBodys->body[i].pos.x ;
+ bdResult->body[i].pos.y = handle->resBodys->body[i].pos.y ;
+ bdResult->body[i].size = handle->resBodys->body[i].size ;
+ bdResult->body[i].conf = handle->resBodys->body[i].conf ;
+ }
+ for( i = handle->resBodys->cnt ; i < handle->traCntMax ; i++ )
+ {
+ bdResult->body[i].nDetID = -1 ;
+ bdResult->body[i].nTraID = -1 ;
+ bdResult->body[i].pos.x = 0 ;
+ bdResult->body[i].pos.y = 0 ;
+ bdResult->body[i].size = -1 ;
+ bdResult->body[i].conf = STB_CONF_NO_DATA ;
+ }
+ }
+
+ return STB_NORMAL;
+}
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+/*Clear*/
+STB_INT32 TrClear(TRHANDLE handle){
+
+ STB_INT32 nRet;
+ STB_INT32 i , j;
+
+
+ /*NULL check*/
+ nRet = TrIsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+
+
+ if( handle->execFlg->faceTr == STB_TRUE )
+ {
+ for( i = 0 ; i < STB_TR_BACK_MAX ; i++)
+ {
+ handle->fcRec[i].cnt= 0;
+ for( j = 0 ; j < handle->traCntMax ; j++)
+ {
+ handle->fcRec[i].nDetID [j] = -1;
+ handle->fcRec[i].nTraID [j] = -1;
+ handle->fcRec[i].posX [j] = 0 ;
+ handle->fcRec[i].posY [j] = 0 ;
+ handle->fcRec[i].size [j] = -1;
+ handle->fcRec[i].retryN [j] = -1;
+ handle->fcRec[i].conf [j] = -1;
+ }
+ }
+ handle->fcCntAcc = 0;
+ }
+
+ if( handle->execFlg->bodyTr == STB_TRUE )
+ {
+ for( i = 0 ; i < STB_TR_BACK_MAX ; i++)
+ {
+ handle->bdRec[i].cnt= 0;
+ for( j = 0 ; j < handle->traCntMax ; j++)
+ {
+ handle->bdRec[i].nDetID [j] = -1;
+ handle->bdRec[i].nTraID [j] = -1;
+ handle->bdRec[i].posX [j] = 0 ;
+ handle->bdRec[i].posY [j] = 0 ;
+ handle->bdRec[i].size [j] = -1;
+ handle->bdRec[i].retryN [j] = -1;
+ handle->bdRec[i].conf [j] = -1;
+ }
+ }
+ handle->bdCntAcc = 0;
+ }
+
+ return STB_NORMAL;
+}
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+/* */
+STB_INT32 TrSetRetryCount(TRHANDLE handle, STB_INT32 nRetryCount)
+{
+ STB_INT32 nRet;
+ nRet = TrIsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+
+ if( nRetryCount < STB_TR_MIN_RETRY || STB_TR_MAX_RETRY < nRetryCount)
+ {
+ return STB_ERR_INVALIDPARAM;
+ }
+
+ handle->retryCnt = nRetryCount;
+ return STB_NORMAL;
+}
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+STB_INT32 TrGetRetryCount ( TRHANDLE handle , STB_INT32* nRetryCount )
+{
+ STB_INT32 nRet;
+ nRet = TrIsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+ nRet = TrIsValidPointer(nRetryCount);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_INVALIDPARAM;
+ }
+
+ *nRetryCount = handle->retryCnt ;
+ return STB_NORMAL;
+}
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+STB_INT32 TrSetStedinessParam ( TRHANDLE handle , STB_INT32 nStedinessPos , STB_INT32 nStedinessSize )
+{
+ if( nStedinessPos < STB_TR_MIN_STEADINESS_POS || STB_TR_MAX_STEADINESS_POS < nStedinessPos)
+ {
+ return STB_ERR_INVALIDPARAM;
+ }
+ if( nStedinessSize < STB_TR_MIN_STEADINESS_SIZE || STB_TR_MAX_STEADINESS_SIZE < nStedinessSize)
+ {
+ return STB_ERR_INVALIDPARAM;
+ }
+ handle->stedPos = nStedinessPos;
+ handle->stedSize = nStedinessSize;
+ return STB_NORMAL;
+}
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
+STB_INT32 TrGetStedinessParam ( TRHANDLE handle , STB_INT32* nStedinessPos , STB_INT32* nStedinessSize )
+{
+ STB_INT32 nRet;
+ nRet = TrIsValidPointer(handle);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_NOHANDLE;
+ }
+ nRet = TrIsValidPointer(nStedinessPos);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_INVALIDPARAM;
+ }
+ nRet = TrIsValidPointer(nStedinessSize);
+ if(nRet != STB_NORMAL){
+ return STB_ERR_INVALIDPARAM;
+ }
+ *nStedinessPos = handle->stedPos ;
+ *nStedinessSize = handle->stedSize ;
+ return STB_NORMAL;
+}
+/*---------------------------------------------------------------------
+---------------------------------------------------------------------*/
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HVC/STBLib/src/STB_Tracker/TrInterface.h Tue Sep 05 10:01:51 2017 +0000
@@ -0,0 +1,128 @@
+/*---------------------------------------------------------------------------*/
+/* Copyright(C) 2017 OMRON Corporation */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
+/* See the License for the specific language governing permissions and */
+/* limitations under the License. */
+/*---------------------------------------------------------------------------*/
+
+#if !defined( _INTERFACE_H_ )
+#define _INTERFACE_H_
+#include "STBTrTypedef.h"
+#include "STBCommonDef.h"
+#include "STBCommonType.h"
+#include "STBTrValidValue.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+//////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////
+/////////// Define //////////////
+//////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////
+
+/* refer to past "STB_BACK_MAX-1" frames of results */
+#define STB_TR_BACK_MAX 2
+
+#define STB_TR_DET_CNT_MAX 35
+#define STB_TR_TRA_CNT_MAX 35
+
+//If the face isn't find out during tracking, set until how many frames can look for it.
+//In the case of tracking failed with a specified number of frames consecutively, end of tracking as the face lost.
+#define STB_TR_INI_RETRY 2
+#define STB_TR_MIN_RETRY 0
+#define STB_TR_MAX_RETRY 300
+
+//Specifies settings %
+//For example, about the percentage of detected position change, setting the value to 30(<- initialize value)
+//in the case of position change under 30 percentage from the previous frame, output detected position of the previous frame
+//When it exceeds 30%, the detection position coordinate is output as it is.
+#define STB_TR_INI_STEADINESS_POS 30
+#define STB_TR_MIN_STEADINESS_POS 0
+#define STB_TR_MAX_STEADINESS_POS 100
+
+//Specifies settings %
+//In the case of the percentage of detection size change setting to 30(<- initialize value)
+//in the case of size change under 30 percentage from the previous frame, output detected size of the previous frame
+//When it exceeds 30%, the detection size is output as it is.
+#define STB_TR_INI_STEADINESS_SIZE 30
+#define STB_TR_MIN_STEADINESS_SIZE 0
+#define STB_TR_MAX_STEADINESS_SIZE 100
+
+
+//////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////
+/////////// Struct //////////////
+//////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////
+
+
+typedef struct{
+ STB_INT32 cnt ;
+ STB_INT32 *nDetID ; /*previous detected result ID*/
+ STB_INT32 *nTraID ; /*Tracking ID*/
+ STB_INT32 *posX ; /* Center x-coordinate */
+ STB_INT32 *posY ; /* Center y-coordinate */
+ STB_INT32 *size ; /* Size */
+ STB_INT32 *conf ; /* Degree of confidence */
+ STB_INT32 *retryN ; /*Continuous retry count*/
+}ROI_SYS;
+
+
+/*---------------------------------------------------------------------------*/
+typedef struct tagPEHANDLE {
+ STB_INT8 *trPtr ;
+ STB_INT32 detCntMax ;//Maximum of detected people
+ STB_INT32 traCntMax ;//Maximum number of tracking people
+ STB_INT32 retryCnt ;//Retry count
+ STB_INT32 stedPos ;//stabilization parameter(position)
+ STB_INT32 stedSize ;//stabilization parameter(size)
+ STB_INT32 fcCntAcc ;//Number of faces (cumulative)
+ STB_INT32 bdCntAcc ;//a number of human bodies(cumulative)
+ STB_TR_DET *stbTrDet ;//Present data before the stabilization(input).
+ ROI_SYS *fcRec ;//past data
+ ROI_SYS *bdRec ;//past data
+ STB_TR_RES_FACES *resFaces ;//present data after the stabilization(output)
+ STB_TR_RES_BODYS *resBodys ;//present data after the stabilization(output)
+ STB_INT32 *wIdPreCur ;
+ STB_INT32 *wIdCurPre ;
+ STB_INT32 *wDstTbl ;
+ STBExecFlg *execFlg ;
+ ROI_SYS *wRoi ;
+} *TRHANDLE;
+
+//////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////
+/////////// Func //////////////
+//////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////
+
+TRHANDLE TrCreateHandle ( const STBExecFlg* execFlg ,const STB_INT32 nDetCntMax, const STB_INT32 nTraCntMax );
+STB_INT32 TrDeleteHandle ( TRHANDLE handle);
+STB_INT32 TrSetDetect ( TRHANDLE handle , const STB_TR_DET *stbTrDet);
+STB_INT32 TrExecute ( TRHANDLE handle);
+STB_INT32 TrClear ( TRHANDLE handle);
+STB_INT32 TrGetResult ( TRHANDLE handle , STB_TR_RES_FACES* fcResult,STB_TR_RES_BODYS* bdResult);
+STB_INT32 TrSetRetryCount ( TRHANDLE handle , STB_INT32 nRetryCount );
+STB_INT32 TrGetRetryCount ( TRHANDLE handle , STB_INT32* nRetryCount );
+STB_INT32 TrSetStedinessParam ( TRHANDLE handle , STB_INT32 nStedinessPos , STB_INT32 nStedinessSize );
+STB_INT32 TrGetStedinessParam ( TRHANDLE handle , STB_INT32* nStedinessPos , STB_INT32* nStedinessSize );
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HVC/STBLib/src/include/STBCommonDef.h Tue Sep 05 10:01:51 2017 +0000 @@ -0,0 +1,52 @@ +/*---------------------------------------------------------------------------*/ +/* Copyright(C) 2017 OMRON Corporation */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ +/* See the License for the specific language governing permissions and */ +/* limitations under the License. */ +/*---------------------------------------------------------------------------*/ + +#ifndef COMMONDEF_H__ +#define COMMONDEF_H__ +#include <stdlib.h> + +/* Executed flag */ +#define STB_FUNC_BD (0x00000001U) /* [LSB]bit0: Body Tracking 00000000001 */ +#define STB_FUNC_DT (0x00000004U) /* [LSB]bit2: Face Tracking 00000000100 */ +#define STB_FUNC_PT (0x00000008U) /* [LSB]bit3: Face Direction 00000001000 */ +#define STB_FUNC_AG (0x00000010U) /* [LSB]bit4: Age Estimation 00000010000 */ +#define STB_FUNC_GN (0x00000020U) /* [LSB]bit5: Gender Estimation 00000100000 */ +#define STB_FUNC_GZ (0x00000040U) /* [LSB]bit6: Gaze Estimation 00001000000 */ +#define STB_FUNC_BL (0x00000080U) /* [LSB]bit7: Blink Estimation 00010000000 */ +#define STB_FUNC_EX (0x00000100U) /* [MSB]bit0: Expression Estimation 00100000000 */ +#define STB_FUNC_FR (0x00000200U) /* [MSB]bit1: Face Recognition 01000000000 */ + + + +/*STB library's error code*/ +#define STB_NORMAL (0) /*Successful completion*/ +#define STB_ERR_INITIALIZE (-2) /*Initialization error*/ +#define STB_ERR_INVALIDPARAM (-3) /*argument error*/ +#define STB_ERR_NOHANDLE (-7) /*handle error*/ +#define STB_ERR_PROCESSCONDITION (-8) /*When the processing condition is not satisfied*/ + +#define STB_TRUE (1) +#define STB_FALSE (0) + + + +#if !defined(STB_API) +/*Import(Application Default)*/ + #define STB_API __declspec( dllimport ) +#endif /* OKAO_API || OMCV_API */ + +#endif /* COMMONDEF_H__ */ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HVC/STBLib/src/include/STBCommonType.h Tue Sep 05 10:01:51 2017 +0000
@@ -0,0 +1,41 @@
+/*---------------------------------------------------------------------------*/
+/* Copyright(C) 2017 OMRON Corporation */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
+/* See the License for the specific language governing permissions and */
+/* limitations under the License. */
+/*---------------------------------------------------------------------------*/
+
+#ifndef __STBCOMMONTYPEDEF_H__
+#define __STBCOMMONTYPEDEF_H__
+#include "STBTypedefOutput.h"
+
+
+
+
+typedef struct {
+ STB_INT32 pet ;//Spare : Pet
+ STB_INT32 hand ;//Spare : Hand
+ STB_INT32 bodyTr ;//human body tracking
+ STB_INT32 faceTr ;// Face tracking
+ STB_INT32 gen ;//Gender
+ STB_INT32 age ;//Age
+ STB_INT32 fr ;//Face recognition
+ STB_INT32 exp ;//Facial expression
+ STB_INT32 gaz ;//Gaze
+ STB_INT32 dir ;//Face direction
+ STB_INT32 bli ;//Blink
+}STBExecFlg;
+
+
+
+#endif /*__STBCOMMONTYPEDEF_H__*/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HVC/STBLib/src/include/STBFaceInfo.h Tue Sep 05 10:01:51 2017 +0000 @@ -0,0 +1,29 @@ +/*---------------------------------------------------------------------------*/ +/* Copyright(C) 2017 OMRON Corporation */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ +/* See the License for the specific language governing permissions and */ +/* limitations under the License. */ +/*---------------------------------------------------------------------------*/ + +#ifndef STBFACEINFO_H__ +#define STBFACEINFO_H__ +#include "STBTypedefInput.h" +#include "STBHandle.h" + +VOID SetFaceObject (const STB_FRAME_RESULT_FACES* stbINPUTfaces,FaceObj *faces , const STBExecFlg *execFlg , const STB_INT32 nTraCntMax ); +VOID SetTrackingIDToFace(STB_INT32 TrackingNum,STB_INT32 DetectNum, TraObj *track,FaceObj *faces, const STBExecFlg *execFlg ); +VOID SetFaceToPeInfo (STB_INT32 TrackingNum,FaceObj *faces,STB_PE_DET *peInfo); +VOID SetFaceToFrInfo (STB_INT32 TrackingNum,FaceObj *faces,STB_FR_DET *frInfo); +VOID SetPeInfoToFace (STB_INT32 TrackingNum,STB_PE_RES *peInfo,FaceObj *faces , const STBExecFlg *execFlg ); +VOID SetFrInfoToFace (STB_INT32 TrackingNum,STB_FR_RES *frInfo,FaceObj *faces); + +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HVC/STBLib/src/include/STBFrTypedef.h Tue Sep 05 10:01:51 2017 +0000
@@ -0,0 +1,65 @@
+/*---------------------------------------------------------------------------*/
+/* Copyright(C) 2017 OMRON Corporation */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
+/* See the License for the specific language governing permissions and */
+/* limitations under the License. */
+/*---------------------------------------------------------------------------*/
+
+#ifndef __STBFRTYPEDEF_H__
+#define __STBFRTYPEDEF_H__
+
+#include "STBTypedefOutput.h"
+#include "STBCommonType.h"
+#include "STBCommonDef.h"
+
+
+/*----------------------------------------------------------------------------*/
+/* Face Detection & Estimations results */
+/*----------------------------------------------------------------------------*/
+typedef struct{
+ STB_INT32 nDetID ; /*Person number detected in the current frame*/
+ STB_INT32 nTraID ; /*Tracking person number in the through frame*/
+ STB_INT32 dirDetYaw ;
+ STB_INT32 dirDetPitch ;
+ STB_INT32 dirDetRoll ;
+ STB_INT32 dirDetConf ;
+ STB_INT32 frDetID ;
+ STB_INT32 frDetConf ;
+ STB_STATUS frStatus ;
+}FR_DET;
+
+/*----------------------------------------------------------------------------*/
+/* Eesult data of Execute command */
+/*----------------------------------------------------------------------------*/
+typedef struct{
+ STB_INT32 num ;
+ FR_DET *fcDet ;/* Face Detection & Estimations results */
+}STB_FR_DET;
+
+/*----------------------------------------------------------------------------*/
+/* */
+/*----------------------------------------------------------------------------*/
+typedef struct{
+ STB_INT32 nTraID ;/*Tracking person number in the through frame*/
+ STB_RES frRecog ;/* Stabilization result of human [nTrackingID] */
+}FR_RES;
+
+/*----------------------------------------------------------------------------*/
+/* */
+/*----------------------------------------------------------------------------*/
+typedef struct{
+ STB_INT32 frCnt ;/*a number of tracking people*/
+ FR_RES *frFace ;
+}STB_FR_RES;
+
+
+#endif /*__STBFRTYPEDEF_H__*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HVC/STBLib/src/include/STBHandle.h Tue Sep 05 10:01:51 2017 +0000
@@ -0,0 +1,103 @@
+/*---------------------------------------------------------------------------*/
+/* Copyright(C) 2017 OMRON Corporation */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
+/* See the License for the specific language governing permissions and */
+/* limitations under the License. */
+/*---------------------------------------------------------------------------*/
+
+#ifndef __STBHANDLE_H__
+#define __STBHANDLE_H__
+
+#include "STBTypedefOutput.h"
+#include "STBCommonType.h"
+#include "SdkSTBTr.h"
+#include "SdkSTBPe.h"
+#include "SdkSTBFr.h"
+
+
+
+
+typedef struct {
+
+ STB_INT32 nDetID ;
+ STB_INT32 nTraID ;
+ STB_STATUS genStatus ;//Gender
+ STB_INT32 genConf ;
+ STB_INT32 genVal ;
+ STB_STATUS ageStatus ;//Age
+ STB_INT32 ageConf ;
+ STB_INT32 ageVal ;
+ STB_STATUS frStatus ;//Face recognition
+ STB_INT32 frConf ;
+ STB_INT32 frVal ;
+ STB_STATUS expStatus ;//Facial expression
+ STB_INT32 expVal ;
+ STB_INT32 expScore[STB_EX_MAX] ;
+ STB_INT32 expConf ;
+ STB_INT32 gazUD ;//Gaze
+ STB_INT32 gazLR ;
+ STB_STATUS gazStatus ;
+ STB_INT32 gazConf ;
+ STB_INT32 dirRoll ;//Face direction
+ STB_INT32 dirPitch ;
+ STB_INT32 dirYaw ;
+ STB_STATUS dirStatus ;
+ STB_INT32 dirConf ;
+ STB_INT32 bliL ;//Blink
+ STB_INT32 bliR ;
+ STB_STATUS bliStatus ;
+
+} FaceObj;
+
+typedef struct {
+ STB_INT32 nDetID ;
+ STB_INT32 nTraID ;
+ STB_POS pos ;
+ STB_INT32 size ;
+ STB_INT32 conf ;
+} TraObj;
+
+typedef struct {
+ /*------------------------------*/
+ STB_INT32 nInitialized;/* SetFrameResult already executed */
+ STB_INT32 nExecuted ;/*Execute done*/
+ STBExecFlg *execFlg ;
+ /*------------------------------*/
+ STB_TR_HANDLE hTrHandle ;
+ STB_INT32 nDetCntBody ;
+ STB_INT32 nDetCntFace ;
+ STB_INT32 nTraCntBody ;
+ STB_INT32 nTraCntFace ;
+ TraObj *trFace ;
+ TraObj *trBody ;
+ /*------------------------------*/
+ STB_PE_HANDLE hPeHandle ;
+ STB_FR_HANDLE hFrHandle ;
+ FaceObj *infoFace ;
+ /*------------------------------*/
+ STB_INT8 *stbPtr ;
+ STB_INT32 nDetCntMax ;
+ STB_INT32 nTraCntMax ;
+
+
+ STB_TR_DET *wSrcTr ;/*TR : input data*/
+ STB_TR_RES_FACES *wDstTrFace ;/*TR : output data*/
+ STB_TR_RES_BODYS *wDstTrBody ;/*TR : output data*/
+ STB_PE_DET *wSrcPe ;/*PR : Input data*/
+ STB_PE_RES *wDstPe ;/*PE : Output data*/
+ STB_FR_DET *wSrcFr ;/*FR : Input data*/
+ STB_FR_RES *wDstFr ;/*FR : Output data*/
+} *STBHANDLE;
+
+
+
+#endif /*__STBHANDLE_H__*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HVC/STBLib/src/include/STBMakeResult.h Tue Sep 05 10:01:51 2017 +0000 @@ -0,0 +1,25 @@ +/*---------------------------------------------------------------------------*/ +/* Copyright(C) 2017 OMRON Corporation */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ +/* See the License for the specific language governing permissions and */ +/* limitations under the License. */ +/*---------------------------------------------------------------------------*/ + +#ifndef __STBMAKERESULT_h__ +#define __STBMAKERESULT_H__ + +#include "STBHandle.h" + +VOID SetFaceToResult(STB_INT32 TrackingNum,TraObj* dtfaces,FaceObj* faces, STB_FACE* result , const STBExecFlg* execFlg ); +VOID SetBodyToResult(STB_INT32 TrackingNum,TraObj* dtbodys, STB_BODY* result); + +#endif /*__STBMAKERESULT_H__*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HVC/STBLib/src/include/STBPeTypedef.h Tue Sep 05 10:01:51 2017 +0000
@@ -0,0 +1,79 @@
+/*---------------------------------------------------------------------------*/
+/* Copyright(C) 2017 OMRON Corporation */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
+/* See the License for the specific language governing permissions and */
+/* limitations under the License. */
+/*---------------------------------------------------------------------------*/
+
+#ifndef __STBPETYPEDEF_H__
+#define __STBPETYPEDEF_H__
+
+#include "STBTypedefOutput.h"
+#include "STBCommonType.h"
+#include "STBCommonDef.h"
+
+
+/*----------------------------------------------------------------------------*/
+/* Face Detection & Estimations result (Property estimation input infomation) */
+/*----------------------------------------------------------------------------*/
+typedef struct{
+ STB_INT32 nDetID ; /*Person number detected in the current frame*/
+ STB_INT32 nTraID ; /*Tracking person number in the through frame*/
+ STB_INT32 dirDetYaw ;
+ STB_INT32 dirDetPitch ;
+ STB_INT32 dirDetRoll ;
+ STB_INT32 dirDetConf ;
+ STB_INT32 ageDetVal ;
+ STB_INT32 ageDetConf ;
+ STB_STATUS ageStatus ;
+ STB_INT32 genDetVal ;
+ STB_INT32 genDetConf ;
+ STB_STATUS genStatus ;
+ STB_INT32 gazDetLR ;
+ STB_INT32 gazDetUD ;
+ STB_INT32 bliDetL ;
+ STB_INT32 bliDetR ;
+ STB_INT32 expDetVal[STB_EX_MAX];
+ STB_INT32 expDetConf ;
+}FACE_DET;
+
+
+/*----------------------------------------------------------------------------*/
+/* Result data of Execute command (Property estimation input infomation) */
+/*----------------------------------------------------------------------------*/
+typedef struct{
+ STB_INT32 num ; /*a number of tracking people*/
+ FACE_DET *fcDet ; /* Detection & Estimations result */
+}STB_PE_DET;
+
+/*----------------------------------------------------------------------------*/
+/* Property estimation output infomation */
+/*----------------------------------------------------------------------------*/
+typedef struct {
+ STB_INT32 nTraID ; /*Tracking person number in the through frame*/
+ STB_RES gen ; /* Stabilization result of human [nTrackingID] */
+ STB_RES age ; /* Stabilization result of human [nTrackingID] */
+ STB_RES exp ; /* Stabilization result of human [nTrackingID] */
+ STB_GAZE gaz ; /* Stabilization result of human [nTrackingID] */
+ STB_DIR dir ;
+ STB_BLINK bli ;
+} STB_PE_FACE;
+
+/*----------------------------------------------------------------------------*/
+/* Property estimation output infomation */
+/*----------------------------------------------------------------------------*/
+typedef struct {
+ STB_INT32 peCnt ; /*a number of tracking people*/
+ STB_PE_FACE *peFace ;
+} STB_PE_RES;
+
+#endif /*__STBPETYPEDEF_H__*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HVC/STBLib/src/include/STBTrTypedef.h Tue Sep 05 10:01:51 2017 +0000
@@ -0,0 +1,73 @@
+/*---------------------------------------------------------------------------*/
+/* Copyright(C) 2017 OMRON Corporation */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
+/* See the License for the specific language governing permissions and */
+/* limitations under the License. */
+/*---------------------------------------------------------------------------*/
+
+#ifndef __STBTRTYPEDEF_H__
+#define __STBTRTYPEDEF_H__
+
+#include "STBTypedefOutput.h"
+#include "STBCommonType.h"
+#include "STBCommonDef.h"
+
+/*----------------------------------------------------------------------------*/
+/* Struct */
+/*----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------*/
+/* Detection result (Tracking input infomation) */
+/*----------------------------------------------------------------------------*/
+typedef struct{
+ STB_INT32 posX ; /* Center x-coordinate */
+ STB_INT32 posY ; /* Center y-coordinate */
+ STB_INT32 size ; /* Size */
+ STB_INT32 conf ; /* Degree of confidence */
+}ROI_DET;
+/*----------------------------------------------------------------------------*/
+/* Result data (Tracking input infomation) */
+/*----------------------------------------------------------------------------*/
+typedef struct{
+ STB_INT32 fcNum ; /*a number of detected face*/
+ ROI_DET * fcDet ; /* face rectangle data */
+ STB_INT32 bdNum ; /*a number of body detection*/
+ ROI_DET * bdDet ; /*Body rectangular data*/
+}STB_TR_DET;
+/*----------------------------------------------------------------------------*/
+/* Tracking object result (Tracking output infomation) */
+/*----------------------------------------------------------------------------*/
+typedef struct {
+ STB_INT32 nDetID ; /*previous detected result ID*/
+ STB_INT32 nTraID ; /*Tracking ID*/
+ STB_POS pos ; /* Stabilization of coordinates */
+ STB_INT32 size ; /*Stabilization of face size*/
+ STB_INT32 conf ; /*tracking confidence*/
+} STB_TR_RES;
+/*----------------------------------------------------------------------------*/
+/* Faces tracking result (Tracking output infomation) */
+/*----------------------------------------------------------------------------*/
+typedef struct {
+ STB_INT32 cnt ; /*a number of facial information during tracking*/
+ STB_TR_RES* face ; /*the facial information during tracking */
+} STB_TR_RES_FACES;
+/*----------------------------------------------------------------------------*/
+/* Faces tracking result (Tracking output infomation) */
+/*----------------------------------------------------------------------------*/
+typedef struct {
+ STB_INT32 cnt ; /*a number of human body during tracking*/
+ STB_TR_RES* body ; /*the human body information during tracking*/
+} STB_TR_RES_BODYS;
+
+
+
+#endif /*__STBTRTYPEDEF_H__*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HVC/STBLib/src/include/STBTracking.h Tue Sep 05 10:01:51 2017 +0000 @@ -0,0 +1,31 @@ +/*---------------------------------------------------------------------------*/ +/* Copyright(C) 2017 OMRON Corporation */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ +/* See the License for the specific language governing permissions and */ +/* limitations under the License. */ +/*---------------------------------------------------------------------------*/ + +#ifndef STBTRACKING_H__ +#define STBTRACKING_H__ +#include "STBTypedefInput.h" +#include "STBHandle.h" + +VOID SetTrackingObjectBody ( const STB_FRAME_RESULT_BODYS* stbINPUTbodys,TraObj *bodys); +VOID SetTrackingObjectFace ( const STB_FRAME_RESULT_FACES *stbINPUTfaces,TraObj *faces); + +VOID SetTrackingInfoToFace ( STB_TR_RES_FACES *fdResult,STB_INT32 *pnTrackingNum,TraObj *faces); +VOID SetTrackingInfoToBody ( STB_TR_RES_BODYS *bdResult,STB_INT32 *pnTrackingNum,TraObj *bodys); + +VOID SetSrcTrFace ( STB_INT32 nDetCntFace , TraObj *trFace, STB_TR_DET *trSrcInfo); +VOID SetSrcTrBody ( STB_INT32 nDetCntBody , TraObj *trBody, STB_TR_DET *trSrcInfo); + +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HVC/STBLib/src/include/STBTypedefInput.h Tue Sep 05 10:01:51 2017 +0000
@@ -0,0 +1,131 @@
+/*---------------------------------------------------------------------------*/
+/* Copyright(C) 2017 OMRON Corporation */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
+/* See the License for the specific language governing permissions and */
+/* limitations under the License. */
+/*---------------------------------------------------------------------------*/
+
+#ifndef __STB_OKOA_RESULT_H__
+#define __STB_OKOA_RESULT_H__
+
+#ifndef VOID
+#define VOID void
+#endif
+
+typedef signed char STB_INT8 ; /*8-bit signed integer*/
+typedef unsigned char STB_UINT8 ; /*8-bit unsigned integer*/
+typedef signed short STB_INT16 ; /*16-bit signed integer*/
+typedef unsigned short STB_UINT16 ; /*16-bit unsigned integer*/
+typedef int STB_INT32 ; /*32 bit signed integer*/
+typedef unsigned int STB_UINT32 ; /*32 bit unsigned integer*/
+typedef float STB_FLOAT32 ; /*32-bit floating point number*/
+typedef double STB_FLOAT64 ; /*64-bit floating point number*/
+
+typedef enum {
+ STB_Expression_Neutral,
+ STB_Expression_Happiness,
+ STB_Expression_Surprise,
+ STB_Expression_Anger,
+ STB_Expression_Sadness,
+ STB_Expression_Max
+} STB_OKAO_EXPRESSION;
+
+typedef struct {
+ STB_INT32 nX;
+ STB_INT32 nY;
+} STB_POINT;
+
+/*Face direction estimation*/
+typedef struct {
+ STB_INT32 nLR;
+ STB_INT32 nUD;
+ STB_INT32 nRoll;
+ STB_INT32 nConfidence;
+} STB_FRAME_RESULT_DIRECTION;
+
+/*Age estimation*/
+typedef struct {
+ STB_INT32 nAge;
+ STB_INT32 nConfidence;
+} STB_FRAME_RESULT_AGE;
+
+/*Gender estimation*/
+typedef struct {
+ STB_INT32 nGender;
+ STB_INT32 nConfidence;
+} STB_FRAME_RESULT_GENDER;
+
+/*Gaze estimation*/
+typedef struct {
+ STB_INT32 nLR;
+ STB_INT32 nUD;
+} STB_FRAME_RESULT_GAZE;
+
+/*Blink estimation*/
+typedef struct {
+ STB_INT32 nLeftEye;
+ STB_INT32 nRightEye;
+} STB_FRAME_RESULT_BLINK;
+
+/*estimation of facial expression*/
+typedef struct {
+ STB_INT32 anScore[STB_Expression_Max] ;
+ STB_INT32 nDegree;
+} STB_FRAME_RESULT_EXPRESSION;
+
+/*Face recognition*/
+typedef struct {
+ STB_INT32 nUID;
+ STB_INT32 nScore;
+} STB_FRAME_RESULT_RECOGNITION;
+
+/*One detection result*/
+typedef struct {
+ STB_POINT center;
+ STB_INT32 nSize;
+ STB_INT32 nConfidence ;
+} STB_FRAME_RESULT_DETECTION;
+
+/*Face detection and post-processing result (1 person)*/
+typedef struct {
+ STB_POINT center;
+ STB_INT32 nSize;
+ STB_INT32 nConfidence;
+ STB_FRAME_RESULT_DIRECTION direction;
+ STB_FRAME_RESULT_AGE age;
+ STB_FRAME_RESULT_GENDER gender;
+ STB_FRAME_RESULT_GAZE gaze;
+ STB_FRAME_RESULT_BLINK blink;
+ STB_FRAME_RESULT_EXPRESSION expression;
+ STB_FRAME_RESULT_RECOGNITION recognition;
+} STB_FRAME_RESULT_FACE;
+
+/*One human body detection result*/
+typedef struct {
+ STB_INT32 nCount;
+ STB_FRAME_RESULT_DETECTION body[35];
+} STB_FRAME_RESULT_BODYS;
+
+/*Face detection and post-processing result (1 frame)*/
+typedef struct {
+ STB_INT32 nCount;
+ STB_FRAME_RESULT_FACE face[35];
+} STB_FRAME_RESULT_FACES;
+
+
+/*FRAME result (1 frame)*/
+typedef struct {
+ STB_FRAME_RESULT_BODYS bodys;
+ STB_FRAME_RESULT_FACES faces;
+} STB_FRAME_RESULT;
+
+#endif /*__HVCW_RESULT_H__*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HVC/STBLib/src/include/STBTypedefOutput.h Tue Sep 05 10:01:51 2017 +0000
@@ -0,0 +1,119 @@
+/*---------------------------------------------------------------------------*/
+/* Copyright(C) 2017 OMRON Corporation */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
+/* See the License for the specific language governing permissions and */
+/* limitations under the License. */
+/*---------------------------------------------------------------------------*/
+
+
+#ifndef STBTYPEDEF_H__
+#define STBTYPEDEF_H__
+
+#ifndef VOID
+#define VOID void
+#endif
+
+typedef signed char STB_INT8 ; /*8-bit signed integer*/
+typedef unsigned char STB_UINT8 ; /*8-bit unsigned integer*/
+typedef signed short STB_INT16 ; /*16-bit signed integer*/
+typedef unsigned short STB_UINT16 ; /*16-bit unsigned integer*/
+typedef int STB_INT32 ; /*32 bit signed integer*/
+typedef unsigned int STB_UINT32 ; /*32 bit unsigned integer*/
+typedef float STB_FLOAT32 ; /*32-bit floating point number*/
+typedef double STB_FLOAT64 ; /*64-bit floating point number*/
+
+
+typedef enum {
+ STB_STATUS_NO_DATA = -1, /*No data : No data for the relevant person*/
+ STB_STATUS_CALCULATING = 0, /* during stabilization : a number of data for relevant people aren't enough(a number of frames that relevant people are taken) */
+ STB_STATUS_COMPLETE = 1, /*stabilization done : the frames which done stabilization*/
+ STB_STATUS_FIXED = 2, /*stabilization fixed : already stabilization done, the results is fixed*/
+} STB_STATUS;/*Status of stabilization*/
+
+#define STB_CONF_NO_DATA -1 /*No confidence(No data or in the case of stabilization time)*/
+
+/* Expression */
+typedef enum {
+ STB_EX_UNKNOWN = -1,
+ STB_EX_NEUTRAL = 0,
+ STB_EX_HAPPINESS,
+ STB_EX_SURPRISE,
+ STB_EX_ANGER,
+ STB_EX_SADNESS,
+ STB_EX_MAX
+}STB_EXPRESSION;
+
+/*General purpose stabilization result structure*/
+typedef struct {
+ STB_STATUS status;/* Stabilization status */
+ STB_INT32 conf; /* Stabilization confidence */
+ STB_INT32 value;
+} STB_RES;
+
+/*result of Gaze estimation*/
+typedef struct {
+ STB_STATUS status;/* Stabilization status */
+ STB_INT32 conf; /* Stabilization confidence */
+ STB_INT32 UD;
+ STB_INT32 LR;
+} STB_GAZE;
+
+/*Face direction result*/
+typedef struct {
+ STB_STATUS status;/* Stabilization status */
+ STB_INT32 conf; /* Stabilization confidence */
+ STB_INT32 yaw;
+ STB_INT32 pitch;
+ STB_INT32 roll;
+} STB_DIR;
+
+/*result of Blink estimation*/
+typedef struct {
+ STB_STATUS status;/* Stabilization status */
+ STB_INT32 ratioL;
+ STB_INT32 ratioR;
+} STB_BLINK;
+
+/*Detection position structure*/
+typedef struct {
+ STB_UINT32 x;
+ STB_UINT32 y;
+} STB_POS;
+
+/*Face stabilization result structure*/
+typedef struct {
+ STB_INT32 nDetectID;
+ STB_INT32 nTrackingID;
+ STB_POS center;
+ STB_UINT32 nSize;
+ STB_INT32 conf;
+ STB_DIR direction;
+ STB_RES age;
+ STB_RES gender;
+ STB_GAZE gaze;
+ STB_BLINK blink;
+ STB_RES expression;
+ STB_RES recognition;
+} STB_FACE;
+
+/*Human body result structure*/
+typedef struct {
+ STB_INT32 nDetectID;
+ STB_INT32 nTrackingID;
+ STB_POS center;
+ STB_UINT32 nSize;
+ STB_INT32 conf;
+} STB_BODY;
+
+
+
+#endif /* STBTYPEDEF_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HVC/STBLib/src/include/STB_Debug.h Tue Sep 05 10:01:51 2017 +0000 @@ -0,0 +1,27 @@ +/*---------------------------------------------------------------------------*/ +/* Copyright(C) 2017 OMRON Corporation */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ +/* See the License for the specific language governing permissions and */ +/* limitations under the License. */ +/*---------------------------------------------------------------------------*/ + +#ifndef __STB_DEBUG_H__ +#define __STB_DEBUG_H__ +#ifdef _DEBUG +#include <assert.h> +#define ASSERT(x) assert(x) +#else +#define ASSERT(x) +#endif /* _DEBUG */ + +#endif /*__STB_DEBUG_H__*/ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HVC/STBLib/src/include/SdkSTBFr.h Tue Sep 05 10:01:51 2017 +0000 @@ -0,0 +1,43 @@ +/*---------------------------------------------------------------------------*/ +/* Copyright(C) 2017 OMRON Corporation */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ +/* See the License for the specific language governing permissions and */ +/* limitations under the License. */ +/*---------------------------------------------------------------------------*/ + +#if !defined( _SDK_STBFR_H_ ) +#define _SDK_STBFR_H_ +#include "STBFrTypedef.h" + +#if !defined( STB_DEF_FR_HANDLE ) + #define STB_DEF_FR_HANDLE + typedef VOID* STB_FR_HANDLE; +#endif + +STB_FR_HANDLE STB_Fr_CreateHandle ( const STB_INT32 nTraCntMax );/*Create/Delete handle*/ +STB_INT32 STB_Fr_DeleteHandle ( STB_FR_HANDLE handle );/*Create/Delete handle*/ +STB_INT32 STB_Fr_SetDetect ( STB_FR_HANDLE handle, const STB_FR_DET *stbFrDet );/*Frame information settings*/ +STB_INT32 STB_Fr_Execute ( STB_FR_HANDLE handle );/*Main process execution*/ +STB_INT32 STB_Fr_GetResult ( STB_FR_HANDLE handle, STB_FR_RES* frResult );/*Get result*/ +STB_INT32 STB_Fr_Clear ( STB_FR_HANDLE handle );/*Clear*/ + +/*parameter*/ +STB_INT32 STB_Fr_SetFaceDirMinMax ( STB_FR_HANDLE handle , STB_INT32 nMinUDAngle , STB_INT32 nMaxUDAngle ,STB_INT32 nMinLRAngle , STB_INT32 nMaxLRAngle );/* FaceDirMinMax */ +STB_INT32 STB_Fr_GetFaceDirMinMax ( STB_FR_HANDLE handle , STB_INT32 *pnMinUDAngle, STB_INT32 *pnMaxUDAngle ,STB_INT32 *pnMinLRAngle, STB_INT32 *pnMaxLRAngle); +STB_INT32 STB_Fr_Clear ( STB_FR_HANDLE handle );/* ClearID */ +STB_INT32 STB_Fr_SetFaceDirThreshold ( STB_FR_HANDLE handle , STB_INT32 threshold );/* FaceDirThreshold */ +STB_INT32 STB_Fr_GetFaceDirThreshold ( STB_FR_HANDLE handle , STB_INT32* threshold ); +STB_INT32 STB_Fr_SetFrameCount ( STB_FR_HANDLE handle , STB_INT32 nFrameCount ); +STB_INT32 STB_Fr_GetFrameCount ( STB_FR_HANDLE handle , STB_INT32* nFrameCount ); +STB_INT32 STB_Fr_SetMinRatio ( STB_FR_HANDLE handle , STB_INT32 nMinRatio ); +STB_INT32 STB_Fr_GetMinRatio ( STB_FR_HANDLE handle , STB_INT32* nMinRatio ); +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HVC/STBLib/src/include/SdkSTBPe.h Tue Sep 05 10:01:51 2017 +0000 @@ -0,0 +1,41 @@ +/*---------------------------------------------------------------------------*/ +/* Copyright(C) 2017 OMRON Corporation */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ +/* See the License for the specific language governing permissions and */ +/* limitations under the License. */ +/*---------------------------------------------------------------------------*/ + +#if !defined( _SDK_STBPE_H_ ) +#define _SDK_STBPE_H_ +#include "STBPeTypedef.h" + +#if !defined( STB_DEF_PE_HANDLE ) + #define STB_DEF_PE_HANDLE + typedef VOID* STB_PE_HANDLE; +#endif + +STB_PE_HANDLE STB_Pe_CreateHandle ( const STBExecFlg* execFlg ,const STB_INT32 nTraCntMax );/*Create/Delete handle*/ +STB_INT32 STB_Pe_DeleteHandle ( STB_PE_HANDLE handle );/*Create/Delete handle*/ +STB_INT32 STB_Pe_SetDetect ( STB_PE_HANDLE handle, const STB_PE_DET *stbPeDet );/*Frame information settings*/ +STB_INT32 STB_Pe_Execute ( STB_PE_HANDLE handle );/*Main process execution*/ +STB_INT32 STB_Pe_GetResult ( STB_PE_HANDLE handle, STB_PE_RES* peResult );/*Get result*/ + +/*parameter*/ +STB_INT32 STB_Pe_SetFaceDirMinMax ( STB_PE_HANDLE handle , STB_INT32 nMinUDAngle , STB_INT32 nMaxUDAngle ,STB_INT32 nMinLRAngle , STB_INT32 nMaxLRAngle );/* FaceDirMinMax */ +STB_INT32 STB_Pe_GetFaceDirMinMax ( STB_PE_HANDLE handle , STB_INT32 *pnMinUDAngle, STB_INT32 *pnMaxUDAngle ,STB_INT32 *pnMinLRAngle, STB_INT32 *pnMaxLRAngle); +STB_INT32 STB_Pe_Clear ( STB_PE_HANDLE handle );/* Clear */ +STB_INT32 STB_Pe_SetFaceDirThreshold ( STB_PE_HANDLE handle , STB_INT32 threshold );/* FaceDirThreshold */ +STB_INT32 STB_Pe_GetFaceDirThreshold ( STB_PE_HANDLE handle , STB_INT32* threshold ); +STB_INT32 STB_Pe_SetFrameCount ( STB_PE_HANDLE handle , STB_INT32 nFrameCount ); +STB_INT32 STB_Pe_GetFrameCount ( STB_PE_HANDLE handle , STB_INT32* nFrameCount ); + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HVC/STBLib/src/include/SdkSTBTr.h Tue Sep 05 10:01:51 2017 +0000 @@ -0,0 +1,42 @@ +/*---------------------------------------------------------------------------*/ +/* Copyright(C) 2017 OMRON Corporation */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ +/* See the License for the specific language governing permissions and */ +/* limitations under the License. */ +/*---------------------------------------------------------------------------*/ + +#if !defined( _SDK_STBTR_H_ ) +#define _SDK_STBTR_H_ + +#include "STBTrTypedef.h" + +#if !defined( STB_DEF_TR_HANDLE ) + #define STB_DEF_TR_HANDLE + typedef VOID* STB_TR_HANDLE; +#endif + +STB_TR_HANDLE STB_Tr_CreateHandle ( const STBExecFlg* execFlg ,const STB_INT32 nDetCntMax, const STB_INT32 nTraCntMax);/*Create/Delete handle*/ + +STB_INT32 STB_Tr_DeleteHandle ( STB_TR_HANDLE handle );/*Create/Delete handle*/ +STB_INT32 STB_Tr_SetDetect ( STB_TR_HANDLE handle,const STB_TR_DET *stbTrDet );/*Frame information settings*/ +STB_INT32 STB_Tr_Execute ( STB_TR_HANDLE handle );/*Main process execution*/ +STB_INT32 STB_Tr_GetResult ( STB_TR_HANDLE handle,STB_TR_RES_FACES* fcResult,STB_TR_RES_BODYS* bdResult);/*get the result*/ +STB_INT32 STB_Tr_Clear ( STB_TR_HANDLE handle); + +/*parameter*/ +STB_INT32 STB_Tr_SetRetryCount ( STB_TR_HANDLE handle , STB_INT32 nRetryCount );/*RetryCount*/ +STB_INT32 STB_Tr_GetRetryCount ( STB_TR_HANDLE handle , STB_INT32* nRetryCount ); +STB_INT32 STB_Tr_SetStedinessParam ( STB_TR_HANDLE handle , STB_INT32 nStedinessPos , STB_INT32 nStedinessSize );/* Stediness */ +STB_INT32 STB_Tr_GetStedinessParam ( STB_TR_HANDLE handle , STB_INT32* nStedinessPos , STB_INT32* nStedinessSize ); + + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HVC/STBLib/usr_include/STBAPI.h Tue Sep 05 10:01:51 2017 +0000
@@ -0,0 +1,76 @@
+/*---------------------------------------------------------------------------*/
+/* Copyright(C) 2017 OMRON Corporation */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
+/* See the License for the specific language governing permissions and */
+/* limitations under the License. */
+/*---------------------------------------------------------------------------*/
+
+#ifndef _SDK_STB_H_
+#define _SDK_STB_H_
+
+#include "STBTypedef.h"
+
+
+#ifndef STB_DEF_HANDLE
+ #define STB_DEF_HANDLE
+ typedef VOID* HSTB;
+#endif /* STB_DEF_HANDLE */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+STB_INT32 STB_GetVersion(STB_INT8* pnMajorVersion, STB_INT8* pnMinorVersion);
+
+/* Create/Delete handle */
+HSTB STB_CreateHandle(STB_UINT32 unUseFuncFlag);
+VOID STB_DeleteHandle(HSTB hSTB);
+
+/* Set the one frame result of HVC into this library */
+STB_INT32 STB_SetFrameResult(HSTB hSTB, const STB_FRAME_RESULT *stFrameResult);
+/* Clear frame results */
+STB_INT32 STB_ClearFrameResults(HSTB hSTB);
+
+/* Main process execution */
+STB_INT32 STB_Execute(HSTB hSTB);
+
+/* Get the result */
+STB_INT32 STB_GetFaces(HSTB hSTB, STB_UINT32 *punFaceCount, STB_FACE stFace[]);
+STB_INT32 STB_GetBodies(HSTB hSTB, STB_UINT32 *punBodyCount, STB_BODY stBody[]);
+
+/* Setting/Getting functions for tracking */
+STB_INT32 STB_SetTrRetryCount(HSTB hSTB, STB_INT32 nMaxRetryCount);
+STB_INT32 STB_GetTrRetryCount(HSTB hSTB, STB_INT32 *pnMaxRetryCount);
+STB_INT32 STB_SetTrSteadinessParam(HSTB hSTB, STB_INT32 nPosSteadinessParam, STB_INT32 nSizeSteadinessParam);
+STB_INT32 STB_GetTrSteadinessParam(HSTB hSTB, STB_INT32 *pnPosSteadinessParam, STB_INT32 *pnSizeSteadinessParam);
+/* Setting/Getting functions for property */
+STB_INT32 STB_SetPeThresholdUse(HSTB hSTB, STB_INT32 nThreshold);
+STB_INT32 STB_GetPeThresholdUse(HSTB hSTB, STB_INT32 *pnThreshold);
+STB_INT32 STB_SetPeAngleUse(HSTB hSTB, STB_INT32 nMinUDAngle, STB_INT32 nMaxUDAngle, STB_INT32 nMinLRAngle, STB_INT32 nMaxLRAngle);
+STB_INT32 STB_GetPeAngleUse(HSTB hSTB, STB_INT32 *pnMinUDAngle, STB_INT32 *pnMaxUDAngle, STB_INT32 *pnMinLRAngle, STB_INT32 *pnMaxLRAngle);
+STB_INT32 STB_SetPeCompleteFrameCount(HSTB hSTB, STB_INT32 nFrameCount);
+STB_INT32 STB_GetPeCompleteFrameCount(HSTB hSTB, STB_INT32 *pnFrameCount);
+/* Setting/Getting function for recognition */
+STB_INT32 STB_SetFrThresholdUse(HSTB hSTB, STB_INT32 nThreshold);
+STB_INT32 STB_GetFrThresholdUse(HSTB hSTB, STB_INT32 *pnThreshold);
+STB_INT32 STB_SetFrAngleUse(HSTB hSTB, STB_INT32 nMinUDAngle, STB_INT32 nMaxUDAngle, STB_INT32 nMinLRAngle, STB_INT32 nMaxLRAngle);
+STB_INT32 STB_GetFrAngleUse(HSTB hSTB, STB_INT32 *pnMinUDAngle, STB_INT32 *pnMaxUDAngle, STB_INT32 *pnMinLRAngle, STB_INT32 *pnMaxLRAngle);
+STB_INT32 STB_SetFrCompleteFrameCount(HSTB hSTB, STB_INT32 nFrameCount);
+STB_INT32 STB_GetFrCompleteFrameCount(HSTB hSTB, STB_INT32 *pnFrameCount);
+STB_INT32 STB_SetFrMinRatio(HSTB hSTB, STB_INT32 nMinRatio);
+STB_INT32 STB_GetFrMinRatio(HSTB hSTB, STB_INT32 *pnMinRatio);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SDK_STB_H_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HVC/STBLib/usr_include/STBCommonDef.h Tue Sep 05 10:01:51 2017 +0000 @@ -0,0 +1,52 @@ +/*---------------------------------------------------------------------------*/ +/* Copyright(C) 2017 OMRON Corporation */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ +/* See the License for the specific language governing permissions and */ +/* limitations under the License. */ +/*---------------------------------------------------------------------------*/ + +#ifndef __STB_COMMONDEF_H__ +#define __STB_COMMONDEF_H__ +#include <stdlib.h> + +/* Executed flag */ +#define STB_FUNC_BD (0x00000001U) /* [LSB]bit0: Body Tracking 00000000001 */ +#define STB_FUNC_DT (0x00000004U) /* [LSB]bit2: Face Tracking 00000000100 */ +#define STB_FUNC_PT (0x00000008U) /* [LSB]bit3: Face Direction 00000001000 */ +#define STB_FUNC_AG (0x00000010U) /* [LSB]bit4: Age Estimation 00000010000 */ +#define STB_FUNC_GN (0x00000020U) /* [LSB]bit5: Gender Estimation 00000100000 */ +#define STB_FUNC_GZ (0x00000040U) /* [LSB]bit6: Gaze Estimation 00001000000 */ +#define STB_FUNC_BL (0x00000080U) /* [LSB]bit7: Blink Estimation 00010000000 */ +#define STB_FUNC_EX (0x00000100U) /* [MSB]bit0: Expression Estimation 00100000000 */ +#define STB_FUNC_FR (0x00000200U) /* [MSB]bit1: Face Recognition 01000000000 */ + + + +/* STB library's error code */ +#define STB_NORMAL (0) /* Successful completion */ +#define STB_ERR_INITIALIZE (-2) /* Initialization error */ +#define STB_ERR_INVALIDPARAM (-3) /* Argument error */ +#define STB_ERR_NOHANDLE (-7) /* Handle error */ +#define STB_ERR_PROCESSCONDITION (-8) /* When the processing condition is not satisfied */ + +#define STB_TRUE (1) +#define STB_FALSE (0) + + + +#if !defined(STB_API) +/* Import (Application Default) */ + #define STB_API __declspec( dllimport ) +#endif /* OKAO_API || OMCV_API */ + +#endif /* __STB_COMMONDEF_H__ */ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HVC/STBLib/usr_include/STBTypedef.h Tue Sep 05 10:01:51 2017 +0000
@@ -0,0 +1,227 @@
+/*---------------------------------------------------------------------------*/
+/* Copyright(C) 2017 OMRON Corporation */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
+/* See the License for the specific language governing permissions and */
+/* limitations under the License. */
+/*---------------------------------------------------------------------------*/
+
+#ifndef __STB_TYPEDEF_H__
+#define __STB_TYPEDEF_H__
+
+
+#ifndef VOID
+#define VOID void
+#endif /* VOID */
+
+typedef signed char STB_INT8 ; /* 8-bit signed integer */
+typedef unsigned char STB_UINT8 ; /* 8-bit unsigned integer */
+typedef signed short STB_INT16 ; /* 16-bit signed integer */
+typedef unsigned short STB_UINT16 ; /* 16-bit unsigned integer */
+typedef int STB_INT32 ; /* 32 bit signed integer */
+typedef unsigned int STB_UINT32 ; /* 32 bit unsigned integer */
+typedef float STB_FLOAT32 ; /* 32-bit floating point number */
+typedef double STB_FLOAT64 ; /* 64-bit floating point number */
+
+
+
+/****************************************/
+/* INPUT data strucrure to STBLib. */
+/****************************************/
+
+typedef enum {
+ STB_Expression_Neutral,
+ STB_Expression_Happiness,
+ STB_Expression_Surprise,
+ STB_Expression_Anger,
+ STB_Expression_Sadness,
+ STB_Expression_Max
+} STB_OKAO_EXPRESSION;
+
+typedef struct {
+ STB_INT32 nX;
+ STB_INT32 nY;
+} STB_POINT;
+
+/* Face direction estimation */
+typedef struct {
+ STB_INT32 nLR;
+ STB_INT32 nUD;
+ STB_INT32 nRoll;
+ STB_INT32 nConfidence;
+} STB_FRAME_RESULT_DIRECTION;
+
+/* Age estimation */
+typedef struct {
+ STB_INT32 nAge;
+ STB_INT32 nConfidence;
+} STB_FRAME_RESULT_AGE;
+
+/* Gender estimation */
+typedef struct {
+ STB_INT32 nGender;
+ STB_INT32 nConfidence;
+} STB_FRAME_RESULT_GENDER;
+
+/* Gaze estimation */
+typedef struct {
+ STB_INT32 nLR;
+ STB_INT32 nUD;
+} STB_FRAME_RESULT_GAZE;
+
+/* Blink estimation */
+typedef struct {
+ STB_INT32 nLeftEye;
+ STB_INT32 nRightEye;
+} STB_FRAME_RESULT_BLINK;
+
+/* Facial expression estimation */
+typedef struct {
+ STB_INT32 anScore[STB_Expression_Max];
+ STB_INT32 nDegree;
+} STB_FRAME_RESULT_EXPRESSION;
+
+/* Face recognition */
+typedef struct {
+ STB_INT32 nUID;
+ STB_INT32 nScore;
+} STB_FRAME_RESULT_RECOGNITION;
+
+/* One detection result */
+typedef struct {
+ STB_POINT center;
+ STB_INT32 nSize;
+ STB_INT32 nConfidence ;
+} STB_FRAME_RESULT_DETECTION;
+
+/* Face detection and post-processing result (1 person) */
+typedef struct {
+ STB_POINT center;
+ STB_INT32 nSize;
+ STB_INT32 nConfidence;
+ STB_FRAME_RESULT_DIRECTION direction;
+ STB_FRAME_RESULT_AGE age;
+ STB_FRAME_RESULT_GENDER gender;
+ STB_FRAME_RESULT_GAZE gaze;
+ STB_FRAME_RESULT_BLINK blink;
+ STB_FRAME_RESULT_EXPRESSION expression;
+ STB_FRAME_RESULT_RECOGNITION recognition;
+} STB_FRAME_RESULT_FACE;
+
+/* One human body detection result */
+typedef struct {
+ STB_INT32 nCount;
+ STB_FRAME_RESULT_DETECTION body[35];
+} STB_FRAME_RESULT_BODYS;
+
+/* Face detection and post-processing result (1 frame) */
+typedef struct {
+ STB_INT32 nCount;
+ STB_FRAME_RESULT_FACE face[35];
+} STB_FRAME_RESULT_FACES;
+
+/* FRAME result (1 frame) */
+typedef struct {
+ STB_FRAME_RESULT_BODYS bodys;
+ STB_FRAME_RESULT_FACES faces;
+} STB_FRAME_RESULT;
+
+
+/****************************************/
+/* OUTPUT data strucrure from STBLib. */
+/****************************************/
+
+#define STB_CONF_NO_DATA -1 /* No confidence (No data or in the case of stabilization time) */
+
+typedef enum {
+ STB_STATUS_NO_DATA = -1, /* No data : No data for the relevant person */
+ STB_STATUS_CALCULATING = 0, /* During stabilization : a number of data for relevant people aren't enough(a number of frames that relevant people are taken) */
+ STB_STATUS_COMPLETE = 1, /* Stabilization done : the frames which done stabilization */
+ STB_STATUS_FIXED = 2, /* Stabilization fixed : already stabilization done, the results is fixed */
+} STB_STATUS; /* Status of stabilization */
+
+
+/* Expression */
+typedef enum {
+ STB_EX_UNKNOWN = -1,
+ STB_EX_NEUTRAL = 0,
+ STB_EX_HAPPINESS,
+ STB_EX_SURPRISE,
+ STB_EX_ANGER,
+ STB_EX_SADNESS,
+ STB_EX_MAX
+}STB_EXPRESSION;
+
+/* General purpose stabilization result structure */
+typedef struct {
+ STB_STATUS status; /* Stabilization status */
+ STB_INT32 conf; /* Stabilization confidence */
+ STB_INT32 value;
+} STB_RES;
+
+/* Result of Gaze estimation */
+typedef struct {
+ STB_STATUS status; /* Stabilization status */
+ STB_INT32 conf; /* Stabilization confidence */
+ STB_INT32 UD;
+ STB_INT32 LR;
+} STB_GAZE;
+
+/* Result of Face direction estimation */
+typedef struct {
+ STB_STATUS status; /* Stabilization status */
+ STB_INT32 conf; /* Stabilization confidence */
+ STB_INT32 yaw;
+ STB_INT32 pitch;
+ STB_INT32 roll;
+} STB_DIR;
+
+/* Result of Blink estimation */
+typedef struct {
+ STB_STATUS status; /* Stabilization status */
+ STB_INT32 ratioL;
+ STB_INT32 ratioR;
+} STB_BLINK;
+
+/* Detection position structure */
+typedef struct {
+ STB_UINT32 x;
+ STB_UINT32 y;
+} STB_POS;
+
+/* Face stabilization result structure */
+typedef struct {
+ STB_INT32 nDetectID;
+ STB_INT32 nTrackingID;
+ STB_POS center;
+ STB_UINT32 nSize;
+ STB_INT32 conf;
+ STB_DIR direction;
+ STB_RES age;
+ STB_RES gender;
+ STB_GAZE gaze;
+ STB_BLINK blink;
+ STB_RES expression;
+ STB_RES recognition;
+} STB_FACE;
+
+/* Human body stabilization result structure */
+typedef struct {
+ STB_INT32 nDetectID;
+ STB_INT32 nTrackingID;
+ STB_POS center;
+ STB_UINT32 nSize;
+ STB_INT32 conf;
+} STB_BODY;
+
+
+#endif /* __STB_TYPEDEF_H__ */
+
--- a/HVCApi/HVCApi.c Tue Aug 08 04:50:44 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1297 +0,0 @@
-/*---------------------------------------------------------------------------*/
-/* Copyright(C) 2017 OMRON Corporation */
-/* */
-/* Licensed under the Apache License, Version 2.0 (the "License"); */
-/* you may not use this file except in compliance with the License. */
-/* You may obtain a copy of the License at */
-/* */
-/* http://www.apache.org/licenses/LICENSE-2.0 */
-/* */
-/* Unless required by applicable law or agreed to in writing, software */
-/* distributed under the License is distributed on an "AS IS" BASIS, */
-/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
-/* See the License for the specific language governing permissions and */
-/* limitations under the License. */
-/*---------------------------------------------------------------------------*/
-
-/*
- HVC Sample API
-*/
-
-#include <stdlib.h>
-#include "HVCApi.h"
-#include "HVCExtraUartFunc.h"
-
-/*----------------------------------------------------------------------------*/
-/* Command number */
-/*----------------------------------------------------------------------------*/
-#define HVC_COM_GET_VERSION (UINT8)0x00
-#define HVC_COM_SET_CAMERA_ANGLE (UINT8)0x01
-#define HVC_COM_GET_CAMERA_ANGLE (UINT8)0x02
-#define HVC_COM_EXECUTE (UINT8)0x03
-#define HVC_COM_EXECUTEEX (UINT8)0x04
-#define HVC_COM_SET_THRESHOLD (UINT8)0x05
-#define HVC_COM_GET_THRESHOLD (UINT8)0x06
-#define HVC_COM_SET_SIZE_RANGE (UINT8)0x07
-#define HVC_COM_GET_SIZE_RANGE (UINT8)0x08
-#define HVC_COM_SET_DETECTION_ANGLE (UINT8)0x09
-#define HVC_COM_GET_DETECTION_ANGLE (UINT8)0x0A
-#define HVC_COM_SET_BAUDRATE (UINT8)0x0E
-#define HVC_COM_REGISTRATION (UINT8)0x10
-#define HVC_COM_DELETE_DATA (UINT8)0x11
-#define HVC_COM_DELETE_USER (UINT8)0x12
-#define HVC_COM_DELETE_ALL (UINT8)0x13
-#define HVC_COM_GET_PERSON_DATA (UINT8)0x15
-#define HVC_COM_SAVE_ALBUM (UINT8)0x20
-#define HVC_COM_LOAD_ALBUM (UINT8)0x21
-#define HVC_COM_WRITE_ALBUM (UINT8)0x22
-
-/*----------------------------------------------------------------------------*/
-/* Header for send signal data */
-typedef enum {
- SEND_HEAD_SYNCBYTE = 0,
- SEND_HEAD_COMMANDNO,
- SEND_HEAD_DATALENGTHLSB,
- SEND_HEAD_DATALENGTHMSB,
- SEND_HEAD_NUM
-}SEND_HEADER;
-/*----------------------------------------------------------------------------*/
-/* Header for receive signal data */
-typedef enum {
- RECEIVE_HEAD_SYNCBYTE = 0,
- RECEIVE_HEAD_STATUS,
- RECEIVE_HEAD_DATALENLL,
- RECEIVE_HEAD_DATALENLM,
- RECEIVE_HEAD_DATALENML,
- RECEIVE_HEAD_DATALENMM,
- RECEIVE_HEAD_NUM
-}RECEIVE_HEADER;
-
-/*----------------------------------------------------------------------------*/
-/* Send command signal */
-/* param : UINT8 inCommandNo command number */
-/* : INT32 inDataSize sending signal data size */
-/* : UINT8 *inData sending signal data */
-/* return : INT32 execution result error code */
-/* : 0...normal */
-/* : -10...timeout error */
-/*----------------------------------------------------------------------------*/
-static INT32 HVC_SendCommand(UINT8 inCommandNo, INT32 inDataSize, UINT8 *inData)
-{
- INT32 i;
- INT32 ret = 0;
- UINT8 sendData[32];
-
- /* Create header */
- sendData[SEND_HEAD_SYNCBYTE] = (UINT8)0xFE;
- sendData[SEND_HEAD_COMMANDNO] = (UINT8)inCommandNo;
- sendData[SEND_HEAD_DATALENGTHLSB] = (UINT8)(inDataSize&0xff);
- sendData[SEND_HEAD_DATALENGTHMSB] = (UINT8)((inDataSize>>8)&0xff);
-
- for(i = 0; i < inDataSize; i++){
- sendData[SEND_HEAD_NUM + i] = inData[i];
- }
-
- /* Send command signal */
- ret = UART_SendData(SEND_HEAD_NUM+inDataSize, sendData);
- if(ret != SEND_HEAD_NUM+inDataSize){
- return HVC_ERROR_SEND_DATA;
- }
- return 0;
-}
-
-/*----------------------------------------------------------------------------*/
-/* Send command signal of LoadAlbum */
-/* param : UINT8 inCommandNo command number */
-/* : INT32 inDataSize sending signal data size */
-/* : UINT8 *inData sending signal data */
-/* return : INT32 execution result error code */
-/* : 0...normal */
-/* : -10...timeout error */
-/*----------------------------------------------------------------------------*/
-static INT32 HVC_SendCommandOfLoadAlbum(UINT8 inCommandNo, INT32 inDataSize, UINT8 *inData)
-{
- INT32 i;
- INT32 ret = 0;
- UINT8 *pSendData = NULL;
-
- pSendData = (UINT8*)malloc(SEND_HEAD_NUM + 4 + inDataSize);
-
- /* Create header */
- pSendData[SEND_HEAD_SYNCBYTE] = (UINT8)0xFE;
- pSendData[SEND_HEAD_COMMANDNO] = (UINT8)inCommandNo;
- pSendData[SEND_HEAD_DATALENGTHLSB] = (UINT8)4;
- pSendData[SEND_HEAD_DATALENGTHMSB] = (UINT8)0;
-
- pSendData[SEND_HEAD_NUM + 0] = (UINT8)(inDataSize & 0x000000ff);
- pSendData[SEND_HEAD_NUM + 1] = (UINT8)((inDataSize >> 8) & 0x000000ff);
- pSendData[SEND_HEAD_NUM + 2] = (UINT8)((inDataSize >> 16) & 0x000000ff);
- pSendData[SEND_HEAD_NUM + 3] = (UINT8)((inDataSize >> 24) & 0x000000ff);
-
- for(i = 0; i < inDataSize; i++){
- pSendData[SEND_HEAD_NUM + 4 + i] = inData[i];
- }
-
- /* Send command signal */
- ret = UART_SendData(SEND_HEAD_NUM+4+inDataSize, pSendData);
- if(ret != SEND_HEAD_NUM + 4 + inDataSize){
- ret = HVC_ERROR_SEND_DATA;
- }
- else{
- ret = 0;
- }
- free(pSendData);
-
- return ret;
-}
-
-/*----------------------------------------------------------------------------*/
-/* Receive header */
-/* param : INT32 inTimeOutTime timeout time */
-/* : INT32 *outDataSize receive signal data length */
-/* : UINT8 *outStatus status */
-/* return : INT32 execution result error code */
-/* : 0...normal */
-/* : -20...timeout error */
-/* : -21...invalid header error */
-/*----------------------------------------------------------------------------*/
-static INT32 HVC_ReceiveHeader(INT32 inTimeOutTime, INT32 *outDataSize, UINT8 *outStatus)
-{
- INT32 ret = 0;
- UINT8 headerData[32];
-
- /* Get header part */
- ret = UART_ReceiveData(inTimeOutTime, RECEIVE_HEAD_NUM, headerData);
- if(ret != RECEIVE_HEAD_NUM){
- return HVC_ERROR_HEADER_TIMEOUT;
- }
- else if((UINT8)0xFE != headerData[RECEIVE_HEAD_SYNCBYTE]){
- /* Different value indicates an invalid result */
- return HVC_ERROR_HEADER_INVALID;
- }
-
- /* Get data length */
- *outDataSize = headerData[RECEIVE_HEAD_DATALENLL] +
- (headerData[RECEIVE_HEAD_DATALENLM]<<8) +
- (headerData[RECEIVE_HEAD_DATALENML]<<16) +
- (headerData[RECEIVE_HEAD_DATALENMM]<<24);
-
- /* Get command execution result */
- *outStatus = headerData[RECEIVE_HEAD_STATUS];
- return 0;
-}
-
-/*----------------------------------------------------------------------------*/
-/* Receive data */
-/* param : INT32 inTimeOutTime timeout time */
-/* : INT32 inDataSize receive signal data size */
-/* : UINT8 *outResult receive signal data */
-/* return : INT32 execution result error code */
-/* : 0...normal */
-/* : -20...timeout error */
-/*----------------------------------------------------------------------------*/
-static INT32 HVC_ReceiveData(INT32 inTimeOutTime, INT32 inDataSize, UINT8 *outResult)
-{
- INT32 ret = 0;
-
- if ( inDataSize <= 0 ) return 0;
-
- /* Receive data */
- ret = UART_ReceiveData(inTimeOutTime, inDataSize, outResult);
- if(ret != inDataSize){
- return HVC_ERROR_DATA_TIMEOUT;
- }
- return 0;
-}
-
-/*----------------------------------------------------------------------------*/
-/* HVC_GetVersion */
-/* param : INT32 inTimeOutTime timeout time (ms) */
-/* : HVC_VERSION *outVersion version data */
-/* : UINT8 *outStatus response code */
-/* return : INT32 execution result error code */
-/* : 0...normal */
-/* : -1...parameter error */
-/* : other...signal error */
-/*----------------------------------------------------------------------------*/
-INT32 HVC_GetVersion(INT32 inTimeOutTime, HVC_VERSION *outVersion, UINT8 *outStatus)
-{
- INT32 ret = 0;
- INT32 size = 0;
-
- if((NULL == outVersion) || (NULL == outStatus)){
- return HVC_ERROR_PARAMETER;
- }
-
- /* Send GetVersion command signal */
- ret = HVC_SendCommand(HVC_COM_GET_VERSION, 0, NULL);
- if ( ret != 0 ) return ret;
-
- /* Receive header */
- ret = HVC_ReceiveHeader(inTimeOutTime, &size, outStatus);
- if ( ret != 0 ) return ret;
-
- if ( size > (INT32)sizeof(HVC_VERSION) ) {
- size = sizeof(HVC_VERSION);
- }
-
- /* Receive data */
- return HVC_ReceiveData(inTimeOutTime, size, (UINT8*)outVersion);
-}
-
-/*----------------------------------------------------------------------------*/
-/* HVC_SetCameraAngle */
-/* param : INT32 inTimeOutTime timeout time (ms) */
-/* : INT32 inAngleNo camera angle number */
-/* : UINT8 *outStatus response code */
-/* return : INT32 execution result error code */
-/* : 0...normal */
-/* : -1...parameter error */
-/* : other...signal error */
-/*----------------------------------------------------------------------------*/
-INT32 HVC_SetCameraAngle(INT32 inTimeOutTime, INT32 inAngleNo, UINT8 *outStatus)
-{
- INT32 ret = 0;
- INT32 size = 0;
- UINT8 sendData[32];
-
- if(NULL == outStatus){
- return HVC_ERROR_PARAMETER;
- }
-
- sendData[0] = (UINT8)(inAngleNo&0xff);
- /* Send SetCameraAngle command signal */
- ret = HVC_SendCommand(HVC_COM_SET_CAMERA_ANGLE, sizeof(UINT8), sendData);
- if ( ret != 0 ) return ret;
-
- /* Receive header */
- ret = HVC_ReceiveHeader(inTimeOutTime, &size, outStatus);
- if ( ret != 0 ) return ret;
- return 0;
-}
-
-/*----------------------------------------------------------------------------*/
-/* HVC_GetCameraAngle */
-/* param : INT32 inTimeOutTime timeout time (ms) */
-/* : INT32 *outAngleNo camera angle number */
-/* : UINT8 *outStatus response code */
-/* return : INT32 execution result error code */
-/* : 0...normal */
-/* : -1...parameter error */
-/* : other...signal error */
-/*----------------------------------------------------------------------------*/
-INT32 HVC_GetCameraAngle(INT32 inTimeOutTime, INT32 *outAngleNo, UINT8 *outStatus)
-{
- INT32 ret = 0;
- INT32 size = 0;
- UINT8 recvData[32];
-
- if((NULL == outAngleNo) || (NULL == outStatus)){
- return HVC_ERROR_PARAMETER;
- }
-
- /* Send GetCameraAngle command signal */
- ret = HVC_SendCommand(HVC_COM_GET_CAMERA_ANGLE, 0, NULL);
- if ( ret != 0 ) return ret;
-
- /* Receive header */
- ret = HVC_ReceiveHeader(inTimeOutTime, &size, outStatus);
- if ( ret != 0 ) return ret;
-
- if ( size > (INT32)sizeof(UINT8) ) {
- size = sizeof(UINT8);
- }
-
- /* Receive data */
- ret = HVC_ReceiveData(inTimeOutTime, size, recvData);
- *outAngleNo = recvData[0];
- return ret;
-}
-
-/*----------------------------------------------------------------------------*/
-/* HVC_Execute */
-/* param : INT32 inTimeOutTime timeout time (ms) */
-/* : INT32 inExec executable function */
-/* : INT32 inImage image info */
-/* : HVC_RESULT *outHVCResult result data */
-/* : UINT8 *outStatus response code */
-/* return : INT32 execution result error code */
-/* : 0...normal */
-/* : -1...parameter error */
-/* : other...signal error */
-/*----------------------------------------------------------------------------*/
-INT32 HVC_Execute(INT32 inTimeOutTime, INT32 inExec, INT32 inImage, HVC_RESULT *outHVCResult, UINT8 *outStatus)
-{
- int i;
- INT32 ret = 0;
- INT32 size = 0;
- UINT8 sendData[32];
- UINT8 recvData[32];
-
- if((NULL == outHVCResult) || (NULL == outStatus)){
- return HVC_ERROR_PARAMETER;
- }
-
- /* Send Execute command signal */
- sendData[0] = (UINT8)(inExec&0xff);
- sendData[1] = (UINT8)((inExec>>8)&0xff);
- sendData[2] = (UINT8)(inImage&0xff);
- ret = HVC_SendCommand(HVC_COM_EXECUTE, sizeof(UINT8)*3, sendData);
- if ( ret != 0 ) return ret;
-
- /* Receive header */
- ret = HVC_ReceiveHeader(inTimeOutTime, &size, outStatus);
- if ( ret != 0 ) return ret;
-
- /* Receive result data */
- if ( size >= (INT32)sizeof(UINT8)*4 ) {
- outHVCResult->executedFunc = inExec;
- ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*4, recvData);
- outHVCResult->bdResult.num = recvData[0];
- outHVCResult->hdResult.num = recvData[1];
- outHVCResult->fdResult.num = recvData[2];
- if ( ret != 0 ) return ret;
- size -= sizeof(UINT8)*4;
- }
-
- /* Get Human Body Detection result */
- for(i = 0; i < outHVCResult->bdResult.num; i++){
- if ( size >= (INT32)sizeof(UINT8)*8 ) {
- ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*8, recvData);
- outHVCResult->bdResult.bdResult[i].posX = (short)(recvData[0] + (recvData[1]<<8));
- outHVCResult->bdResult.bdResult[i].posY = (short)(recvData[2] + (recvData[3]<<8));
- outHVCResult->bdResult.bdResult[i].size = (short)(recvData[4] + (recvData[5]<<8));
- outHVCResult->bdResult.bdResult[i].confidence = (short)(recvData[6] + (recvData[7]<<8));
- if ( ret != 0 ) return ret;
- size -= sizeof(UINT8)*8;
- }
- }
-
- /* Get Hand Detection result */
- for(i = 0; i < outHVCResult->hdResult.num; i++){
- if ( size >= (INT32)sizeof(UINT8)*8 ) {
- ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*8, recvData);
- outHVCResult->hdResult.hdResult[i].posX = (short)(recvData[0] + (recvData[1]<<8));
- outHVCResult->hdResult.hdResult[i].posY = (short)(recvData[2] + (recvData[3]<<8));
- outHVCResult->hdResult.hdResult[i].size = (short)(recvData[4] + (recvData[5]<<8));
- outHVCResult->hdResult.hdResult[i].confidence = (short)(recvData[6] + (recvData[7]<<8));
- if ( ret != 0 ) return ret;
- size -= sizeof(UINT8)*8;
- }
- }
-
- /* Face-related results */
- for(i = 0; i < outHVCResult->fdResult.num; i++){
- /* Face Detection result */
- if(0 != (outHVCResult->executedFunc & HVC_ACTIV_FACE_DETECTION)){
- if ( size >= (INT32)sizeof(UINT8)*8 ) {
- ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*8, recvData);
- outHVCResult->fdResult.fcResult[i].dtResult.posX = (short)(recvData[0] + (recvData[1]<<8));
- outHVCResult->fdResult.fcResult[i].dtResult.posY = (short)(recvData[2] + (recvData[3]<<8));
- outHVCResult->fdResult.fcResult[i].dtResult.size = (short)(recvData[4] + (recvData[5]<<8));
- outHVCResult->fdResult.fcResult[i].dtResult.confidence = (short)(recvData[6] + (recvData[7]<<8));
- if ( ret != 0 ) return ret;
- size -= sizeof(UINT8)*8;
- }
- }
-
- /* Face direction */
- if(0 != (outHVCResult->executedFunc & HVC_ACTIV_FACE_DIRECTION)){
- if ( size >= (INT32)sizeof(UINT8)*8 ) {
- ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*8, recvData);
- outHVCResult->fdResult.fcResult[i].dirResult.yaw = (short)(recvData[0] + (recvData[1]<<8));
- outHVCResult->fdResult.fcResult[i].dirResult.pitch = (short)(recvData[2] + (recvData[3]<<8));
- outHVCResult->fdResult.fcResult[i].dirResult.roll = (short)(recvData[4] + (recvData[5]<<8));
- outHVCResult->fdResult.fcResult[i].dirResult.confidence = (short)(recvData[6] + (recvData[7]<<8));
- if ( ret != 0 ) return ret;
- size -= sizeof(UINT8)*8;
- }
- }
-
- /* Age */
- if(0 != (outHVCResult->executedFunc & HVC_ACTIV_AGE_ESTIMATION)){
- if ( size >= (INT32)sizeof(UINT8)*3 ) {
- ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*3, recvData);
-#if(1) // Mbed
- outHVCResult->fdResult.fcResult[i].ageResult.age = (signed char)(recvData[0]);
-#else
- outHVCResult->fdResult.fcResult[i].ageResult.age = (char)(recvData[0]);
-#endif
- outHVCResult->fdResult.fcResult[i].ageResult.confidence = (short)(recvData[1] + (recvData[2]<<8));
- if ( ret != 0 ) return ret;
- size -= sizeof(UINT8)*3;
- }
- }
-
- /* Gender */
- if(0 != (outHVCResult->executedFunc & HVC_ACTIV_GENDER_ESTIMATION)){
- if ( size >= (INT32)sizeof(UINT8)*3 ) {
- ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*3, recvData);
-#if(1) // Mbed
- outHVCResult->fdResult.fcResult[i].genderResult.gender = (signed char)(recvData[0]);
-#else
- outHVCResult->fdResult.fcResult[i].genderResult.gender = (char)(recvData[0]);
-#endif
- outHVCResult->fdResult.fcResult[i].genderResult.confidence = (short)(recvData[1] + (recvData[2]<<8));
- if ( ret != 0 ) return ret;
- size -= sizeof(UINT8)*3;
- }
- }
-
- /* Gaze */
- if(0 != (outHVCResult->executedFunc & HVC_ACTIV_GAZE_ESTIMATION)){
- if ( size >= (INT32)sizeof(UINT8)*2 ) {
- ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*2, recvData);
-#if(1) // Mbed
- outHVCResult->fdResult.fcResult[i].gazeResult.gazeLR = (signed char)(recvData[0]);
- outHVCResult->fdResult.fcResult[i].gazeResult.gazeUD = (signed char)(recvData[1]);
-#else
- outHVCResult->fdResult.fcResult[i].gazeResult.gazeLR = (char)(recvData[0]);
- outHVCResult->fdResult.fcResult[i].gazeResult.gazeUD = (char)(recvData[1]);
-#endif
- if ( ret != 0 ) return ret;
- size -= sizeof(UINT8)*2;
- }
- }
-
- /* Blink */
- if(0 != (outHVCResult->executedFunc & HVC_ACTIV_BLINK_ESTIMATION)){
- if ( size >= (INT32)sizeof(UINT8)*4 ) {
- ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*4, recvData);
- outHVCResult->fdResult.fcResult[i].blinkResult.ratioL = (short)(recvData[0] + (recvData[1]<<8));
- outHVCResult->fdResult.fcResult[i].blinkResult.ratioR = (short)(recvData[2] + (recvData[3]<<8));
- if ( ret != 0 ) return ret;
- size -= sizeof(UINT8)*4;
- }
- }
-
- /* Expression */
- if(0 != (outHVCResult->executedFunc & HVC_ACTIV_EXPRESSION_ESTIMATION)){
- if ( size >= (INT32)sizeof(UINT8)*3 ) {
- ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*3, recvData);
-#if(1) // Mbed
- outHVCResult->fdResult.fcResult[i].expressionResult.topExpression = (signed char)(recvData[0]);
- outHVCResult->fdResult.fcResult[i].expressionResult.topScore = (signed char)(recvData[1]);
- outHVCResult->fdResult.fcResult[i].expressionResult.degree = (signed char)(recvData[2]);
-#else
- outHVCResult->fdResult.fcResult[i].expressionResult.topExpression = (char)(recvData[0]);
- outHVCResult->fdResult.fcResult[i].expressionResult.topScore = (char)(recvData[1]);
- outHVCResult->fdResult.fcResult[i].expressionResult.degree = (char)(recvData[2]);
-#endif
- if ( ret != 0 ) return ret;
- size -= sizeof(UINT8)*3;
- }
- }
-
- /* Face Recognition */
- if(0 != (outHVCResult->executedFunc & HVC_ACTIV_FACE_RECOGNITION)){
- if ( size >= (INT32)sizeof(UINT8)*4 ) {
- ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*4, recvData);
- outHVCResult->fdResult.fcResult[i].recognitionResult.uid = (short)(recvData[0] + (recvData[1]<<8));
- outHVCResult->fdResult.fcResult[i].recognitionResult.confidence = (short)(recvData[2] + (recvData[3]<<8));
- if ( ret != 0 ) return ret;
- size -= sizeof(UINT8)*4;
- }
- }
- }
-
- if(HVC_EXECUTE_IMAGE_NONE != inImage){
- /* Image data */
- if ( size >= (INT32)sizeof(UINT8)*4 ) {
- ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*4, recvData);
- outHVCResult->image.width = (short)(recvData[0] + (recvData[1]<<8));
- outHVCResult->image.height = (short)(recvData[2] + (recvData[3]<<8));
- if ( ret != 0 ) return ret;
- size -= sizeof(UINT8)*4;
- }
-
- if ( size >= (INT32)sizeof(UINT8)*outHVCResult->image.width*outHVCResult->image.height ) {
- ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*outHVCResult->image.width*outHVCResult->image.height, outHVCResult->image.image);
- if ( ret != 0 ) return ret;
- size -= sizeof(UINT8)*outHVCResult->image.width*outHVCResult->image.height;
- }
- }
- return 0;
-}
-
-/*----------------------------------------------------------------------------*/
-/* HVC_ExecuteEx */
-/* param : INT32 inTimeOutTime timeout time (ms) */
-/* : INT32 inExec executable function */
-/* : INT32 inImage image info */
-/* : HVC_RESULT *outHVCResult result data */
-/* : UINT8 *outStatus response code */
-/* return : INT32 execution result error code */
-/* : 0...normal */
-/* : -1...parameter error */
-/* : other...signal error */
-/*----------------------------------------------------------------------------*/
-INT32 HVC_ExecuteEx(INT32 inTimeOutTime, INT32 inExec, INT32 inImage, HVC_RESULT *outHVCResult, UINT8 *outStatus)
-{
- int i, j;
- INT32 ret = 0;
- INT32 size = 0;
- UINT8 sendData[32];
- UINT8 recvData[32];
-
- if((NULL == outHVCResult) || (NULL == outStatus)){
- return HVC_ERROR_PARAMETER;
- }
-
- /* Send Execute command signal */
- sendData[0] = (UINT8)(inExec&0xff);
- sendData[1] = (UINT8)((inExec>>8)&0xff);
- sendData[2] = (UINT8)(inImage&0xff);
- ret = HVC_SendCommand(HVC_COM_EXECUTEEX, sizeof(UINT8)*3, sendData);
- if ( ret != 0 ) return ret;
-
- /* Receive header */
- ret = HVC_ReceiveHeader(inTimeOutTime, &size, outStatus);
- if ( ret != 0 ) return ret;
-
- /* Receive result data */
- if ( size >= (INT32)sizeof(UINT8)*4 ) {
- outHVCResult->executedFunc = inExec;
- ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*4, recvData);
- outHVCResult->bdResult.num = recvData[0];
- outHVCResult->hdResult.num = recvData[1];
- outHVCResult->fdResult.num = recvData[2];
- if ( ret != 0 ) return ret;
- size -= sizeof(UINT8)*4;
- }
-
- /* Get Human Body Detection result */
- for(i = 0; i < outHVCResult->bdResult.num; i++){
- if ( size >= (INT32)sizeof(UINT8)*8 ) {
- ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*8, recvData);
- outHVCResult->bdResult.bdResult[i].posX = (short)(recvData[0] + (recvData[1]<<8));
- outHVCResult->bdResult.bdResult[i].posY = (short)(recvData[2] + (recvData[3]<<8));
- outHVCResult->bdResult.bdResult[i].size = (short)(recvData[4] + (recvData[5]<<8));
- outHVCResult->bdResult.bdResult[i].confidence = (short)(recvData[6] + (recvData[7]<<8));
- if ( ret != 0 ) return ret;
- size -= sizeof(UINT8)*8;
- }
- }
-
- /* Get Hand Detection result */
- for(i = 0; i < outHVCResult->hdResult.num; i++){
- if ( size >= (INT32)sizeof(UINT8)*8 ) {
- ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*8, recvData);
- outHVCResult->hdResult.hdResult[i].posX = (short)(recvData[0] + (recvData[1]<<8));
- outHVCResult->hdResult.hdResult[i].posY = (short)(recvData[2] + (recvData[3]<<8));
- outHVCResult->hdResult.hdResult[i].size = (short)(recvData[4] + (recvData[5]<<8));
- outHVCResult->hdResult.hdResult[i].confidence = (short)(recvData[6] + (recvData[7]<<8));
- if ( ret != 0 ) return ret;
- size -= sizeof(UINT8)*8;
- }
- }
-
- /* Face-related results */
- for(i = 0; i < outHVCResult->fdResult.num; i++){
- /* Face Detection result */
- if(0 != (outHVCResult->executedFunc & HVC_ACTIV_FACE_DETECTION)){
- if ( size >= (INT32)sizeof(UINT8)*8 ) {
- ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*8, recvData);
- outHVCResult->fdResult.fcResult[i].dtResult.posX = (short)(recvData[0] + (recvData[1]<<8));
- outHVCResult->fdResult.fcResult[i].dtResult.posY = (short)(recvData[2] + (recvData[3]<<8));
- outHVCResult->fdResult.fcResult[i].dtResult.size = (short)(recvData[4] + (recvData[5]<<8));
- outHVCResult->fdResult.fcResult[i].dtResult.confidence = (short)(recvData[6] + (recvData[7]<<8));
- if ( ret != 0 ) return ret;
- size -= sizeof(UINT8)*8;
- }
- }
-
- /* Face direction */
- if(0 != (outHVCResult->executedFunc & HVC_ACTIV_FACE_DIRECTION)){
- if ( size >= (INT32)sizeof(UINT8)*8 ) {
- ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*8, recvData);
- outHVCResult->fdResult.fcResult[i].dirResult.yaw = (short)(recvData[0] + (recvData[1]<<8));
- outHVCResult->fdResult.fcResult[i].dirResult.pitch = (short)(recvData[2] + (recvData[3]<<8));
- outHVCResult->fdResult.fcResult[i].dirResult.roll = (short)(recvData[4] + (recvData[5]<<8));
- outHVCResult->fdResult.fcResult[i].dirResult.confidence = (short)(recvData[6] + (recvData[7]<<8));
- if ( ret != 0 ) return ret;
- size -= sizeof(UINT8)*8;
- }
- }
-
- /* Age */
- if(0 != (outHVCResult->executedFunc & HVC_ACTIV_AGE_ESTIMATION)){
- if ( size >= (INT32)sizeof(UINT8)*3 ) {
- ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*3, recvData);
-#if(1) // Mbed
- outHVCResult->fdResult.fcResult[i].ageResult.age = (signed char)(recvData[0]);
-#else
- outHVCResult->fdResult.fcResult[i].ageResult.age = (char)(recvData[0]);
-#endif
- outHVCResult->fdResult.fcResult[i].ageResult.confidence = (short)(recvData[1] + (recvData[2]<<8));
- if ( ret != 0 ) return ret;
- size -= sizeof(UINT8)*3;
- }
- }
-
- /* Gender */
- if(0 != (outHVCResult->executedFunc & HVC_ACTIV_GENDER_ESTIMATION)){
- if ( size >= (INT32)sizeof(UINT8)*3 ) {
- ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*3, recvData);
-#if(1) // Mbed
- outHVCResult->fdResult.fcResult[i].genderResult.gender = (signed char)(recvData[0]);
-#else
- outHVCResult->fdResult.fcResult[i].genderResult.gender = (char)(recvData[0]);
-#endif
- outHVCResult->fdResult.fcResult[i].genderResult.confidence = (short)(recvData[1] + (recvData[2]<<8));
- if ( ret != 0 ) return ret;
- size -= sizeof(UINT8)*3;
- }
- }
-
- /* Gaze */
- if(0 != (outHVCResult->executedFunc & HVC_ACTIV_GAZE_ESTIMATION)){
- if ( size >= (INT32)sizeof(UINT8)*2 ) {
- ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*2, recvData);
-#if(1) // Mbed
- outHVCResult->fdResult.fcResult[i].gazeResult.gazeLR = (signed char)(recvData[0]);
- outHVCResult->fdResult.fcResult[i].gazeResult.gazeUD = (signed char)(recvData[1]);
-#else
- outHVCResult->fdResult.fcResult[i].gazeResult.gazeLR = (char)(recvData[0]);
- outHVCResult->fdResult.fcResult[i].gazeResult.gazeUD = (char)(recvData[1]);
-#endif
- if ( ret != 0 ) return ret;
- size -= sizeof(UINT8)*2;
- }
- }
-
- /* Blink */
- if(0 != (outHVCResult->executedFunc & HVC_ACTIV_BLINK_ESTIMATION)){
- if ( size >= (INT32)sizeof(UINT8)*4 ) {
- ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*4, recvData);
- outHVCResult->fdResult.fcResult[i].blinkResult.ratioL = (short)(recvData[0] + (recvData[1]<<8));
- outHVCResult->fdResult.fcResult[i].blinkResult.ratioR = (short)(recvData[2] + (recvData[3]<<8));
- if ( ret != 0 ) return ret;
- size -= sizeof(UINT8)*4;
- }
- }
-
- /* Expression */
- if(0 != (outHVCResult->executedFunc & HVC_ACTIV_EXPRESSION_ESTIMATION)){
- if ( size >= (INT32)sizeof(UINT8)*6 ) {
- ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*6, recvData);
- outHVCResult->fdResult.fcResult[i].expressionResult.topExpression = -128;
- outHVCResult->fdResult.fcResult[i].expressionResult.topScore = -128;
- for(j = 0; j < 5; j++){
-#if(1) // Mbed
- outHVCResult->fdResult.fcResult[i].expressionResult.score[j] = (signed char)(recvData[j]);
-#else
- outHVCResult->fdResult.fcResult[i].expressionResult.score[j] = (char)(recvData[j]);
-#endif
- if(outHVCResult->fdResult.fcResult[i].expressionResult.topScore < outHVCResult->fdResult.fcResult[i].expressionResult.score[j]){
- outHVCResult->fdResult.fcResult[i].expressionResult.topScore = outHVCResult->fdResult.fcResult[i].expressionResult.score[j];
- outHVCResult->fdResult.fcResult[i].expressionResult.topExpression = j + 1;
- }
- }
-#if(1) // Mbed
- outHVCResult->fdResult.fcResult[i].expressionResult.degree = (signed char)(recvData[5]);
-#else
- outHVCResult->fdResult.fcResult[i].expressionResult.degree = (char)(recvData[5]);
-#endif
- if ( ret != 0 ) return ret;
- size -= sizeof(UINT8)*6;
- }
- }
-
- /* Face Recognition */
- if(0 != (outHVCResult->executedFunc & HVC_ACTIV_FACE_RECOGNITION)){
- if ( size >= (INT32)sizeof(UINT8)*4 ) {
- ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*4, recvData);
- outHVCResult->fdResult.fcResult[i].recognitionResult.uid = (short)(recvData[0] + (recvData[1]<<8));
- outHVCResult->fdResult.fcResult[i].recognitionResult.confidence = (short)(recvData[2] + (recvData[3]<<8));
- if ( ret != 0 ) return ret;
- size -= sizeof(UINT8)*4;
- }
- }
- }
-
- if(HVC_EXECUTE_IMAGE_NONE != inImage){
- /* Image data */
- if ( size >= (INT32)sizeof(UINT8)*4 ) {
- ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*4, recvData);
- outHVCResult->image.width = (short)(recvData[0] + (recvData[1]<<8));
- outHVCResult->image.height = (short)(recvData[2] + (recvData[3]<<8));
- if ( ret != 0 ) return ret;
- size -= sizeof(UINT8)*4;
- }
-
- if ( size >= (INT32)sizeof(UINT8)*outHVCResult->image.width*outHVCResult->image.height ) {
- ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*outHVCResult->image.width*outHVCResult->image.height, outHVCResult->image.image);
- if ( ret != 0 ) return ret;
- size -= sizeof(UINT8)*outHVCResult->image.width*outHVCResult->image.height;
- }
- }
- return 0;
-}
-
-/*----------------------------------------------------------------------------*/
-/* HVC_SetThreshold */
-/* param : INT32 inTimeOutTime timeout time (ms) */
-/* : HVC_THRESHOLD *inThreshold threshold values */
-/* : UINT8 *outStatus response code */
-/* return : INT32 execution result error code */
-/* : 0...normal */
-/* : -1...parameter error */
-/* : other...signal error */
-/*----------------------------------------------------------------------------*/
-INT32 HVC_SetThreshold(INT32 inTimeOutTime, HVC_THRESHOLD *inThreshold, UINT8 *outStatus)
-{
- INT32 ret = 0;
- INT32 size = 0;
- UINT8 sendData[32];
-
- if((NULL == inThreshold) || (NULL == outStatus)){
- return HVC_ERROR_PARAMETER;
- }
-
- sendData[0] = (UINT8)(inThreshold->bdThreshold&0xff);
- sendData[1] = (UINT8)((inThreshold->bdThreshold>>8)&0xff);
- sendData[2] = (UINT8)(inThreshold->hdThreshold&0xff);
- sendData[3] = (UINT8)((inThreshold->hdThreshold>>8)&0xff);
- sendData[4] = (UINT8)(inThreshold->dtThreshold&0xff);
- sendData[5] = (UINT8)((inThreshold->dtThreshold>>8)&0xff);
- sendData[6] = (UINT8)(inThreshold->rsThreshold&0xff);
- sendData[7] = (UINT8)((inThreshold->rsThreshold>>8)&0xff);
- /* Send SetThreshold command signal */
- ret = HVC_SendCommand(HVC_COM_SET_THRESHOLD, sizeof(UINT8)*8, sendData);
- if ( ret != 0 ) return ret;
-
- /* Receive header */
- ret = HVC_ReceiveHeader(inTimeOutTime, &size, outStatus);
- if ( ret != 0 ) return ret;
- return 0;
-}
-
-/*----------------------------------------------------------------------------*/
-/* HVC_GetThreshold */
-/* param : INT32 inTimeOutTime timeout time (ms) */
-/* : HVC_THRESHOLD *outThreshold threshold values */
-/* : UINT8 *outStatus response code */
-/* return : INT32 execution result error code */
-/* : 0...normal */
-/* : -1...parameter error */
-/* : other...signal error */
-/*----------------------------------------------------------------------------*/
-INT32 HVC_GetThreshold(INT32 inTimeOutTime, HVC_THRESHOLD *outThreshold, UINT8 *outStatus)
-{
- INT32 ret = 0;
- INT32 size = 0;
- UINT8 recvData[32];
-
- if((NULL == outThreshold) || (NULL == outStatus)){
- return HVC_ERROR_PARAMETER;
- }
-
- /* Send GetThreshold command signal */
- ret = HVC_SendCommand(HVC_COM_GET_THRESHOLD, 0, NULL);
- if ( ret != 0 ) return ret;
-
- /* Receive header */
- ret = HVC_ReceiveHeader(inTimeOutTime, &size, outStatus);
- if ( ret != 0 ) return ret;
-
- if ( size > (INT32)sizeof(UINT8)*8 ) {
- size = sizeof(UINT8)*8;
- }
-
- /* Receive data */
- ret = HVC_ReceiveData(inTimeOutTime, size, recvData);
- outThreshold->bdThreshold = recvData[0] + (recvData[1]<<8);
- outThreshold->hdThreshold = recvData[2] + (recvData[3]<<8);
- outThreshold->dtThreshold = recvData[4] + (recvData[5]<<8);
- outThreshold->rsThreshold = recvData[6] + (recvData[7]<<8);
- return ret;
-}
-
-/*----------------------------------------------------------------------------*/
-/* HVC_SetSizeRange */
-/* param : INT32 inTimeOutTime timeout time (ms) */
-/* : HVC_SIZERANGE *inSizeRange detection sizes */
-/* : UINT8 *outStatus response code */
-/* return : INT32 execution result error code */
-/* : 0...normal */
-/* : -1...parameter error */
-/* : other...signal error */
-/*----------------------------------------------------------------------------*/
-INT32 HVC_SetSizeRange(INT32 inTimeOutTime, HVC_SIZERANGE *inSizeRange, UINT8 *outStatus)
-{
- INT32 ret = 0;
- INT32 size = 0;
- UINT8 sendData[32];
-
- if((NULL == inSizeRange) || (NULL == outStatus)){
- return HVC_ERROR_PARAMETER;
- }
-
- sendData[0] = (UINT8)(inSizeRange->bdMinSize&0xff);
- sendData[1] = (UINT8)((inSizeRange->bdMinSize>>8)&0xff);
- sendData[2] = (UINT8)(inSizeRange->bdMaxSize&0xff);
- sendData[3] = (UINT8)((inSizeRange->bdMaxSize>>8)&0xff);
- sendData[4] = (UINT8)(inSizeRange->hdMinSize&0xff);
- sendData[5] = (UINT8)((inSizeRange->hdMinSize>>8)&0xff);
- sendData[6] = (UINT8)(inSizeRange->hdMaxSize&0xff);
- sendData[7] = (UINT8)((inSizeRange->hdMaxSize>>8)&0xff);
- sendData[8] = (UINT8)(inSizeRange->dtMinSize&0xff);
- sendData[9] = (UINT8)((inSizeRange->dtMinSize>>8)&0xff);
- sendData[10] = (UINT8)(inSizeRange->dtMaxSize&0xff);
- sendData[11] = (UINT8)((inSizeRange->dtMaxSize>>8)&0xff);
- /* Send SetSizeRange command signal */
- ret = HVC_SendCommand(HVC_COM_SET_SIZE_RANGE, sizeof(UINT8)*12, sendData);
- if ( ret != 0 ) return ret;
-
- /* Receive header */
- ret = HVC_ReceiveHeader(inTimeOutTime, &size, outStatus);
- if ( ret != 0 ) return ret;
- return 0;
-}
-
-/*----------------------------------------------------------------------------*/
-/* HVC_GetSizeRange */
-/* param : INT32 inTimeOutTime timeout time (ms) */
-/* : HVC_SIZERANGE *outSizeRange detection sizes */
-/* : UINT8 *outStatus response code */
-/* return : INT32 execution result error code */
-/* : 0...normal */
-/* : -1...parameter error */
-/* : other...signal error */
-/*----------------------------------------------------------------------------*/
-INT32 HVC_GetSizeRange(INT32 inTimeOutTime, HVC_SIZERANGE *outSizeRange, UINT8 *outStatus)
-{
- INT32 ret = 0;
- INT32 size = 0;
- UINT8 recvData[32];
-
- if((NULL == outSizeRange) || (NULL == outStatus)){
- return HVC_ERROR_PARAMETER;
- }
-
- /* Send GetSizeRange command signal */
- ret = HVC_SendCommand(HVC_COM_GET_SIZE_RANGE, 0, NULL);
- if ( ret != 0 ) return ret;
-
- /* Receive header */
- ret = HVC_ReceiveHeader(inTimeOutTime, &size, outStatus);
- if ( ret != 0 ) return ret;
-
- if ( size > (INT32)sizeof(UINT8)*12 ) {
- size = sizeof(UINT8)*12;
- }
-
- /* Receive data */
- ret = HVC_ReceiveData(inTimeOutTime, size, recvData);
- outSizeRange->bdMinSize = recvData[0] + (recvData[1]<<8);
- outSizeRange->bdMaxSize = recvData[2] + (recvData[3]<<8);
- outSizeRange->hdMinSize = recvData[4] + (recvData[5]<<8);
- outSizeRange->hdMaxSize = recvData[6] + (recvData[7]<<8);
- outSizeRange->dtMinSize = recvData[8] + (recvData[9]<<8);
- outSizeRange->dtMaxSize = recvData[10] + (recvData[11]<<8);
- return ret;
-}
-
-/*----------------------------------------------------------------------------*/
-/* HVC_SetFaceDetectionAngle */
-/* param : INT32 inTimeOutTime timeout time (ms) */
-/* : INT32 inPose Yaw angle range */
-/* : INT32 inAngle Roll angle range */
-/* : UINT8 *outStatus response code */
-/* return : INT32 execution result error code */
-/* : 0...normal */
-/* : -1...parameter error */
-/* : other...signal error */
-/*----------------------------------------------------------------------------*/
-INT32 HVC_SetFaceDetectionAngle(INT32 inTimeOutTime, INT32 inPose, INT32 inAngle, UINT8 *outStatus)
-{
- INT32 ret = 0;
- INT32 size = 0;
- UINT8 sendData[32];
-
- if(NULL == outStatus){
- return HVC_ERROR_PARAMETER;
- }
-
- sendData[0] = (UINT8)(inPose&0xff);
- sendData[1] = (UINT8)(inAngle&0xff);
- /* Send SetFaceDetectionAngle command signal */
- ret = HVC_SendCommand(HVC_COM_SET_DETECTION_ANGLE, sizeof(UINT8)*2, sendData);
- if ( ret != 0 ) return ret;
-
- /* Receive header */
- ret = HVC_ReceiveHeader(inTimeOutTime, &size, outStatus);
- if ( ret != 0 ) return ret;
- return 0;
-}
-
-/*----------------------------------------------------------------------------*/
-/* HVC_GetFaceDetectionAngle */
-/* param : INT32 inTimeOutTime timeout time (ms) */
-/* : INT32 *outPose Yaw angle range */
-/* : INT32 *outAngle Roll angle range */
-/* : UINT8 *outStatus response code */
-/* return : INT32 execution result error code */
-/* : 0...normal */
-/* : -1...parameter error */
-/* : other...signal error */
-/*----------------------------------------------------------------------------*/
-INT32 HVC_GetFaceDetectionAngle(INT32 inTimeOutTime, INT32 *outPose, INT32 *outAngle, UINT8 *outStatus)
-{
- INT32 ret = 0;
- INT32 size = 0;
- UINT8 recvData[32];
-
- if((NULL == outPose) || (NULL == outAngle) || (NULL == outStatus)){
- return HVC_ERROR_PARAMETER;
- }
-
- /* Send GetFaceDetectionAngle signal command */
- ret = HVC_SendCommand(HVC_COM_GET_DETECTION_ANGLE, 0, NULL);
- if ( ret != 0 ) return ret;
-
- /* Receive header */
- ret = HVC_ReceiveHeader(inTimeOutTime, &size, outStatus);
- if ( ret != 0 ) return ret;
-
- if ( size > (INT32)sizeof(UINT8)*2 ) {
- size = sizeof(UINT8)*2;
- }
-
- /* Receive data */
- ret = HVC_ReceiveData(inTimeOutTime, size, recvData);
- *outPose = recvData[0];
- *outAngle = recvData[1];
- return ret;
-}
-
-/*----------------------------------------------------------------------------*/
-/* HVC_SetBaudRate */
-/* param : INT32 inTimeOutTime timeout time (ms) */
-/* : INT32 inRate Baudrate */
-/* : UINT8 *outStatus response code */
-/* return : INT32 execution result error code */
-/* : 0...normal */
-/* : -1...parameter error */
-/* : other...signal error */
-/*----------------------------------------------------------------------------*/
-INT32 HVC_SetBaudRate(INT32 inTimeOutTime, INT32 inRate, UINT8 *outStatus)
-{
- INT32 ret = 0;
- INT32 size = 0;
- UINT8 sendData[32];
-
- if(NULL == outStatus){
- return HVC_ERROR_PARAMETER;
- }
-
- sendData[0] = (UINT8)(inRate&0xff);
- /* Send SetBaudRate command signal */
- ret = HVC_SendCommand(HVC_COM_SET_BAUDRATE, sizeof(UINT8), sendData);
- if ( ret != 0 ) return ret;
-
- /* Receive header */
- ret = HVC_ReceiveHeader(inTimeOutTime, &size, outStatus);
- if ( ret != 0 ) return ret;
- return 0;
-}
-
-/*----------------------------------------------------------------------------*/
-/* HVC_Registration */
-/* param : INT32 inTimeOutTime timeout time (ms) */
-/* : INT32 inUserID User ID (0-499) */
-/* : INT32 inDataID Data ID (0-9) */
-/* : HVC_IMAGE *outImage image info */
-/* : UINT8 *outStatus response code */
-/* return : INT32 execution result error code */
-/* : 0...normal */
-/* : -1...parameter error */
-/* : other...signal error */
-/*----------------------------------------------------------------------------*/
-INT32 HVC_Registration(INT32 inTimeOutTime, INT32 inUserID, INT32 inDataID, HVC_IMAGE *outImage, UINT8 *outStatus)
-{
- INT32 ret = 0;
- INT32 size = 0;
- UINT8 sendData[32];
- UINT8 recvData[32];
-
- if((NULL == outImage) || (NULL == outStatus)){
- return HVC_ERROR_PARAMETER;
- }
-
- /* Send Registration signal command */
- sendData[0] = (UINT8)(inUserID&0xff);
- sendData[1] = (UINT8)((inUserID>>8)&0xff);
- sendData[2] = (UINT8)(inDataID&0xff);
- ret = HVC_SendCommand(HVC_COM_REGISTRATION, sizeof(UINT8)*3, sendData);
- if ( ret != 0 ) return ret;
-
- /* Receive header */
- ret = HVC_ReceiveHeader(inTimeOutTime, &size, outStatus);
- if ( ret != 0 ) return ret;
-
- /* Receive data */
- if ( size >= (INT32)sizeof(UINT8)*4 ) {
- ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*4, recvData);
- outImage->width = recvData[0] + (recvData[1]<<8);
- outImage->height = recvData[2] + (recvData[3]<<8);
- if ( ret != 0 ) return ret;
- size -= sizeof(UINT8)*4;
- }
-
- /* Image data */
- if ( size >= (INT32)sizeof(UINT8)*64*64 ) {
- ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*64*64, outImage->image);
- if ( ret != 0 ) return ret;
- size -= sizeof(UINT8)*64*64;
- }
- return 0;
-}
-
-/*----------------------------------------------------------------------------*/
-/* HVC_DeleteData */
-/* param : INT32 inTimeOutTime timeout time (ms) */
-/* : INT32 inUserID User ID (0-499) */
-/* : INT32 inDataID Data ID (0-9) */
-/* : UINT8 *outStatus response code */
-/* return : INT32 execution result error code */
-/* : 0...normal */
-/* : -1...parameter error */
-/* : other...signal error */
-/*----------------------------------------------------------------------------*/
-INT32 HVC_DeleteData(INT32 inTimeOutTime, INT32 inUserID, INT32 inDataID, UINT8 *outStatus)
-{
- INT32 ret = 0;
- INT32 size = 0;
- UINT8 sendData[32];
-
- if(NULL == outStatus){
- return HVC_ERROR_PARAMETER;
- }
-
- /* Send Delete Data signal command */
- sendData[0] = (UINT8)(inUserID&0xff);
- sendData[1] = (UINT8)((inUserID>>8)&0xff);
- sendData[2] = (UINT8)(inDataID&0xff);
- ret = HVC_SendCommand(HVC_COM_DELETE_DATA, sizeof(UINT8)*3, sendData);
- if ( ret != 0 ) return ret;
-
- /* Receive header */
- ret = HVC_ReceiveHeader(inTimeOutTime, &size, outStatus);
- if ( ret != 0 ) return ret;
- return 0;
-}
-
-/*----------------------------------------------------------------------------*/
-/* HVC_DeleteUser */
-/* param : INT32 inTimeOutTime timeout time (ms) */
-/* : INT32 inUserID User ID (0-499) */
-/* : UINT8 *outStatus response code */
-/* return : INT32 execution result error code */
-/* : 0...normal */
-/* : -1...parameter error */
-/* : other...signal error */
-/*----------------------------------------------------------------------------*/
-INT32 HVC_DeleteUser(INT32 inTimeOutTime, INT32 inUserID, UINT8 *outStatus)
-{
- INT32 ret = 0;
- INT32 size = 0;
- UINT8 sendData[32];
-
- if(NULL == outStatus){
- return HVC_ERROR_PARAMETER;
- }
-
- /* Send Delete User signal command */
- sendData[0] = (UINT8)(inUserID&0xff);
- sendData[1] = (UINT8)((inUserID>>8)&0xff);
- ret = HVC_SendCommand(HVC_COM_DELETE_USER, sizeof(UINT8)*2, sendData);
- if ( ret != 0 ) return ret;
-
- /* Receive header */
- ret = HVC_ReceiveHeader(inTimeOutTime, &size, outStatus);
- if ( ret != 0 ) return ret;
- return 0;
-}
-
-/*----------------------------------------------------------------------------*/
-/* HVC_DeleteAll */
-/* param : INT32 inTimeOutTime timeout time (ms) */
-/* : UINT8 *outStatus response code */
-/* return : INT32 execution result error code */
-/* : 0...normal */
-/* : -1...parameter error */
-/* : other...signal error */
-/*----------------------------------------------------------------------------*/
-INT32 HVC_DeleteAll(INT32 inTimeOutTime, UINT8 *outStatus)
-{
- INT32 ret = 0;
- INT32 size = 0;
-
- if(NULL == outStatus){
- return HVC_ERROR_PARAMETER;
- }
-
- /* Send Delete All signal command */
- ret = HVC_SendCommand(HVC_COM_DELETE_ALL, 0, NULL);
- if ( ret != 0 ) return ret;
-
- /* Receive header */
- ret = HVC_ReceiveHeader(inTimeOutTime, &size, outStatus);
- if ( ret != 0 ) return ret;
- return 0;
-}
-
-/*----------------------------------------------------------------------------*/
-/* HVC_GetUserData */
-/* param : INT32 inTimeOutTime timeout time (ms) */
-/* : INT32 inUserID User ID (0-499) */
-/* : INT32 *outDataNo Registration Info */
-/* : UINT8 *outStatus response code */
-/* return : INT32 execution result error code */
-/* : 0...normal */
-/* : -1...parameter error */
-/* : other...signal error */
-/*----------------------------------------------------------------------------*/
-INT32 HVC_GetUserData(INT32 inTimeOutTime, INT32 inUserID, INT32 *outDataNo, UINT8 *outStatus)
-{
- INT32 ret = 0;
- INT32 size = 0;
- UINT8 sendData[8];
- UINT8 recvData[8];
-
- if((NULL == outDataNo) || (NULL == outStatus)){
- return HVC_ERROR_PARAMETER;
- }
-
- /* Send Get Registration Info signal command */
- sendData[0] = (UINT8)(inUserID&0xff);
- sendData[1] = (UINT8)((inUserID>>8)&0xff);
- ret = HVC_SendCommand(HVC_COM_GET_PERSON_DATA, sizeof(UINT8)*2, sendData);
- if ( ret != 0 ) return ret;
-
- /* Receive header */
- ret = HVC_ReceiveHeader(inTimeOutTime, &size, outStatus);
- if ( ret != 0 ) return ret;
-
- if ( size > (INT32)sizeof(UINT8)*2 ) {
- size = sizeof(UINT8)*2;
- }
-
- /* Receive data */
- ret = HVC_ReceiveData(inTimeOutTime, size, recvData);
- *outDataNo = recvData[0] + (recvData[1]<<8);
- return ret;
-}
-
-/*----------------------------------------------------------------------------*/
-/* HVC_SaveAlbum */
-/* param : INT32 inTimeOutTime timeout time (ms) */
-/* : UINT8 *outAlbumData Album data */
-/* : INT32 *outAlbumDataSize Album data size */
-/* : UINT8 *outStatus response code */
-/* return : INT32 execution result error code */
-/* : 0...normal */
-/* : -1...parameter error */
-/* : other...signal error */
-/*----------------------------------------------------------------------------*/
-INT32 HVC_SaveAlbum(INT32 inTimeOutTime, UINT8 *outAlbumData, INT32 *outAlbumDataSize, UINT8 *outStatus)
-{
- INT32 ret = 0;
- INT32 size = 0;
-
- UINT8 *tmpAlbumData = NULL;;
-
- if((NULL == outAlbumData) || (NULL == outAlbumDataSize) || (NULL == outStatus)){
- return HVC_ERROR_PARAMETER;
- }
-
- /* Send Save Album signal command */
- ret = HVC_SendCommand(HVC_COM_SAVE_ALBUM, 0, NULL);
- if ( ret != 0 ) return ret;
-
- ret = HVC_ReceiveHeader(inTimeOutTime, &size, outStatus);
- if ( ret != 0 ) return ret;
-
- if ( size >= (INT32)sizeof(UINT8)*8 + HVC_ALBUM_SIZE_MIN ) {
- *outAlbumDataSize = size;
- tmpAlbumData = outAlbumData;
-
- do{
- ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*4, tmpAlbumData);
- if ( ret != 0 ) return ret;
- tmpAlbumData += sizeof(UINT8)*4;
-
- ret = HVC_ReceiveData(inTimeOutTime, sizeof(UINT8)*4, tmpAlbumData);
- if ( ret != 0 ) return ret;
- tmpAlbumData += sizeof(UINT8)*4;
-
- ret = HVC_ReceiveData(inTimeOutTime, size - sizeof(UINT8)*8, tmpAlbumData);
- if ( ret != 0 ) return ret;
- }while(0);
- }
- return ret;
-}
-
-
-/*----------------------------------------------------------------------------*/
-/* HVC_LoadAlbum */
-/* param : INT32 inTimeOutTime timeout time (ms) */
-/* : UINT8 *inAlbumData Album data */
-/* : INT32 inAlbumDataSize Album data size */
-/* : UINT8 *outStatus response code */
-/* return : INT32 execution result error code */
-/* : 0...normal */
-/* : -1...parameter error */
-/* : other...signal error */
-/*----------------------------------------------------------------------------*/
-INT32 HVC_LoadAlbum(INT32 inTimeOutTime, UINT8 *inAlbumData, INT32 inAlbumDataSize, UINT8 *outStatus)
-{
- INT32 ret = 0;
- INT32 size = 0;
-
- if((NULL == inAlbumData) || (NULL == outStatus)){
- return HVC_ERROR_PARAMETER;
- }
-
- /* Send Save Album signal command */
- ret = HVC_SendCommandOfLoadAlbum(HVC_COM_LOAD_ALBUM, inAlbumDataSize, inAlbumData);
- if ( ret != 0 ) return ret;
-
- /* Receive header */
- ret = HVC_ReceiveHeader(inTimeOutTime, &size, outStatus);
- if ( ret != 0 ) return ret;
-
- return ret;
-}
-
-/*----------------------------------------------------------------------------*/
-/* HVC_WriteAlbum */
-/* param : INT32 inTimeOutTime timeout time (ms) */
-/* : UINT8 *outStatus response code */
-/* return : INT32 execution result error code */
-/* : 0...normal */
-/* : -1...parameter error */
-/* : other...signal error */
-/*----------------------------------------------------------------------------*/
-INT32 HVC_WriteAlbum(INT32 inTimeOutTime, UINT8 *outStatus)
-{
- INT32 ret = 0;
- INT32 size = 0;
-
- if(NULL == outStatus){
- return HVC_ERROR_PARAMETER;
- }
-
- /* Send Write Album signal command */
- ret = HVC_SendCommand(HVC_COM_WRITE_ALBUM, 0, NULL);
- if ( ret != 0 ) return ret;
-
- /* Receive header */
- ret = HVC_ReceiveHeader(inTimeOutTime, &size, outStatus);
- if ( ret != 0 ) return ret;
-
- return ret;
-}
-
--- a/HVCApi/HVCApi.h Tue Aug 08 04:50:44 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,174 +0,0 @@
-/*---------------------------------------------------------------------------*/
-/* Copyright(C) 2017 OMRON Corporation */
-/* */
-/* Licensed under the Apache License, Version 2.0 (the "License"); */
-/* you may not use this file except in compliance with the License. */
-/* You may obtain a copy of the License at */
-/* */
-/* http://www.apache.org/licenses/LICENSE-2.0 */
-/* */
-/* Unless required by applicable law or agreed to in writing, software */
-/* distributed under the License is distributed on an "AS IS" BASIS, */
-/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
-/* See the License for the specific language governing permissions and */
-/* limitations under the License. */
-/*---------------------------------------------------------------------------*/
-
-/*
- HVC Sample API
-*/
-
-#ifndef HVCApi_H__
-#define HVCApi_H__
-
-#ifndef UINT8
-typedef unsigned char UINT8; /* 8 bit Unsigned Integer */
-#endif /* UINT8 */
-#ifndef INT32
-typedef int INT32; /* 32 bit Signed Integer */
-#endif /* INT32 */
-#ifndef NULL
- #define NULL 0
-#endif
-
-#include "HVCDef.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* HVC_GetVersion */
-/* param : INT32 inTimeOutTime timeout time (ms) */
-/* : HVC_VERSION *outVersion version data */
-/* : UINT8 *outStatus response code */
-INT32 HVC_GetVersion(INT32 inTimeOutTime, HVC_VERSION *outVersion, UINT8 *outStatus);
-
-/* HVC_SetCameraAngle */
-/* param : INT32 inTimeOutTime timeout time (ms) */
-/* : INT32 inAngleNo camera angle number */
-/* : UINT8 *outStatus response code */
-INT32 HVC_SetCameraAngle(INT32 inTimeOutTime, INT32 inAngleNo, UINT8 *outStatus);
-
-/* HVC_GetCameraAngle */
-/* param : INT32 inTimeOutTime timeout time (ms) */
-/* : INT32 *outAngleNo camera angle number */
-/* : UINT8 *outStatus response code */
-INT32 HVC_GetCameraAngle(INT32 inTimeOutTime, INT32 *outAngleNo, UINT8 *outStatus);
-
-/* HVC_Execute */
-/* param : INT32 inTimeOutTime timeout time (ms) */
-/* : INT32 inExec executable function */
-/* : INT32 inImage image output number */
-/* : HVC_RESULT *outHVCResult result data */
-/* : UINT8 *outStatus response code */
-INT32 HVC_Execute(INT32 inTimeOutTime, INT32 inExec, INT32 inImage, HVC_RESULT *outHVCResult, UINT8 *outStatus);
-
-/* HVC_ExecuteEx */
-/* param : INT32 inTimeOutTime timeout time (ms) */
-/* : INT32 inExec executable function */
-/* : INT32 inImage image output number */
-/* : HVC_RESULT *outHVCResult result data */
-/* : UINT8 *outStatus response code */
-INT32 HVC_ExecuteEx(INT32 inTimeOutTime, INT32 inExec, INT32 inImage, HVC_RESULT *outHVCResult, UINT8 *outStatus);
-
-/* HVC_SetThreshold */
-/* param : INT32 inTimeOutTime timeout time (ms) */
-/* : HVC_THRESHOLD *inThreshold threshold values */
-/* : UINT8 *outStatus response code */
-INT32 HVC_SetThreshold(INT32 inTimeOutTime, HVC_THRESHOLD *inThreshold, UINT8 *outStatus);
-
-/* HVC_GetThreshold */
-/* param : INT32 inTimeOutTime timeout time (ms) */
-/* : HVC_THRESHOLD *outThreshold threshold values */
-/* : UINT8 *outStatus response code */
-INT32 HVC_GetThreshold(INT32 inTimeOutTime, HVC_THRESHOLD *outThreshold, UINT8 *outStatus);
-
-/* HVC_SetSizeRange */
-/* param : INT32 inTimeOutTime timeout time (ms) */
-/* : HVC_SIZERANGE *inSizeRange detection sizes */
-/* : UINT8 *outStatus response code */
-INT32 HVC_SetSizeRange(INT32 inTimeOutTime, HVC_SIZERANGE *inSizeRange, UINT8 *outStatus);
-
-/* HVC_GetSizeRange */
-/* param : INT32 inTimeOutTime timeout time (ms) */
-/* : HVC_SIZERANGE *outSizeRange detection sizes */
-/* : UINT8 *outStatus response code */
-INT32 HVC_GetSizeRange(INT32 inTimeOutTime, HVC_SIZERANGE *outSizeRange, UINT8 *outStatus);
-
-/* HVC_SetFaceDetectionAngle */
-/* param : INT32 inTimeOutTime timeout time (ms) */
-/* : INT32 inPose Yaw angle range */
-/* : INT32 inAngle Roll angle range */
-/* : UINT8 *outStatus response code */
-INT32 HVC_SetFaceDetectionAngle(INT32 inTimeOutTime, INT32 inPose, INT32 inAngle, UINT8 *outStatus);
-
-/* HVC_GetFaceDetectionAngle */
-/* param : INT32 inTimeOutTime timeout time (ms) */
-/* : INT32 *outPose Yaw angle range */
-/* : INT32 *outAngle Roll angle range */
-/* : UINT8 *outStatus response code */
-INT32 HVC_GetFaceDetectionAngle(INT32 inTimeOutTime, INT32 *outPose, INT32 *outAngle, UINT8 *outStatus);
-
-/* HVC_SetBaudRate */
-/* param : INT32 inTimeOutTime timeout time (ms) */
-/* : INT32 inRate Baudrate */
-/* : UINT8 *outStatus response code */
-INT32 HVC_SetBaudRate(INT32 inTimeOutTime, INT32 inRate, UINT8 *outStatus);
-
-/* HVC_Registration */
-/* param : INT32 inTimeOutTime timeout time (ms) */
-/* : INT32 inUserID User ID (0-499) */
-/* : INT32 inDataID Data ID (0-9) */
-/* : HVC_IMAGE *outImage image info */
-/* : UINT8 *outStatus response code */
-INT32 HVC_Registration(INT32 inTimeOutTime, INT32 inUserID, INT32 inDataID, HVC_IMAGE *outImage, UINT8 *outStatus);
-
-/* HVC_DeleteData */
-/* param : INT32 inTimeOutTime timeout time (ms) */
-/* : INT32 inUserID User ID (0-499) */
-/* : INT32 inDataID Data ID (0-9) */
-/* : UINT8 *outStatus response code */
-INT32 HVC_DeleteData(INT32 inTimeOutTime, INT32 inUserID, INT32 inDataID, UINT8 *outStatus);
-
-/* HVC_DeleteUser */
-/* param : INT32 inTimeOutTime timeout time (ms) */
-/* : INT32 inUserID User ID (0-499) */
-/* : UINT8 *outStatus response code */
-INT32 HVC_DeleteUser(INT32 inTimeOutTime, INT32 inUserID, UINT8 *outStatus);
-
-/* HVC_DeleteAll */
-/* param : INT32 inTimeOutTime timeout time (ms) */
-/* : UINT8 *outStatus response code */
-INT32 HVC_DeleteAll(INT32 inTimeOutTime, UINT8 *outStatus);
-
-/* HVC_GetUserData */
-/* param : INT32 inTimeOutTime timeout time (ms) */
-/* : INT32 inUserID User ID (0-499) */
-/* : INT32 *outDataNo Registration Info */
-/* : UINT8 *outStatus response code */
-INT32 HVC_GetUserData(INT32 inTimeOutTime, INT32 inUserID, INT32 *outDataNo, UINT8 *outStatus);
-
-/* HVC_SaveAlbum */
-/* param : INT32 inTimeOutTime timeout time (ms) */
-/* : UINT8 *outAlbumData Album data */
-/* : INT32 *outAlbumDataSize Album data size */
-/* : UINT8 *outStatus response code */
-INT32 HVC_SaveAlbum(INT32 inTimeOutTime, UINT8 *outAlbumData, INT32 *outAlbumDataSize, UINT8 *outStatus);
-
-/* HVC_LoadAlbum */
-/* param : INT32 inTimeOutTime timeout time (ms) */
-/* : UINT8 *inAlbumData Album data */
-/* : INT32 inAlbumDataSize Album data size */
-/* : UINT8 *outStatus response code */
-INT32 HVC_LoadAlbum(INT32 inTimeOutTime, UINT8 *inAlbumData, INT32 inAlbumDataSize, UINT8 *outStatus);
-
-/* HVC_WriteAlbum */
-/* param : INT32 inTimeOutTime timeout time (ms) */
-/* : UINT8 *outStatus response code */
-INT32 HVC_WriteAlbum(INT32 inTimeOutTime, UINT8 *outStatus);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* HVCApi_H__ */
--- a/HVCApi/HVCDef.h Tue Aug 08 04:50:44 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,234 +0,0 @@
-/*---------------------------------------------------------------------------*/
-/* Copyright(C) 2017 OMRON Corporation */
-/* */
-/* Licensed under the Apache License, Version 2.0 (the "License"); */
-/* you may not use this file except in compliance with the License. */
-/* You may obtain a copy of the License at */
-/* */
-/* http://www.apache.org/licenses/LICENSE-2.0 */
-/* */
-/* Unless required by applicable law or agreed to in writing, software */
-/* distributed under the License is distributed on an "AS IS" BASIS, */
-/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
-/* See the License for the specific language governing permissions and */
-/* limitations under the License. */
-/*---------------------------------------------------------------------------*/
-
-#ifndef HVCDef_H__
-#define HVCDef_H__
-
-/*----------------------------------------------------------------------------*/
-/* Execution flag */
-#define HVC_ACTIV_BODY_DETECTION 0x00000001
-#define HVC_ACTIV_HAND_DETECTION 0x00000002
-#define HVC_ACTIV_FACE_DETECTION 0x00000004
-#define HVC_ACTIV_FACE_DIRECTION 0x00000008
-#define HVC_ACTIV_AGE_ESTIMATION 0x00000010
-#define HVC_ACTIV_GENDER_ESTIMATION 0x00000020
-#define HVC_ACTIV_GAZE_ESTIMATION 0x00000040
-#define HVC_ACTIV_BLINK_ESTIMATION 0x00000080
-#define HVC_ACTIV_EXPRESSION_ESTIMATION 0x00000100
-#define HVC_ACTIV_FACE_RECOGNITION 0x00000200
-
-/* Image info of Execute command */
-#define HVC_EXECUTE_IMAGE_NONE 0x00000000
-#define HVC_EXECUTE_IMAGE_QVGA 0x00000001
-#define HVC_EXECUTE_IMAGE_QVGA_HALF 0x00000002
-
-/*----------------------------------------------------------------------------*/
-/* Error code */
-
-/* Parameter error */
-#define HVC_ERROR_PARAMETER -1
-
-/* Send signal timeout error */
-#define HVC_ERROR_SEND_DATA -10
-
-/* Receive header signal timeout error */
-#define HVC_ERROR_HEADER_TIMEOUT -20
-/* Invalid header error */
-#define HVC_ERROR_HEADER_INVALID -21
-/* Receive data signal timeout error */
-#define HVC_ERROR_DATA_TIMEOUT -22
-
-
-/*----------------------------------------------------------------------------*/
-/* Album data size */
-#define HVC_ALBUM_SIZE_MIN 32
-#define HVC_ALBUM_SIZE_MAX 816032
-
-/*----------------------------------------------------------------------------*/
-/* Expression */
-typedef enum {
- EX_NEUTRAL = 1,
- EX_HAPPINESS,
- EX_SURPRISE,
- EX_ANGER,
- EX_SADNESS
-}EXPRESSION;
-
-/*----------------------------------------------------------------------------*/
-/* Struct */
-/*----------------------------------------------------------------------------*/
-/*----------------------------------------------------------------------------*/
-/* Devicefs model and version info */
-/*----------------------------------------------------------------------------*/
-typedef struct {
- UINT8 string[12];
- UINT8 major;
- UINT8 minor;
- UINT8 relese;
- UINT8 revision[4];
-}HVC_VERSION;
-
-/*----------------------------------------------------------------------------*/
-/* Detection result */
-/*----------------------------------------------------------------------------*/
-typedef struct{
- INT32 posX; /* Center x-coordinate */
- INT32 posY; /* Center y-coordinate */
- INT32 size; /* Size */
- INT32 confidence; /* Degree of confidence */
-}DETECT_RESULT;
-
-/*----------------------------------------------------------------------------*/
-/* Face direction */
-/*----------------------------------------------------------------------------*/
-typedef struct{
- INT32 yaw; /* Yaw angle */
- INT32 pitch; /* Pitch angle */
- INT32 roll; /* Roll angle */
- INT32 confidence; /* Degree of confidence */
-}DIR_RESULT;
-
-/*----------------------------------------------------------------------------*/
-/* Age */
-/*----------------------------------------------------------------------------*/
-typedef struct{
- INT32 age; /* Age */
- INT32 confidence; /* Degree of confidence */
-}AGE_RESULT;
-
-/*----------------------------------------------------------------------------*/
-/* Gender */
-/*----------------------------------------------------------------------------*/
-typedef struct{
- INT32 gender; /* Gender */
- INT32 confidence; /* Degree of confidence */
-}GENDER_RESULT;
-
-/*----------------------------------------------------------------------------*/
-/* Gaze */
-/*----------------------------------------------------------------------------*/
-typedef struct{
- INT32 gazeLR; /* Yaw angle */
- INT32 gazeUD; /* Pitch angle */
-}GAZE_RESULT;
-
-/*----------------------------------------------------------------------------*/
-/* Blink */
-/*----------------------------------------------------------------------------*/
-typedef struct{
- INT32 ratioL; /* Left eye blink result */
- INT32 ratioR; /* Right eye blink result */
-}BLINK_RESULT;
-
-/*----------------------------------------------------------------------------*/
-/* Expression */
-/*----------------------------------------------------------------------------*/
-typedef struct{
- INT32 topExpression; /* Top expression */
- INT32 topScore; /* Top score */
- INT32 score[5]; /* Score of 5 expression */
- INT32 degree; /* Negative-positive degree */
-}EXPRESSION_RESULT;
-
-/*----------------------------------------------------------------------------*/
-/* Face Recognition */
-/*----------------------------------------------------------------------------*/
-typedef struct{
- INT32 uid; /* User ID */
- INT32 confidence; /* Degree of confidence */
-}RECOGNITION_RESULT;
-
-/*----------------------------------------------------------------------------*/
-/* Face Detection & Estimations result */
-/*----------------------------------------------------------------------------*/
-typedef struct{
- DETECT_RESULT dtResult; /* Face detection result */
- DIR_RESULT dirResult; /* Face direction estimation result */
- AGE_RESULT ageResult; /* Age Estimation result */
- GENDER_RESULT genderResult; /* Gender Estimation result */
- GAZE_RESULT gazeResult; /* Gaze Estimation result */
- BLINK_RESULT blinkResult; /* Blink Estimation result */
- EXPRESSION_RESULT expressionResult; /* Expression Estimation result */
- RECOGNITION_RESULT recognitionResult; /* Face Recognition result */
-}FACE_RESULT;
-
-/*----------------------------------------------------------------------------*/
-/* Human Body Detection results */
-/*----------------------------------------------------------------------------*/
-typedef struct{
- UINT8 num; /* Number of Detection */
- DETECT_RESULT bdResult[35]; /* Detection result */
-}BD_RESULT;
-
-/*----------------------------------------------------------------------------*/
-/* Hand Detection results */
-/*----------------------------------------------------------------------------*/
-typedef struct{
- UINT8 num; /* Number of Detection */
- DETECT_RESULT hdResult[35]; /* Detection result */
-}HD_RESULT;
-
-/*----------------------------------------------------------------------------*/
-/* Face Detection & Estimations results */
-/*----------------------------------------------------------------------------*/
-typedef struct{
- UINT8 num; /* Number of Detection */
- FACE_RESULT fcResult[35]; /* Detection & Estimations result */
-}FD_RESULT;
-
-/*----------------------------------------------------------------------------*/
-/* Image data */
-/*----------------------------------------------------------------------------*/
-typedef struct{
- INT32 width;
- INT32 height;
- UINT8 image[320*240];
-}HVC_IMAGE;
-
-/*----------------------------------------------------------------------------*/
-/* Eesult data of Execute command */
-/*----------------------------------------------------------------------------*/
-typedef struct{
- INT32 executedFunc; /* Execution flag */
- BD_RESULT bdResult; /* Human Body Detection results */
- HD_RESULT hdResult; /* Hand Detection results */
- FD_RESULT fdResult; /* Face Detection & Estimations results */
- HVC_IMAGE image; /* Image data */
-}HVC_RESULT;
-
-/*----------------------------------------------------------------------------*/
-/* Threshold of confidence */
-/*----------------------------------------------------------------------------*/
-typedef struct{
- INT32 bdThreshold; /* Threshold of confidence of Human Body Detection */
- INT32 hdThreshold; /* Threshold of confidence of Hand Detection */
- INT32 dtThreshold; /* Threshold of confidence of Face Detection */
- INT32 rsThreshold; /* Threshold of confidence of Face Recognition */
-}HVC_THRESHOLD;
-
-/*----------------------------------------------------------------------------*/
-/* Detection size */
-/*----------------------------------------------------------------------------*/
-typedef struct{
- INT32 bdMinSize; /* Minimum detection size of Human Body Detection */
- INT32 bdMaxSize; /* Maximum detection size of Human Body Detection */
- INT32 hdMinSize; /* Minimum detection size of Hand Detection */
- INT32 hdMaxSize; /* Maximum detection size of Hand Detection */
- INT32 dtMinSize; /* Minimum detection size of Face Detection */
- INT32 dtMaxSize; /* Maximum detection size of Face Detection */
-}HVC_SIZERANGE;
-
-#endif /* HVCDef_H__ */
--- a/HVCApi/HVCExtraUartFunc.h Tue Aug 08 04:50:44 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*---------------------------------------------------------------------------*/
-/* Copyright(C) 2017 OMRON Corporation */
-/* */
-/* Licensed under the Apache License, Version 2.0 (the "License"); */
-/* you may not use this file except in compliance with the License. */
-/* You may obtain a copy of the License at */
-/* */
-/* http://www.apache.org/licenses/LICENSE-2.0 */
-/* */
-/* Unless required by applicable law or agreed to in writing, software */
-/* distributed under the License is distributed on an "AS IS" BASIS, */
-/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
-/* See the License for the specific language governing permissions and */
-/* limitations under the License. */
-/*---------------------------------------------------------------------------*/
-
-/*
- External UART-function definition
-*/
-
-#ifndef HVCExtraUartFunc_H__
-#define HVCExtraUartFunc_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*----------------------------------------------------------------------------*/
-/* UART send signal */
-/* param : int inDataSize send signal data */
-/* : UINT8 *inData data length */
-/* return : int send signal complete data number */
-/*----------------------------------------------------------------------------*/
-extern int UART_SendData(int inDataSize, UINT8 *inData);
-
-/*----------------------------------------------------------------------------*/
-/* UART receive signal */
-/* param : int inTimeOutTime timeout time (ms) */
-/* : int *inDataSize receive signal data size */
-/* : UINT8 *outResult receive signal data */
-/* return : int receive signal complete data number */
-/*----------------------------------------------------------------------------*/
-extern int UART_ReceiveData(int inTimeOutTime, int inDataSize, UINT8 *outResult);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* HVCExtraUartFunc_H__ */
--- a/main.cpp Tue Aug 08 04:50:44 2017 +0000 +++ b/main.cpp Tue Sep 05 10:01:51 2017 +0000 @@ -9,7 +9,7 @@ static DigitalOut lcd_pwon(P7_15); static DigitalOut lcd_blon(P8_1); static PwmOut lcd_cntrst(P8_15); -static Thread recognitionTask; +static Thread recognitionTask(osPriorityNormal, 1024 * 8); static Thread touchTask; /****** LCD ******/
--- a/recognition_proc/recognition_proc.cpp Tue Aug 08 04:50:44 2017 +0000
+++ b/recognition_proc/recognition_proc.cpp Tue Sep 05 10:01:51 2017 +0000
@@ -5,6 +5,7 @@
#include "USBHostSerial.h"
#include "LCD_shield_config_4_3inch.h"
#include "recognition_proc.h"
+#include "STBWrap.h"
#define UART_SETTING_TIMEOUT 1000 /* HVC setting command signal timeout period */
#define UART_REGIST_EXECUTE_TIMEOUT 7000 /* HVC registration command signal timeout period */
@@ -15,6 +16,16 @@
#define ERROR_02 "Error: Number of detected faces is 2 or more"
+#define STB_RETRYCOUNT_DEFAULT 25 /* Retry Count for STB */
+#define STB_POSSTEADINESS_DEFAULT 30 /* Position Steadiness for STB */
+#define STB_SIZESTEADINESS_DEFAULT 30 /* Size Steadiness for STB */
+#define STB_PE_FRAME_DEFAULT 10 /* Complete Frame Count for property estimation in STB */
+#define STB_PE_ANGLEUDMIN_DEFAULT -15 /* Up/Down face angle minimum value for property estimation in STB */
+#define STB_PE_ANGLEUDMAX_DEFAULT 20 /* Up/Down face angle maximum value for property estimation in STB */
+#define STB_PE_ANGLELRMIN_DEFAULT -20 /* Left/Right face angle minimum value for property estimation in STB */
+#define STB_PE_ANGLELRMAX_DEFAULT 20 /* Left/Right face angle maximum value for property estimation in STB */
+#define STB_PE_THRESHOLD_DEFAULT 300 /* Threshold for property estimation in STB */
+
#define DISP_PIXEL_WIDTH (320)
#define DISP_PIXEL_HEIGHT (240)
@@ -272,6 +283,13 @@
UINT8 status;
HVC_VERSION version;
HVC_RESULT *pHVCResult = NULL;
+
+ int nSTBFaceCount;
+ STB_FACE *pSTBFaceResult;
+ int nSTBBodyCount;
+ STB_BODY *pSTBBodyResult;
+ int nIndex;
+
HVC_IMAGE *pImage = NULL;
INT32 execFlag;
INT32 imageNo;
@@ -282,6 +300,7 @@
uint32_t i;
char Str_disp[32];
Timer resp_time;
+ INT32 TrackingID;
/* Register the button */
button.fall(&button_fall);
@@ -298,6 +317,13 @@
mbed_die();
}
+ /* STB Initialize */
+ ret = STB_Init(STB_FUNC_BD | STB_FUNC_DT | STB_FUNC_PT | STB_FUNC_AG | STB_FUNC_GN);
+ if (ret != 0) {
+ printf("STB_Init Error : %d\n", ret);
+ mbed_die();
+ }
+
/* Image Structure allocation */
pImage = (HVC_IMAGE *)malloc(sizeof(HVC_IMAGE));
if (pImage == NULL) {
@@ -364,6 +390,17 @@
if ((ret != 0) || (status != 0)) {
break;
}
+
+ /* Set STB Parameters */
+ ret = STB_SetTrParam(STB_RETRYCOUNT_DEFAULT, STB_POSSTEADINESS_DEFAULT, STB_SIZESTEADINESS_DEFAULT);
+ if (ret != 0) {
+ break;
+ }
+ ret = STB_SetPeParam(STB_PE_THRESHOLD_DEFAULT, STB_PE_ANGLEUDMIN_DEFAULT, STB_PE_ANGLEUDMAX_DEFAULT,
+ STB_PE_ANGLELRMIN_DEFAULT, STB_PE_ANGLELRMAX_DEFAULT, STB_PE_FRAME_DEFAULT);
+ if (ret != 0) {
+ break;
+ }
}
/* Execute Registration */
@@ -407,11 +444,52 @@
if ((execFlag & HVC_ACTIV_FACE_DETECTION) == 0) {
execFlag &= ~(HVC_ACTIV_AGE_ESTIMATION | HVC_ACTIV_GENDER_ESTIMATION | HVC_ACTIV_EXPRESSION_ESTIMATION);
}
+ if (execFlag != 0) { // for STB
+ execFlag |= HVC_ACTIV_FACE_DIRECTION;
+ }
imageNo = imageNo_setting;
resp_time.reset();
resp_time.start();
ret = HVC_ExecuteEx(UART_EXECUTE_TIMEOUT, execFlag, imageNo, pHVCResult, &status);
resp_time.stop();
+
+ /* STB */
+ if (STB_Exec(pHVCResult->executedFunc, pHVCResult, &nSTBFaceCount, &pSTBFaceResult, &nSTBBodyCount, &pSTBBodyResult) == 0) {
+ for ( i = 0; i < nSTBBodyCount; i++ )
+ {
+ if ( pHVCResult->bdResult.num <= i ) break;
+
+ nIndex = pSTBBodyResult[i].nDetectID;
+ pHVCResult->bdResult.bdResult[nIndex].posX = (short)pSTBBodyResult[i].center.x;
+ pHVCResult->bdResult.bdResult[nIndex].posY = (short)pSTBBodyResult[i].center.y;
+ pHVCResult->bdResult.bdResult[nIndex].size = pSTBBodyResult[i].nSize;
+ }
+ for (i = 0; i < nSTBFaceCount; i++)
+ {
+ if (pHVCResult->fdResult.num <= i) break;
+
+ nIndex = pSTBFaceResult[i].nDetectID;
+ pHVCResult->fdResult.fcResult[nIndex].dtResult.posX = (short)pSTBFaceResult[i].center.x;
+ pHVCResult->fdResult.fcResult[nIndex].dtResult.posY = (short)pSTBFaceResult[i].center.y;
+ pHVCResult->fdResult.fcResult[nIndex].dtResult.size = pSTBFaceResult[i].nSize;
+
+ if (pHVCResult->executedFunc & HVC_ACTIV_AGE_ESTIMATION) {
+ pHVCResult->fdResult.fcResult[nIndex].ageResult.confidence += 10000; // During
+ if (pSTBFaceResult[i].age.status >= STB_STATUS_COMPLETE) {
+ pHVCResult->fdResult.fcResult[nIndex].ageResult.age = pSTBFaceResult[i].age.value;
+ pHVCResult->fdResult.fcResult[nIndex].ageResult.confidence += 10000; // Complete
+ }
+ }
+ if (pHVCResult->executedFunc & HVC_ACTIV_GENDER_ESTIMATION) {
+ pHVCResult->fdResult.fcResult[nIndex].genderResult.confidence += 10000; // During
+ if (pSTBFaceResult[i].gender.status >= STB_STATUS_COMPLETE) {
+ pHVCResult->fdResult.fcResult[nIndex].genderResult.gender = pSTBFaceResult[i].gender.value;
+ pHVCResult->fdResult.fcResult[nIndex].genderResult.confidence += 10000; // Complete
+ }
+ }
+ }
+ }
+
if ((ret == 0) && (status == 0)) {
if (imageNo == HVC_EXECUTE_IMAGE_QVGA_HALF) {
DrawImage(0, 0, pHVCResult->image.width, pHVCResult->image.height, pHVCResult->image.image, 2);
@@ -452,34 +530,53 @@
pHVCResult->fdResult.fcResult[i].dtResult.size,
detection_colour);
}
+ TrackingID = 0;
+ for (int j = 0; j < nSTBFaceCount; j++)
+ {
+ if (pSTBFaceResult[j].nDetectID == i) {
+ TrackingID = pSTBFaceResult[j].nTrackingID;
+ break;
+ }
+ }
+ memset(Str_disp, 0, sizeof(Str_disp));
if (pHVCResult->executedFunc & HVC_ACTIV_FACE_RECOGNITION) {
/* Recognition */
- if (-128 == pHVCResult->fdResult.fcResult[i].recognitionResult.uid) {
- DrawString("Not possible", 0x0000f0ff);
- } else if (pHVCResult->fdResult.fcResult[i].recognitionResult.uid < 0) {
- DrawString("Not registered", 0x0000f0ff);
+ if (pHVCResult->fdResult.fcResult[i].recognitionResult.uid < 0) {
+ sprintf(Str_disp, "ID:%d", TrackingID);
} else {
- memset(Str_disp, 0, sizeof(Str_disp));
sprintf(Str_disp, "USER%03d", pHVCResult->fdResult.fcResult[i].recognitionResult.uid + 1);
- DrawString(Str_disp, 0x0000f0ff);
}
+ } else {
+ sprintf(Str_disp, "ID:%d", TrackingID);
}
+ DrawString(Str_disp, 0x0000f0ff);
if (pHVCResult->executedFunc & HVC_ACTIV_AGE_ESTIMATION) {
/* Age */
if (-128 != pHVCResult->fdResult.fcResult[i].ageResult.age) {
memset(Str_disp, 0, sizeof(Str_disp));
sprintf(Str_disp, "Age:%d", pHVCResult->fdResult.fcResult[i].ageResult.age);
+ if (pHVCResult->fdResult.fcResult[i].ageResult.confidence < 20000) {
+ strcat(Str_disp, " (?)");
+ }
DrawString(Str_disp, 0x0000f0ff);
}
}
if (pHVCResult->executedFunc & HVC_ACTIV_GENDER_ESTIMATION) {
/* Gender */
if (-128 != pHVCResult->fdResult.fcResult[i].genderResult.gender) {
+ uint32_t wk_color;
+ memset(Str_disp, 0, sizeof(Str_disp));
if (1 == pHVCResult->fdResult.fcResult[i].genderResult.gender) {
- DrawString("Male", 0x0000fff4);
+ sprintf(Str_disp, "Male");
+ wk_color = 0x0000fff4;
} else {
- DrawString("Female", 0x00006dff);
+ sprintf(Str_disp, "Female");
+ wk_color = 0x00006dff;
}
+ if ( pHVCResult->fdResult.fcResult[i].genderResult.confidence < 20000 ) {
+ strcat(Str_disp, " (?)");
+ }
+ DrawString(Str_disp, wk_color);
}
}
if (pHVCResult->executedFunc & HVC_ACTIV_EXPRESSION_ESTIMATION) {