⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 caam.h

📁 face recognition test source code
💻 H
字号:
#ifndef CAAM_H
#define CAAM_H

#include "def.h"
#include "CDiag.h"
#include "CMatPtr.h"
#include "CFaceDB.h"
#include "lvq.h"

typedef struct FILECMD_TAG
	{
	char cmd[20];
	char args[20];
	FILECMD_TAG *pnext;
	}FILECMD, *PFILECMD;

typedef struct FILESTATE_TAG
	{
	int state; 													/*state of the current line (name of section or command)*/
	int state2;													/*second state (BEGIN END or PROCESSING)*/
	char args[255];											/*arguments that may follow a command line or a new section line*/
	char data[255];											/*line IN a section*/
	FILECMD pnext[25];										/*linked list containing the commands of a section*/
	int num_cmd;
	int num_line;												/*number of file line*/
	}FILESTATE, *PFILESTATE;

class CAAM
	{
	public:
		CSammon *pSammon;

		CAAM();
		~CAAM();
		
		int			Load(char *filename);										/*Load the project file*/
		int 			Build(long leigen);											/*Build the memory and compute its eigenvectors*/
		int			Reconstruct();													/*Reconstruct some faces*/
		int			Recognize(int nElect = 1, BOOL bRecons = FALSE);	/*Recognize people*/
		int			Categorize(/*PFILECMD pcmd*/PFILESTATE fs);			/*Categorize faces with LVQ algorithm*/
		int			Categorize_WH(double);										/*Categorize faces with Widrow-Hoff neurones*/
								
		CFaceDB 		*GetTrainingDB();
		CMatrixPtr 	*GetEigenMat();
		CFaceDB 		*GetEigenDB();
		CDiag			*GetEigenVal();
		
		CFaceDB 		*GetReconstructionDB();
		CFaceDB 		*GetReconstructedDB();
		CMatrix 		*GetReconstructedMat();
		CMatrixPtr 	*GetMeetCmp();
		CMatrix 		*GetReconstructionCmp();
		CMatrix 		*GetRecognitionCmp();
		CMatrix 		*GetMetMat();
		
		CFaceDB 		*GetMetDB();
		CFaceDB		*GetRecognitionDB();
		CFaceDB		*GetRecognizedDB();

		CFaceDB		*GetCategorizeDB();
		
		BOOL			IsCommand(int cmd);
		
	private:
		CFaceDB		*pTrainingDB;							/*Training set of faces*/
		
		CMatrixPtr	*pEVect;									/*Matrix containing the eigenvectors of the memory*/
		CDiag			*pEVal;									/*Eigenvalues*/
		CFaceDB		*pEFace;									/*EigenFaces*/
		
		CFaceDB		*pReconstructionDB;					/*faces to be reconstructed*/
		CFaceDB		*pReconstructedDB;					/*faces reconstructed by the memory*/
		CMatrixPtr	*pReconstructedMat;					/*Matrix containing the pixel of the reconstructed faces*/
		CMatrix		*pReconstructionCmp;					/*Composants of the faces to be reconstructed by the memory*/
		
		CFaceDB		*pRecognizeDB;							/*Faces to be recognized by the memory*/
		CFaceDB		*pRecognizedDB;						/*reconstructed faces of the recognized people*/
		CMatrixPtr	*pRecognizedMat;						/*Matrix containing the pixel of the reconstructed recognized faces*/
		CFaceDB		*pMetDB;									/*Faces of the already met people*/
		CMatrix		*pRecognizeCmp;						/*Composants of faces to be recognized*/
		CMatrixPtr	*pMetCmp;								/*Composants of the already met people*/
		CMatrix		*pMetMat;								/*Meeting faces matrix, used only for loading the matrix of the meeting faces*/
		
		CFaceDB		*pCategorizeDB;						/*Faces to be categorized*/
		
		long 			lRow, lCol, lEigen;
		
		BOOL			bCommand[CMD_MAX];					/*The element i is set to true if the ith command has been executed*/
		
		void 			FaceToCmp(CMatrix *pCmpMat, CMatrix *pFaceMat);
		void 			CmpToFace(CMatrix *pFaceMat,CMatrix * pCmpMat);	

		int read_line(char *str_line, PFILESTATE fs);
		int process_line(PFILESTATE fs);
		
	};

void DBtoMat(CMatrixPtr *pMat, CFaceDB *pDB);
void ComputeCos(CDiag *pCos, CMatrix *pMat1, CMatrix *pMat2);
void RecognizeCmp(CMatrixPtr *pDestCmp, CMatrix *pSourceCmp, CMatrixPtr *pKnownCmp, 
	CMatrix *pAssociation = NULL, int nElect = 1, CFaceDB* pMetDB = NULL);
long Sort(CMatrixPtr *pMat, CVect *pVect);

#endif /* CAAM_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -