Sample to operate omron HVC-P2 on GR-PEACH.
Dependencies: AsciiFont
TrInterface.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 "TrInterface.h" 00018 #include "STBTrAPI.h" 00019 /*Value range check*/ 00020 #define ISVALID_RANGE( val , min , max ) ( ( (min) <= (val) ) && ( (val) <= (max) ) ) 00021 00022 /*--------------------------------------------------------------------- 00023 ---------------------------------------------------------------------*/ 00024 /*error check*/ 00025 /*--------------------------------------------------------------------- 00026 ---------------------------------------------------------------------*/ 00027 static STB_INT32 TrIsValidValue( 00028 const STB_INT32 nValue , 00029 const STB_INT32 nLimitMin , 00030 const STB_INT32 nLimitMax ) 00031 { 00032 STB_INT32 nRet; 00033 for( nRet = STB_ERR_INVALIDPARAM; nRet != STB_NORMAL; nRet = STB_NORMAL ){ 00034 if( ! ISVALID_RANGE( nValue , nLimitMin , nLimitMax ) ){ break; } 00035 } 00036 return nRet; 00037 } 00038 /*--------------------------------------------------------------------- 00039 ---------------------------------------------------------------------*/ 00040 static STB_INT32 TrIsValidPointer( const VOID* pPointer ) 00041 { 00042 STB_INT32 nRet; 00043 for( nRet = STB_ERR_INVALIDPARAM; nRet != STB_NORMAL; nRet = STB_NORMAL ){ 00044 if( NULL == pPointer ){ break; } 00045 } 00046 return nRet; 00047 } 00048 00049 /*------------------------------------------------------------------------------------------------------------------*/ 00050 /* TrCalcTrSize */ 00051 /*------------------------------------------------------------------------------------------------------------------*/ 00052 STB_UINT32 TrCalcTrSize ( const STBExecFlg *execFlg , STB_UINT32 nTraCntMax , STB_UINT32 nDetCntMax ) 00053 { 00054 STB_UINT32 retVal ; 00055 00056 retVal = 0 ; 00057 00058 retVal += 100 ;///Margin : alignment 00059 00060 00061 retVal += sizeof( STB_TR_DET ); // stbTrDet 00062 00063 if( execFlg->bodyTr == STB_TRUE ) 00064 { 00065 retVal += sizeof( ROI_SYS ) * STB_TR_BACK_MAX ;// bdRec 00066 retVal += sizeof( STB_INT32 ) * STB_TR_BACK_MAX * nTraCntMax ;// bdRec[t].nDetID 00067 retVal += sizeof( STB_INT32 ) * STB_TR_BACK_MAX * nTraCntMax ;// bdRec[t].nTraID 00068 retVal += sizeof( STB_INT32 ) * STB_TR_BACK_MAX * nTraCntMax ;// bdRec[t].posX 00069 retVal += sizeof( STB_INT32 ) * STB_TR_BACK_MAX * nTraCntMax ;// bdRec[t].posY 00070 retVal += sizeof( STB_INT32 ) * STB_TR_BACK_MAX * nTraCntMax ;// bdRec[t].size 00071 retVal += sizeof( STB_INT32 ) * STB_TR_BACK_MAX * nTraCntMax ;// bdRec[t].conf 00072 retVal += sizeof( STB_INT32 ) * STB_TR_BACK_MAX * nTraCntMax ;// bdRec[t].retryN 00073 retVal += sizeof( ROI_DET ) * nDetCntMax ;// stbTrDet->bdDet 00074 retVal += sizeof( STB_TR_RES_BODYS) ;// resBodys 00075 retVal += sizeof( STB_TR_RES ) * nTraCntMax ;// resBodys->body 00076 } 00077 if( execFlg->faceTr == STB_TRUE ) 00078 { 00079 retVal += sizeof( ROI_SYS ) * STB_TR_BACK_MAX ;// fcRec 00080 retVal += sizeof( STB_INT32 ) * STB_TR_BACK_MAX * nTraCntMax ;// fcRec[t].nDetID 00081 retVal += sizeof( STB_INT32 ) * STB_TR_BACK_MAX * nTraCntMax ;// fcRec[t].nTraID 00082 retVal += sizeof( STB_INT32 ) * STB_TR_BACK_MAX * nTraCntMax ;// fcRec[t].posX 00083 retVal += sizeof( STB_INT32 ) * STB_TR_BACK_MAX * nTraCntMax ;// fcRec[t].posY 00084 retVal += sizeof( STB_INT32 ) * STB_TR_BACK_MAX * nTraCntMax ;// fcRec[t].size 00085 retVal += sizeof( STB_INT32 ) * STB_TR_BACK_MAX * nTraCntMax ;// fcRec[t].conf 00086 retVal += sizeof( STB_INT32 ) * STB_TR_BACK_MAX * nTraCntMax ;// fcRec[t].retryN 00087 retVal += sizeof( ROI_DET ) * nDetCntMax ;// stbTrDet->fcDet 00088 retVal += sizeof( STB_TR_RES_FACES) ;// resFaces 00089 retVal += sizeof( STB_TR_RES ) * nTraCntMax ;// resFaces->face 00090 } 00091 00092 retVal += sizeof( STB_INT32 ) * nTraCntMax ; // wIdPreCur 00093 retVal += sizeof( STB_INT32 ) * nTraCntMax ; // wIdCurPre 00094 retVal += sizeof( STB_INT32 ) * nTraCntMax * nTraCntMax ; // wDstTbl 00095 retVal += sizeof( STBExecFlg ) ; // execFlg 00096 00097 retVal += ( sizeof( ROI_SYS ) );//wRoi 00098 retVal += ( sizeof( STB_INT32 ) * nTraCntMax );//wRoi->nDetID 00099 retVal += ( sizeof( STB_INT32 ) * nTraCntMax );//wRoi->nTraID 00100 retVal += ( sizeof( STB_INT32 ) * nTraCntMax );//wRoi->posX 00101 retVal += ( sizeof( STB_INT32 ) * nTraCntMax );//wRoi->posY 00102 retVal += ( sizeof( STB_INT32 ) * nTraCntMax );//wRoi->size 00103 retVal += ( sizeof( STB_INT32 ) * nTraCntMax );//wRoi->conf 00104 retVal += ( sizeof( STB_INT32 ) * nTraCntMax );//wRoi->retryN 00105 00106 return retVal; 00107 } 00108 /*------------------------------------------------------------------------------------------------------------------*/ 00109 /* ShareTrSize */ 00110 /*------------------------------------------------------------------------------------------------------------------*/ 00111 void ShareTrSize ( TRHANDLE handle , const STBExecFlg* execFlg ) 00112 { 00113 STB_UINT32 t ; 00114 STB_UINT32 nTraCntMax = handle->traCntMax ; 00115 STB_UINT32 nDetCntMax = handle->detCntMax ; 00116 STB_INT8 *stbPtr = handle->trPtr ; 00117 00118 00119 00120 handle->stbTrDet = ( STB_TR_DET*) stbPtr; stbPtr += ( sizeof( STB_TR_DET ) ); 00121 00122 if( execFlg->bodyTr == STB_TRUE ) 00123 { 00124 handle->bdRec = ( ROI_SYS* ) stbPtr; stbPtr += ( sizeof( ROI_SYS ) * STB_TR_BACK_MAX); 00125 for( t = 0 ; t < STB_TR_BACK_MAX ; t++ ) 00126 { 00127 handle->bdRec[t].nDetID = ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax ); 00128 handle->bdRec[t].nTraID = ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax ); 00129 handle->bdRec[t].posX = ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax ); 00130 handle->bdRec[t].posY = ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax ); 00131 handle->bdRec[t].size = ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax ); 00132 handle->bdRec[t].conf = ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax ); 00133 handle->bdRec[t].retryN = ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax ); 00134 } 00135 handle->stbTrDet->bdDet = ( ROI_DET* ) stbPtr; stbPtr += ( sizeof( ROI_DET ) * nDetCntMax ); 00136 handle->resBodys = ( STB_TR_RES_BODYS* ) stbPtr; stbPtr += ( sizeof( STB_TR_RES_BODYS ) ); 00137 handle->resBodys->body = ( STB_TR_RES*) stbPtr; stbPtr += ( sizeof( STB_TR_RES ) * nTraCntMax ); 00138 } 00139 00140 00141 if( execFlg->faceTr == STB_TRUE ) 00142 { 00143 handle->fcRec = ( ROI_SYS* ) stbPtr; stbPtr += ( sizeof( ROI_SYS ) * STB_TR_BACK_MAX ); 00144 for( t = 0 ; t < STB_TR_BACK_MAX ; t++ ) 00145 { 00146 handle->fcRec[t].nDetID = ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax ); 00147 handle->fcRec[t].nTraID = ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax ); 00148 handle->fcRec[t].posX = ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax ); 00149 handle->fcRec[t].posY = ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax ); 00150 handle->fcRec[t].size = ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax ); 00151 handle->fcRec[t].conf = ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax ); 00152 handle->fcRec[t].retryN = ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax ); 00153 } 00154 handle->stbTrDet->fcDet = ( ROI_DET* ) stbPtr; stbPtr += ( sizeof( ROI_DET ) * nDetCntMax ); 00155 00156 handle->resFaces = ( STB_TR_RES_FACES* ) stbPtr; stbPtr += ( sizeof( STB_TR_RES_FACES ) ); 00157 handle->resFaces->face = ( STB_TR_RES*) stbPtr; stbPtr += ( sizeof( STB_TR_RES ) * nTraCntMax ); 00158 } 00159 00160 00161 handle->wIdPreCur = ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax ); 00162 handle->wIdCurPre = ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax ); 00163 handle->wDstTbl = ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax * nTraCntMax ); 00164 handle->execFlg = ( STBExecFlg*) stbPtr; stbPtr += sizeof( STBExecFlg ); 00165 00166 handle->wRoi = ( ROI_SYS* ) stbPtr; stbPtr += ( sizeof( ROI_SYS ) ); 00167 handle->wRoi->nDetID= ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax ); 00168 handle->wRoi->nTraID= ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax ); 00169 handle->wRoi->posX = ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax ); 00170 handle->wRoi->posY = ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax ); 00171 handle->wRoi->size = ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax ); 00172 handle->wRoi->conf = ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax ); 00173 handle->wRoi->retryN= ( STB_INT32* ) stbPtr; stbPtr += ( sizeof( STB_INT32 ) * nTraCntMax ); 00174 } 00175 /*--------------------------------------------------------------------- 00176 ---------------------------------------------------------------------*/ 00177 /*Create handle*/ 00178 TRHANDLE TrCreateHandle( const STBExecFlg* execFlg ,const STB_INT32 nDetCntMax, const STB_INT32 nTraCntMax ) 00179 { 00180 00181 TRHANDLE handle ; 00182 STB_INT32 i ,j ; 00183 STB_INT32 tmpVal ; 00184 STB_INT32 nRet ; 00185 00186 nRet = TrIsValidPointer(execFlg); 00187 if(nRet != STB_NORMAL) 00188 { 00189 return NULL; 00190 } 00191 00192 if( nDetCntMax < 1 || STB_TR_DET_CNT_MAX < nDetCntMax ) 00193 { 00194 return NULL; 00195 } 00196 if( nTraCntMax < 1 || STB_TR_TRA_CNT_MAX < nTraCntMax ) 00197 { 00198 return NULL; 00199 } 00200 00201 /*do handle's Malloc here*/ 00202 handle = ( TRHANDLE )malloc( sizeof(*handle) ); 00203 if(handle == NULL) 00204 { 00205 return NULL; 00206 } 00207 00208 handle->detCntMax = nDetCntMax ; 00209 handle->traCntMax = nTraCntMax ; 00210 handle->retryCnt = STB_TR_INI_RETRY ; 00211 handle->stedPos = STB_TR_INI_STEADINESS_SIZE ;//stabilization parameter(position) 00212 handle->stedSize = STB_TR_INI_STEADINESS_POS ;//stabilization parameter(size) 00213 handle->fcCntAcc = 0 ; 00214 handle->bdCntAcc = 0 ; 00215 handle->trPtr = NULL; 00216 handle->stbTrDet = NULL; 00217 handle->fcRec = NULL; 00218 handle->bdRec = NULL; 00219 handle->resFaces = NULL; 00220 handle->resBodys = NULL; 00221 handle->wIdPreCur = NULL; 00222 handle->wIdCurPre = NULL; 00223 handle->wDstTbl = NULL; 00224 handle->execFlg = NULL; 00225 00226 tmpVal = TrCalcTrSize ( execFlg ,nTraCntMax , nDetCntMax); /*calculate necessary amount in the TR handle*/ 00227 handle->trPtr = NULL; 00228 handle->trPtr = ( STB_INT8 * )malloc( tmpVal ) ; /*keep necessary amount in the TR handle*/ 00229 if( handle->trPtr == NULL ) 00230 { 00231 free ( handle->trPtr ); 00232 free ( handle ); 00233 return NULL; 00234 } 00235 ShareTrSize ( handle , execFlg ); /*Malloc-area is allocated to things that need Malloc in TR handle*/ 00236 00237 /*set initial value*/ 00238 if( execFlg->faceTr == STB_TRUE ) 00239 { 00240 for( i = 0 ; i < STB_TR_BACK_MAX ; i++) 00241 { 00242 handle->fcRec[i].cnt= 0; 00243 for( j = 0 ; j < handle->traCntMax ; j++) 00244 { 00245 handle->fcRec[i].nDetID [j] = -1; 00246 handle->fcRec[i].nTraID [j] = -1; 00247 handle->fcRec[i].posX [j] = 0; 00248 handle->fcRec[i].posY [j] = 0; 00249 handle->fcRec[i].size [j] = -1; 00250 handle->fcRec[i].retryN [j] = -1; 00251 handle->fcRec[i].conf [j] = -1; 00252 } 00253 } 00254 } 00255 if( execFlg->bodyTr == STB_TRUE ) 00256 { 00257 for( i = 0 ; i < STB_TR_BACK_MAX ; i++) 00258 { 00259 handle->bdRec[i].cnt= 0; 00260 for( j = 0 ; j < handle->traCntMax ; j++) 00261 { 00262 handle->bdRec[i].nDetID [j] = -1; 00263 handle->bdRec[i].nTraID [j] = -1; 00264 handle->bdRec[i].posX [j] = 0; 00265 handle->bdRec[i].posY [j] = 0; 00266 handle->bdRec[i].size [j] = -1; 00267 handle->bdRec[i].retryN [j] = -1; 00268 handle->bdRec[i].conf [j] = -1; 00269 } 00270 } 00271 } 00272 00273 00274 00275 handle->execFlg->pet = execFlg->pet ; 00276 handle->execFlg->hand = execFlg->hand ; 00277 handle->execFlg->bodyTr = execFlg->bodyTr ; 00278 handle->execFlg->faceTr = execFlg->faceTr ; 00279 handle->execFlg->gen = execFlg->gen ; 00280 handle->execFlg->age = execFlg->age ; 00281 handle->execFlg->fr = execFlg->fr ; 00282 handle->execFlg->exp = execFlg->exp ; 00283 handle->execFlg->gaz = execFlg->gaz ; 00284 handle->execFlg->dir = execFlg->dir ; 00285 handle->execFlg->bli = execFlg->bli ; 00286 00287 00288 return handle; 00289 } 00290 /*--------------------------------------------------------------------- 00291 ---------------------------------------------------------------------*/ 00292 00293 /*Delete handle*/ 00294 STB_INT32 TrDeleteHandle(TRHANDLE handle) 00295 { 00296 STB_INT32 nRet; 00297 00298 /*NULL check*/ 00299 nRet = TrIsValidPointer(handle); 00300 if(nRet != STB_NORMAL){ 00301 return STB_ERR_NOHANDLE; 00302 } 00303 00304 free ( handle->trPtr ); 00305 free ( handle ); 00306 00307 return STB_NORMAL; 00308 } 00309 00310 /*--------------------------------------------------------------------- 00311 ---------------------------------------------------------------------*/ 00312 /*Set the result*/ 00313 STB_INT32 TrSetDetect(TRHANDLE handle,const STB_TR_DET *stbTrDet){ 00314 STB_INT32 nRet; 00315 STB_INT32 i; 00316 00317 /*NULL check*/ 00318 nRet = TrIsValidPointer(handle); 00319 if(nRet != STB_NORMAL) 00320 { 00321 return STB_ERR_NOHANDLE; 00322 } 00323 00324 nRet = TrIsValidPointer(stbTrDet); 00325 if(nRet != STB_NORMAL) 00326 { 00327 return nRet; 00328 } 00329 00330 /*Input value check*/ 00331 nRet = STB_TrIsValidValue ( stbTrDet ,handle->execFlg ); 00332 if(nRet != STB_TRUE) 00333 { 00334 return STB_ERR_INVALIDPARAM; 00335 } 00336 00337 /*Set the received result to the handle (stbTrDet)*/ 00338 /* Face */ 00339 if( handle->execFlg->faceTr == STB_TRUE ) 00340 { 00341 handle->stbTrDet->fcNum = stbTrDet->fcNum; 00342 for( i = 0 ; i < handle->stbTrDet->fcNum ; i++ ) 00343 { 00344 handle->stbTrDet->fcDet[i].posX = stbTrDet->fcDet[i].posX; 00345 handle->stbTrDet->fcDet[i].posY = stbTrDet->fcDet[i].posY; 00346 handle->stbTrDet->fcDet[i].size = stbTrDet->fcDet[i].size; 00347 handle->stbTrDet->fcDet[i].conf = stbTrDet->fcDet[i].conf; 00348 } 00349 }else 00350 { 00351 handle->stbTrDet->fcNum = 0; 00352 } 00353 00354 /* Body */ 00355 if( handle->execFlg->bodyTr == STB_TRUE ) 00356 { 00357 handle->stbTrDet->bdNum = stbTrDet->bdNum; 00358 for( i = 0 ; i < handle->stbTrDet->bdNum ; i++ ) 00359 { 00360 handle->stbTrDet->bdDet[i].posX = stbTrDet->bdDet[i].posX; 00361 handle->stbTrDet->bdDet[i].posY = stbTrDet->bdDet[i].posY; 00362 handle->stbTrDet->bdDet[i].size = stbTrDet->bdDet[i].size; 00363 handle->stbTrDet->bdDet[i].conf = stbTrDet->bdDet[i].conf; 00364 } 00365 }else 00366 { 00367 handle->stbTrDet->bdNum = 0; 00368 } 00369 00370 00371 00372 return STB_NORMAL; 00373 } 00374 /*--------------------------------------------------------------------- 00375 ---------------------------------------------------------------------*/ 00376 /*Main process execution*/ 00377 STB_INT32 TrExecute(TRHANDLE handle){ 00378 00379 STB_INT32 nRet; 00380 /*NULL check*/ 00381 nRet = TrIsValidPointer(handle); 00382 if(nRet != STB_NORMAL){ 00383 return STB_ERR_NOHANDLE; 00384 } 00385 00386 /*Main processing here*/ 00387 nRet = StbTrExec ( handle ); 00388 00389 00390 return STB_NORMAL; 00391 } 00392 /*--------------------------------------------------------------------- 00393 ---------------------------------------------------------------------*/ 00394 /*Get-Function of results*/ 00395 STB_INT32 TrGetResult(TRHANDLE handle,STB_TR_RES_FACES* fcResult,STB_TR_RES_BODYS* bdResult){ 00396 00397 STB_INT32 nRet; 00398 STB_INT32 i; 00399 00400 /*NULL check*/ 00401 nRet = TrIsValidPointer(handle); 00402 if(nRet != STB_NORMAL){ 00403 return STB_ERR_NOHANDLE; 00404 } 00405 00406 if( handle->execFlg->faceTr == STB_TRUE ) 00407 { 00408 nRet = TrIsValidPointer(fcResult); 00409 if(nRet != STB_NORMAL){ 00410 return nRet; 00411 } 00412 } 00413 if( handle->execFlg->bodyTr == STB_TRUE ) 00414 { 00415 nRet = TrIsValidPointer(bdResult); 00416 if(nRet != STB_NORMAL){ 00417 return nRet; 00418 } 00419 } 00420 00421 /*Get result from handle*/ 00422 00423 /* Face */ 00424 if( handle->execFlg->faceTr == STB_TRUE ) 00425 { 00426 fcResult->cnt = handle->resFaces->cnt ; 00427 for( i = 0 ; i < handle->resFaces->cnt ; i++ ) 00428 { 00429 fcResult->face[i].nDetID = handle->resFaces->face[i].nDetID ; 00430 fcResult->face[i].nTraID = handle->resFaces->face[i].nTraID ; 00431 fcResult->face[i].pos.x = handle->resFaces->face[i].pos.x ; 00432 fcResult->face[i].pos.y = handle->resFaces->face[i].pos.y ; 00433 fcResult->face[i].size = handle->resFaces->face[i].size ; 00434 fcResult->face[i].conf = handle->resFaces->face[i].conf ; 00435 } 00436 for( i = handle->resFaces->cnt ; i < handle->traCntMax ; i++ ) 00437 { 00438 fcResult->face[i].nDetID = -1 ; 00439 fcResult->face[i].nTraID = -1 ; 00440 fcResult->face[i].pos.x = 0 ; 00441 fcResult->face[i].pos.y = 0 ; 00442 fcResult->face[i].size = -1 ; 00443 fcResult->face[i].conf = STB_CONF_NO_DATA ; 00444 } 00445 } 00446 00447 /* Body */ 00448 if( handle->execFlg->bodyTr == STB_TRUE ) 00449 { 00450 bdResult->cnt = handle->resBodys->cnt ; 00451 for( i = 0 ; i < handle->resBodys->cnt ; i++ ) 00452 { 00453 bdResult->body[i].nDetID = handle->resBodys->body[i].nDetID ; 00454 bdResult->body[i].nTraID = handle->resBodys->body[i].nTraID ; 00455 bdResult->body[i].pos.x = handle->resBodys->body[i].pos.x ; 00456 bdResult->body[i].pos.y = handle->resBodys->body[i].pos.y ; 00457 bdResult->body[i].size = handle->resBodys->body[i].size ; 00458 bdResult->body[i].conf = handle->resBodys->body[i].conf ; 00459 } 00460 for( i = handle->resBodys->cnt ; i < handle->traCntMax ; i++ ) 00461 { 00462 bdResult->body[i].nDetID = -1 ; 00463 bdResult->body[i].nTraID = -1 ; 00464 bdResult->body[i].pos.x = 0 ; 00465 bdResult->body[i].pos.y = 0 ; 00466 bdResult->body[i].size = -1 ; 00467 bdResult->body[i].conf = STB_CONF_NO_DATA ; 00468 } 00469 } 00470 00471 return STB_NORMAL; 00472 } 00473 /*--------------------------------------------------------------------- 00474 ---------------------------------------------------------------------*/ 00475 /*Clear*/ 00476 STB_INT32 TrClear(TRHANDLE handle){ 00477 00478 STB_INT32 nRet; 00479 STB_INT32 i , j; 00480 00481 00482 /*NULL check*/ 00483 nRet = TrIsValidPointer(handle); 00484 if(nRet != STB_NORMAL){ 00485 return STB_ERR_NOHANDLE; 00486 } 00487 00488 00489 if( handle->execFlg->faceTr == STB_TRUE ) 00490 { 00491 for( i = 0 ; i < STB_TR_BACK_MAX ; i++) 00492 { 00493 handle->fcRec[i].cnt= 0; 00494 for( j = 0 ; j < handle->traCntMax ; j++) 00495 { 00496 handle->fcRec[i].nDetID [j] = -1; 00497 handle->fcRec[i].nTraID [j] = -1; 00498 handle->fcRec[i].posX [j] = 0 ; 00499 handle->fcRec[i].posY [j] = 0 ; 00500 handle->fcRec[i].size [j] = -1; 00501 handle->fcRec[i].retryN [j] = -1; 00502 handle->fcRec[i].conf [j] = -1; 00503 } 00504 } 00505 handle->fcCntAcc = 0; 00506 } 00507 00508 if( handle->execFlg->bodyTr == STB_TRUE ) 00509 { 00510 for( i = 0 ; i < STB_TR_BACK_MAX ; i++) 00511 { 00512 handle->bdRec[i].cnt= 0; 00513 for( j = 0 ; j < handle->traCntMax ; j++) 00514 { 00515 handle->bdRec[i].nDetID [j] = -1; 00516 handle->bdRec[i].nTraID [j] = -1; 00517 handle->bdRec[i].posX [j] = 0 ; 00518 handle->bdRec[i].posY [j] = 0 ; 00519 handle->bdRec[i].size [j] = -1; 00520 handle->bdRec[i].retryN [j] = -1; 00521 handle->bdRec[i].conf [j] = -1; 00522 } 00523 } 00524 handle->bdCntAcc = 0; 00525 } 00526 00527 return STB_NORMAL; 00528 } 00529 /*--------------------------------------------------------------------- 00530 ---------------------------------------------------------------------*/ 00531 /* */ 00532 STB_INT32 TrSetRetryCount(TRHANDLE handle, STB_INT32 nRetryCount) 00533 { 00534 STB_INT32 nRet; 00535 nRet = TrIsValidPointer(handle); 00536 if(nRet != STB_NORMAL){ 00537 return STB_ERR_NOHANDLE; 00538 } 00539 00540 if( nRetryCount < STB_TR_MIN_RETRY || STB_TR_MAX_RETRY < nRetryCount) 00541 { 00542 return STB_ERR_INVALIDPARAM; 00543 } 00544 00545 handle->retryCnt = nRetryCount; 00546 return STB_NORMAL; 00547 } 00548 /*--------------------------------------------------------------------- 00549 ---------------------------------------------------------------------*/ 00550 STB_INT32 TrGetRetryCount ( TRHANDLE handle , STB_INT32* nRetryCount ) 00551 { 00552 STB_INT32 nRet; 00553 nRet = TrIsValidPointer(handle); 00554 if(nRet != STB_NORMAL){ 00555 return STB_ERR_NOHANDLE; 00556 } 00557 nRet = TrIsValidPointer(nRetryCount); 00558 if(nRet != STB_NORMAL){ 00559 return STB_ERR_INVALIDPARAM; 00560 } 00561 00562 *nRetryCount = handle->retryCnt ; 00563 return STB_NORMAL; 00564 } 00565 /*--------------------------------------------------------------------- 00566 ---------------------------------------------------------------------*/ 00567 STB_INT32 TrSetStedinessParam ( TRHANDLE handle , STB_INT32 nStedinessPos , STB_INT32 nStedinessSize ) 00568 { 00569 if( nStedinessPos < STB_TR_MIN_STEADINESS_POS || STB_TR_MAX_STEADINESS_POS < nStedinessPos) 00570 { 00571 return STB_ERR_INVALIDPARAM; 00572 } 00573 if( nStedinessSize < STB_TR_MIN_STEADINESS_SIZE || STB_TR_MAX_STEADINESS_SIZE < nStedinessSize) 00574 { 00575 return STB_ERR_INVALIDPARAM; 00576 } 00577 handle->stedPos = nStedinessPos; 00578 handle->stedSize = nStedinessSize; 00579 return STB_NORMAL; 00580 } 00581 /*--------------------------------------------------------------------- 00582 ---------------------------------------------------------------------*/ 00583 STB_INT32 TrGetStedinessParam ( TRHANDLE handle , STB_INT32* nStedinessPos , STB_INT32* nStedinessSize ) 00584 { 00585 STB_INT32 nRet; 00586 nRet = TrIsValidPointer(handle); 00587 if(nRet != STB_NORMAL){ 00588 return STB_ERR_NOHANDLE; 00589 } 00590 nRet = TrIsValidPointer(nStedinessPos); 00591 if(nRet != STB_NORMAL){ 00592 return STB_ERR_INVALIDPARAM; 00593 } 00594 nRet = TrIsValidPointer(nStedinessSize); 00595 if(nRet != STB_NORMAL){ 00596 return STB_ERR_INVALIDPARAM; 00597 } 00598 *nStedinessPos = handle->stedPos ; 00599 *nStedinessSize = handle->stedSize ; 00600 return STB_NORMAL; 00601 } 00602 /*--------------------------------------------------------------------- 00603 ---------------------------------------------------------------------*/
Generated on Fri Jul 15 2022 01:15:48 by 1.7.2