-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbase.h
232 lines (178 loc) · 4.69 KB
/
base.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
#ifndef IDVERIFYDEMO_BASE_H
#define IDVERIFYDEMO_BASE_H
enum SDK_ERROR
{
/**
The API call returned with no error.
*/
SDK_SUCCESS = 0,
SDK_MATCH_SUCCESS = 0,
/**
Activation key is invalid or unknown.
*/
SDK_ACTIVATION_SERIAL_UNKNOWN = 1,
/**
Activation key is expired.
*/
SDK_ACTIVATION_EXPIRED = 2,
/**
The API call without SDK initialization. You have to call initializeSDK()
before calling this API.
*/
SDK_NOT_INITIALIZED = 3,
/**
initializeSDK() is called after SDK initialization.
*/
SDK_ALREADY_INITIALIZED = 4,
/**
There aren't resource file needed to initialize SDK in specified path.
*/
SDK_NO_RES_FILE = 5,
/**
No face detected in image.
*/
SDK_NOT_FACE_DETECTED = 6,
/**
match() is called without calling setIDCardPhoto() with no error.
*/
SDK_NONE_IDCARD_SET = 7,
/**
Parameters are corrupt.
*/
SDK_BAD_PARAMETER = 8,
/*
Inputed image is not ID photo.
*/
SDK_NOT_ID_PHOTO = 9,
SDK_IMG_ERROR = 10,
SDK_MATCH_FAILED = 11
};
enum FACE_SDK_ERROR
{
/**
The API call returned with no error.
*/
FACE_SDK_SUCCESS = 0,
FACE_SDK_VERIFY_SUCCESS = 0,
FACE_SDK_MATCH_SUCCESS = 0,
FACE_SDK_LIVENESS_SUCCESS = 0,
/**
Activation key is invalid or unknown.
*/
FACE_SDK_ACTIVATION_SERIAL_UNKNOWN = 1,
/**
Activation key is expired.
*/
FACE_SDK_ACTIVATION_EXPIRED = 2,
/**
The API call without SDK initialization. You have to call initializeSDK()
before calling this API.
*/
FACE_SDK_NOT_INITIALIZED = 3,
/**
initializeSDK() is called after SDK initialization.
*/
FACE_SDK_ALREADY_INITIALIZED = 4,
/**
There aren't resource file needed to initialize SDK in specified path.
*/
FACE_SDK_NO_RES_FILE = 5,
/**
No face detected in image.
*/
FACE_SDK_NOT_FACE_DETECTED = 6,
/**
match() is called without calling setIDCardPhoto() with no error.
*/
FACE_SDK_NOT_ENROLLED = 7,
/**
Parameters are corrupt.
*/
FACE_SDK_BAD_PARAMETER = 8,
/*
Inputed image is not ID photo.
*/
FACE_SDK_IMG_ERROR = 9,
FACE_SDK_VERIFY_FAILED = 10,
FACE_SDK_GROUP_ERROR = 11,
FACE_SDK_DATABASE_ERROR = 12,
FACE_SDK_PERSON_ERROR = 13,
FACE_SDK_ERROR_PAN_OUT = 14,
FACE_SDK_ERROR_BAT_IMAGE = 15,
FACE_SDK_ERROR_MULTI_FACE = 16,
FACE_SDK_MATCH_FAILED = 17,
FACE_SDK_NONE_IDCARD_SET = 18,
FACE_SDK_HWID_ERROR = 19,
FACE_SDK_LIVENESS_FAIL = 20,
FACE_SDK_LIVENESS_PROCESS = 21
};
#define ID_PHOTO_WIDTH 102
#define ID_PHOTO_HEIGHT 126
#define PROBE_IMAGE_MAX_WIDTH 1920
#define PROBE_IMAGE_MIN_WIDTH 1080
//DNN DICT VERSION
#define DT_IDVCD_1_0 0
#define DT_IDVCD15_1_3 1 //1:1
#define DT_E3_3_3 2 //1:N
#define DT_E3_4 3 //1:N
#define DT_E3_3_0 4 //1:N Feature
#define DT_RN1_0 5 //1:N Feature
#define DICT_VERSION DT_IDVCD_1_0 //DT_IDVCD_1_0
//ENGINE VERSION
#define E_ORG 0
#define E_FD_UP 1
#define E_FD_MIX 2
#define ENGINE_VERSION E_FD_MIX
#if (ENGINE_VERSION == E_ORG)
#define ID__ALL_DETECT_MODE 1
#define ID__MIN_VALID_OVERLAPPED_REGION_COUNT 1
#define ID__DELTA_CLASSIFIER_THRESHOLD 0.0f
#define SCENE__ALL_DETECT_MODE 0
#define SCENE__MIN_VALID_OVERLAPPED_REGION_COUNT 3
#define SCENE__DELTA_CLASSIFIER_THRESHOLD 0.0f
#elif (ENGINE_VERSION == E_FD_UP)
#define ID__ALL_DETECT_MODE 1
#define ID__MIN_VALID_OVERLAPPED_REGION_COUNT 1
#define ID__DELTA_CLASSIFIER_THRESHOLD 3.0f
#define SCENE__ALL_DETECT_MODE 1
#define SCENE__MIN_VALID_OVERLAPPED_REGION_COUNT 1
#define SCENE__DELTA_CLASSIFIER_THRESHOLD 3.0f
#elif (ENGINE_VERSION == E_FD_MIX)
#define ID__ALL_DETECT_MODE 1
#define ID__MIN_VALID_OVERLAPPED_REGION_COUNT 1
#define ID__DELTA_CLASSIFIER_THRESHOLD 3.0f
#define SCENE__ALL_DETECT_MODE 1
#define SCENE__MIN_VALID_OVERLAPPED_REGION_COUNT 3
#define SCENE__DELTA_CLASSIFIER_THRESHOLD 3.7f
#endif //(ENGINE_VERSION == E_ORG)
#define MIN_FACE_WIDTH 40
#define PITCH_THRESHOLD 15
#define YAW_THRESHOLD 20
#define ROLL_THRESHOLD 20
#define MODEL_WEIGHT_1 "/kd1_e3_nir.tmp"
#define MODEL_WEIGHT_2 "/kd2_e3_nir.tmp"
#define MODEL_WEIGHT_3 "/kd3_e3_nir.bin"
/* Global variables*/
typedef struct _tagAlignParam
{
int nFeatureSize;
int nAlignWid;
int nAlignHei;
int nEyeMouthDis;
int nEyeCenterXPos;
int nEyeCenterYPos;
} AlignParam;
#define KDNN_SCALE 0.00390625
#define ID_SIZE_LIMIT 1 //0 -> limit, 1 -> all
#define FD_MIX_THRE_SIZE 480
#define USE_NORMAL_SCORE 1 //0 -> old, 1 -> new
//ResNet50_1.0
#define NORMAL_SRC_THREHOLD 82.7f
#define NORMAL_DST_THREHOLD 72.0f
#define FACE_SELECT_MODE 0 //0 -> max, 1 -> mix(minImageWidth > 480 ? max : (max + pos)
#define START_YEAR 2017
#define START_MONTH 7
#define START_DAY 20
//#define SAVE_LOG
#define DEBUG_EN 1
#endif //IDVERIFYDEMO_BASE_H