void LocatePoint( FTYPE *x, FTYPE *y, JetBunch bunch, Image novel, JetMasks masks, JetDisplacementEstimator dispEst){ int i, best = 0; FTYPE dx = 0.0, dy = 0.0; FTYPE bestsim = -1.0e300; /* Extract Gabor Jet from image*/ GaborJet njet = extractJet(*x, *y, novel, masks); /* Select the closest matching training jet */ for(i = 0; i < bunch->size; i++){ FTYPE sim; dx = 0.0; dy = 0.0; sim = dispEst( bunch->jets[i], njet, &dx, &dy); if(sim > bestsim){ bestsim = sim; best = i; } } /* Compute the new x and y */ dispEst( bunch->jets[best], njet, &dx, &dy); *x += dx; *y += dy; /* Free the jet */ freeGaborJet( njet ); }
void freeJetBunch(JetBunch jb){ int i; for(i = 0; i < jb->size; i++){ if(jb->jets[i]) freeGaborJet(jb->jets[i]); } free(jb->jets); free(jb); }
void freeFaceGraph( FaceGraph fg ){ int i; for(i = 0; i < fg->totalsize; i++){ if(fg->jets[i] != NULL){ freeGaborJet(fg->jets[i]); } } free(fg->jets); free(fg); alloc_faceGraph--; }