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

📄 cface.h

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

#include <stdio.h>
#include "CMemory.h"
#include "CMatPtr.h"

#define ASCII		0
#define BINARY		1
#define PPM			0
#define PGM			1
#define typeface	float

class CFace	: public CObject	
	{
	public:
		CFace();
		CFace(char *tFileName, char *tFaceName);
		~CFace();
		
		int Load();
		int Save();
		int Copy(CMatrixPtr *pMat, long c);
		
		void Expand(float *scale, float *shift, float src_min, float src_max);
		
		void SetFileName(char *str_file);
		char *GetFileName();
		char *GetName();
		void SetName(char *str_file, int len = -1);
		
		long Getxlen();
		long Getylen();
		
		typeface *GetData();
		void ReleaseData();
		
		CMemory *GetMem();
		
		void SetAt(long x, long y, typeface val);
		void SetAt(long lpixel, typeface val);
		typeface GetAt(long x, long y)
			{
			return (bMat == TRUE) ? 
				pMat->GetAt((y-1L)*xlen + (x-1L) + 1L, col) 
				: 
				pdata[(y-1L)*xlen + (x-1L)];
			}
		typeface GetAt(long lpixel);
		
		void Lock();
		void Unlock();

	private:
		long xlen, ylen;						/*Dimensions of the image*/
		CMemory *data;							/*Memory object representing the image's bytes*/
		typeface *pdata;						/*pointer to the locked CMemory*/
		char cFormat;							/*Format of the input file, can be either ASCII or BINARY*/
		char cFileType;							/*File format. Can be PPM or PGM*/
		char FileName[255];						/*File name*/
		char FaceName[64];						/*Face's name*/
		BOOL bMat;								/*FALSE if the data are read from the disk
												  TRUE is they are from a computed matrix*/
		CMatrixPtr *pMat;							/*if the face is a matrix's column, pMat hold the pointer to it*/
		long col;								/* and col hold the column's number*/
		BOOL bAlloc;							/*TRUE if the object allocate itself the memory (So it has to delete it)*/
		
		int ReadASCII(unsigned char *str);		/*read an ascii image file*/
		int ReadBinary(unsigned char *str);		/*read a binary image file*/
		char *GetNextTok(char *str);
		char *GetNextLine(char *str);
	};

#endif /* CFACE_H */

⌨️ 快捷键说明

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