-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFace.H
129 lines (90 loc) · 2.07 KB
/
Face.H
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
//
// HEADER Face
// Face.h
//
//
// Date: 2007-09-23
//
#ifndef FACE_HEADER
#define FACE_HEADER
#include "common.H"
#include "PreProcessor.H"
/* allow only no of processing levels */
#define PROCESSING_LEVELS 10
#define IGNR_PROTECTED true
#define ACPT_PROTECTED false
using namespace std;
struct PersonData
{
string s_Name;
int i_ID; /* should be unique */
};
class Face;
class Person
{
public:
Person(int iID);
Person();
void Reset();
~Person();
inline PersonData* GetData(){return &o_Data;}
friend class Face;
friend class FaceDB;
void AddFace(Face* pFace);
void *p_UserData;
void InitTrv();
Face* GetNext(bool bIgnoreProtected=true);
int GetCount(bool bIgnoreProtected=true);
private:
PersonData o_Data;
list<Face*> lst_Faces;
list<Face*>::iterator ite_Faces;
};
class FaceDB
{
public:
FaceDB();
virtual ~FaceDB();
void Reset();
void Save(const char* zPrefix);
Person* FindOrCreatePerson(int iID);
Person* GetPerson(int iID);
void LogSummary();
int AddFace(const char* zFileName, int iID, IplImage* pImg);
void ShowImages();
void InitTrv();
Face* GetNext(bool bIgnoreProtected=true);
int GetCount(bool bIgnoreProtected=true);
map<int, Person*> map_Persons;
private:
void AddToQueue(Face* pFace);
vector<Face*> vec_Face;
vector<Face*>::iterator ite_Face;
};
class Face
{
public:
Face(Person* pPerson);
Face();
~Face();
void Reset();
void Load(IplImage* pImg);
void Load(IplImage* pImg, const char* zFileName);
void PreProcess(PreProcessor* pProcessor);
CvMat* GetMat(int iMode); /* get Mat from last preprocessed image */
IplImage* GetPrepImage(int iLevel=-1);
inline int GetPrepLevel(){ return i_PrepLevel; }
Person* p_Person;
Face* p_Next;
const char* GetFileName(){return (const char*)z_FileName; }
void* p_UserData;
bool IsProtected(){ return b_Protected; }
void SetProtected(bool bProtected){ b_Protected = bProtected; }
friend class Person;
private:
char z_FileName[FILE_NAME_LEN]; /* base file name */
IplImage* pp_Processed[PROCESSING_LEVELS];
int i_PrepLevel;
bool b_Protected;
};
#endif // FACE_HEADER