static bool fGetDetParamsFromShapeFile ( DET_PARAMS &DetParams, // out char *psImageDirs[], // out: dirs in sShapeFile const char sImage[], // in: image name unsigned DetAttr, // in: which face detector const char sShapeFile[]) // in: shape file { // change xxx to ^xxx$ to avoid spurious matches else B00 would match B0012 char s[SLEN]; sprintf(s, "^%s$", sGetBase(sImage)); Vec v = FindMatInFile(sShapeFile, psImageDirs, s, DetAttr, DetAttr); int nelems = v.nelems(); if (nelems == 0) return false; // found det params in the file VecToDetParams(DetParams, v); if (DetParams.x == 0 && DetParams.y == 0) // prevent 0,0 being seen as "unused" DetParams.x = 0.1; // may not be necessary return true; // success }
//----------------------------------------------------------------------------- static void ShowFirstFewShapes (const vec_string &Tags) // in { if (Tags.size() == 0) lprintf("No shapes"); else { lprintf("First few shapes are "); unsigned iShape; for (iShape = 0; iShape < MIN(5, Tags.size()); iShape++) lprintf("%s ", sGetBase(sGetBasenameFromTag(Tags[iShape]))); if (iShape < Tags.size()) lprintf("..."); lprintf("\n"); } }