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

Dependencies:   AsciiFont

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers STBMakeResult.c Source File

STBMakeResult.c

00001 /*---------------------------------------------------------------------------*/
00002 /* Copyright(C)  2017  OMRON Corporation                                     */
00003 /*                                                                           */
00004 /* Licensed under the Apache License, Version 2.0 (the "License");           */
00005 /* you may not use this file except in compliance with the License.          */
00006 /* You may obtain a copy of the License at                                   */
00007 /*                                                                           */
00008 /*     http://www.apache.org/licenses/LICENSE-2.0                            */
00009 /*                                                                           */
00010 /* Unless required by applicable law or agreed to in writing, software       */
00011 /* distributed under the License is distributed on an "AS IS" BASIS,         */
00012 /* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  */
00013 /* See the License for the specific language governing permissions and       */
00014 /* limitations under the License.                                            */
00015 /*---------------------------------------------------------------------------*/
00016 
00017 #include "STBMakeResult.h"
00018 
00019 
00020 /*------------------------------------------------------------------------------------------------------------------*/
00021 /* SetFaceToResult                                                                                                    */
00022 /*------------------------------------------------------------------------------------------------------------------*/
00023 VOID SetFaceToResult ( STB_INT32 TraCnt , TraObj* trObj , FaceObj* faceObj, STB_FACE* result, const STBExecFlg* execFlg )
00024 {
00025     STB_INT32 i,j;
00026     STB_INT32 tmpFlg;
00027     
00028     tmpFlg =    execFlg->gen        
00029             ||    execFlg->age    
00030             ||    execFlg->fr        
00031             ||    execFlg->exp        
00032             ||    execFlg->dir        
00033             ||    execFlg->gaz    
00034             ||    execFlg->bli    ;
00035 
00036 
00037     for( i = 0; i < TraCnt; i++)
00038     {
00039         result[i].nDetectID        = trObj[i].nDetID    ;
00040         result[i].nTrackingID    = trObj[i].nTraID    ;
00041         result[i].center.x        = trObj[i].pos    .x    ;
00042         result[i].center.y        = trObj[i].pos    .y    ;
00043         result[i].nSize            = trObj[i].size        ;
00044         result[i].conf            = trObj[i].conf        ;
00045 
00046         if(    tmpFlg    )
00047         {
00048             for( j = 0; j < TraCnt; j++)
00049             {
00050                 if( trObj[i].nTraID == faceObj[j].nTraID )
00051                 {
00052                     if(    execFlg->age    == STB_TRUE )
00053                     {
00054                         result[i].age.status            = faceObj[j].ageStatus            ;
00055                         result[i].age.value                = faceObj[j].ageVal                ;
00056                         result[i].age.conf                = faceObj[j].ageConf    ;
00057                     }
00058                     if(    execFlg->bli    == STB_TRUE )
00059                     {
00060                         result[i].blink.ratioL            = faceObj[j].bliL                ;
00061                         result[i].blink.ratioR            = faceObj[j].bliR                ;
00062                         result[i].blink.status            = faceObj[j].bliStatus            ;
00063                     }
00064                     if(    execFlg->dir    == STB_TRUE )
00065                     {
00066                         result[i].direction.pitch        = faceObj[j].dirPitch            ;
00067                         result[i].direction.roll        = faceObj[j].dirRoll            ;
00068                         result[i].direction.yaw            = faceObj[j].dirYaw                ;
00069                         result[i].direction.status        = faceObj[j].dirStatus            ;
00070                         result[i].direction.conf        = faceObj[j].dirConf    ;
00071                     }
00072                     if(    execFlg->exp    == STB_TRUE )
00073                     {
00074                         result[i].expression.status        = faceObj[j].expStatus            ;
00075                         result[i].expression.value        = faceObj[j].expVal                ;
00076                         result[i].expression.conf        = faceObj[j].expConf    ;
00077                     }
00078                     if(    execFlg->gaz    == STB_TRUE )
00079                     {
00080                         result[i].gaze.status            = faceObj[j].gazStatus            ;
00081                         result[i].gaze.LR                = faceObj[j].gazLR                ;
00082                         result[i].gaze.UD                = faceObj[j].gazUD                ;
00083                         result[i].gaze.conf                = faceObj[j].gazConf    ;
00084                     }
00085                     if(    execFlg->gen    == STB_TRUE )
00086                     {
00087                         result[i].gender.status            = faceObj[j].genStatus            ;
00088                         result[i].gender.value            = faceObj[j].genVal                ;
00089                         result[i].gender.conf            = faceObj[j].genConf    ;
00090                     }
00091                     if(    execFlg->fr        == STB_TRUE )
00092                     {
00093                         result[i].recognition.status    = faceObj[j].frStatus            ;
00094                         result[i].recognition.value        = faceObj[j].frVal                ;
00095                         result[i].recognition.conf        = faceObj[j].frConf    ;
00096                     }
00097                     break;
00098                 }//if( trObj[i].nTraID == faceObj[j].nTraID )
00099             }//for( j = 0; j < TraCnt; j++)
00100         }//if(    tmpFlg    )
00101     }//for( i = 0; i < TraCnt; i++)
00102 }
00103 /*------------------------------------------------------------------------------------------------------------------*/
00104 /* SetBodyToResult                                                                                                    */
00105 /*------------------------------------------------------------------------------------------------------------------*/
00106 VOID SetBodyToResult(STB_INT32 TraCnt,TraObj* trObj, STB_BODY* result)
00107 {
00108     STB_INT32 i;
00109     for( i = 0; i < TraCnt; i++)
00110     {
00111         result[i].nDetectID   = trObj[i].nDetID    ;
00112         result[i].nTrackingID = trObj[i].nTraID    ;
00113         result[i].center.x    = trObj[i].pos.x    ;
00114         result[i].center.y    = trObj[i].pos.y    ;
00115         result[i].nSize       = trObj[i].size    ;
00116         result[i].conf        = trObj[i].conf    ;
00117     }
00118     
00119 }