www.pudn.com > faces.rar > recoalgo.h


/*** 
 **     libface - Library of face recognition and supporting algorithms 
        Copyright (c) 2003 Stefan Farthofer 
 
	This file is part of libface, which is 
 
        free software; you can redistribute it and/or modify 
        it under the terms of the GNU General Public License as published by 
        the Free Software Foundation; either version 2 of the License, or 
        (at your option) any later version. 
 
        This program is distributed in the hope that it will be useful, 
        but WITHOUT ANY WARRANTY; without even the implied warranty of 
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
        GNU General Public License for more details. 
 
        You should have received a copy of the GNU General Public License 
        along with this program; if not, write to the Free Software 
        Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
 
	For further information seek us at http://sourceforge.net/projects/openbio/ 
**	or write an email to dimitri.pissarenko@gmx.net or farthofer@chello.at. 
***/ 
/* declares the struct a recognition algorithm has to implement */ 
 
#ifndef __RECOALGO_H 
#define __RECOALGO_H 
 
struct sRecoAlgo { 
	/* init and info */ 
	int (*init)(void); 
	const char* (*getName)(void); 
	int (*getType)(void); 
 
	/* basic functions */ 
	int (*setupAlgoInstance)(FRrecognitionParameters* gParms, FRalgoParam* algoParms, unsigned int nrAlgoParms, FRimage* images, unsigned int nrImages, BYTE** parms); 
	size_t (*getParametersSize)(FRrecognitionParameters* gParms, BYTE* parms); 
	int (*serializeParameters)(FRrecognitionParameters* gParms, BYTE** parms, BYTE** mem, size_t maxsz, BYTE direction); 
	void (*freeParameters)(FRrecognitionParameters* gParms, BYTE** parms); 
	int (*copyParameters)(FRrecognitionParameters* gParms, BYTE** parmsDst, BYTE *parmsSrc); 
 
	int (*computeTrait)(FRrecognitionParameters* gParms, BYTE* parms, FRimage* image, BYTE** trait); 
	int (*compareTraits)(FRrecognitionParameters* gParms, BYTE* parms, BYTE* trait1, BYTE* trait2, float* probability); 
	size_t (*getTraitSize)(FRrecognitionParameters* gParms, BYTE* parms, BYTE* trait); 
	int (*serializeTrait)(FRrecognitionParameters* gParms, BYTE* parms, BYTE** trait, BYTE** mem, size_t maxsz, BYTE direction); 
	void (*freeTrait)(FRrecognitionParameters* gParms, BYTE* parms, BYTE** trait); 
 
	/* extended functions for debugging and visualization of algorithm */ 
	int (*trainedDataToImages)(FRrecognitionParameters* gParms, BYTE* parms, FRimage** images, unsigned int* nrImages); 
	int (*trainedDataToText) (FRrecognitionParameters* gParms, BYTE* parms, char** text); 
	int (*traitToImages)(FRrecognitionParameters* gParms, BYTE* parms, BYTE* trait, FRimage** images, unsigned int* nrImages); 
	int (*traitToText)(FRrecognitionParameters* gParms, BYTE* parms, BYTE* trait, char** text); 
}; 
#define FRrecoAlgo struct sRecoAlgo 
 
/* functions to manage reco algos, will mainly be used by init, i suppose */ 
int frAddRecoAlgo(FRrecoAlgo* algo); 
int frRemoveRecoAlgo(int id); 
FRrecoAlgo* frGetRecoAlgoById(int id); 
 
/* functions used by recoAlgos for serialization */ 
void frCopyMem(BYTE** mem, void * data, size_t sz, BYTE direction); 
 
#endif /* header guard */