Mar. 14. 2018

Dependencies:   GraphicsFramework GR-PEACH_video LCD_shield_config AsciiFont R_BSP USBHost_custom

Revision:
6:8c0c70710090
Parent:
5:49a61433290a
--- a/recognition_proc/recognition_proc.cpp	Tue Sep 05 10:01:51 2017 +0000
+++ b/recognition_proc/recognition_proc.cpp	Wed Sep 06 01:30:17 2017 +0000
@@ -16,16 +16,6 @@
 
 #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)
 
@@ -460,31 +450,35 @@
                         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;
+                        if (nIndex >= 0) {
+                            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 (nIndex >= 0) {
+                            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_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 (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
+                                }
                             }
                         }
                     }