Enrollment 28.2.0
Loading...
Searching...
No Matches
FaceExecutor.h
Go to the documentation of this file.
1
9
10#pragma once
11
13#include "enrollment/Export.h"
15#include <cstdint>
16#include <memory>
17#include <mutex>
18#include <stddef.h>
19#include <string>
20
21// Even the function did not use any member variables, they are virtual and thats why they cannot be static
22// NOLINTBEGIN(readability-convert-member-functions-to-static)
23namespace inno
24{
25 // Functions and types suitable for DLL interface
26 extern "C"
27 {
28// See doc/Main.markdown "Header and Binary parts" for reason why we use pragma pack 1
29#pragma pack(push, 1)
30 struct INNO_ENROLLMENT_API inno_FaceCrop_Rectangle
31 {
32 int topLeftX;
33 int topLeftY;
34 int topRightX;
35 int topRightY;
36 int bottomLeftX;
37 int bottomLeftY;
38 int bottomRightX;
39 int bottomRightY;
40 };
41
42 struct INNO_ENROLLMENT_API inno_FaceDetector_face
43 {
44 void* item;
45 inno_FaceCrop_Rectangle roundingBox;
46 unsigned int confidence;
47 };
48
49 struct INNO_ENROLLMENT_API inno_FaceDetector_result
50 {
51 static const unsigned int MaxFaces = 16;
52 inno_FaceDetector_face faces[MaxFaces];
53 };
54
55 struct INNO_ENROLLMENT_API inno_FaceParams
56 {
57 static constexpr const char* BackgroundUniformityMinRatioName = "bu.min_bg_ratio";
58 static constexpr const char* AgeGenderMode = "ag.speed_accuracy_mode";
59 const char* name = nullptr;
60 const char* value = nullptr;
61 };
62#pragma pack(pop)
63 using FaceDestroyer = void (*)(void*);
64 using FaceAllocator = uint8_t* (*)(void*, size_t);
65 }
66
67 class FaceExecutor
68 {
69 public:
70 static constexpr size_t MaxErrorMessage = 200;
71 virtual inno_FaceDetector_result Detect(const std::shared_ptr<Logger>& log,
72 unsigned int height,
73 unsigned int width,
74 unsigned int dpi,
75 const uint8_t* data,
76 size_t dataSize,
77 float minFaceSize,
78 float maxFaceSize,
79 unsigned int type,
80 ErrorCallbacks errorCallbacks) = 0;
81 virtual void Extract(void* faceItem,
82 FaceAllocator allocator,
83 void* container,
84 unsigned int extractorType,
85 ErrorCallbacks errorCallbacks) = 0;
86 virtual void Match(const uint8_t* probe,
87 size_t probeLength,
88 const uint8_t* gallery,
89 size_t galleryLength,
90 float* score,
91 ErrorCallbacks errorCallbacks) = 0;
92 virtual int GetTemplateEmbeddingInfo(const uint8_t* tmpl,
93 size_t tmplLength,
94 int32_t* quality,
95 uint32_t* modelVersion,
96 uint32_t* enrollmentVersion,
97 ErrorCallbacks errorCallbacks) = 0;
98 virtual FaceDestroyer DestroyImpl() = 0;
99 virtual inno_FaceCrop_Rectangle CropRectangle(void* face,
100 unsigned int cropMethod,
101 float cropScale,
102 ErrorCallbacks errorCallbacks) = 0;
103 virtual void CropImage(void* face,
104 unsigned int cropMethod,
105 float cropScale,
106 unsigned char red,
107 unsigned char green,
108 unsigned char blue,
109 unsigned int* cropWidth,
110 unsigned int* cropHeight,
111 FaceAllocator allocator,
112 void* container,
113 ErrorCallbacks errorCallbacks) = 0;
114 virtual float GetAttribute(const std::shared_ptr<Logger>& log,
115 void* faceItem,
116 unsigned int id,
117 const inno_FaceParams* params,
118 size_t paramsSize,
119 ErrorCallbacks errorCallbacks) = 0;
120 virtual void GetKeypoint(const std::shared_ptr<Logger>& /*log*/,
121 void* faceItem,
122 unsigned int id,
123 float* score,
124 float* x,
125 float* y,
126 ErrorCallbacks errorCallbacks) = 0;
127 virtual void FaceAreaMask(void* faceItem,
128 unsigned int* width,
129 unsigned int* height,
130 uint8_t** data,
131 size_t* length,
132 unsigned int cropMethod,
133 float cropScale,
134 ErrorCallbacks errorCallbacks) = 0;
135 virtual int FaceAreaSegmentation(void* faceItem,
136 unsigned int* width,
137 unsigned int* height,
138 uint8_t** data,
139 size_t* length,
140 unsigned int cropMethod,
141 float cropScale,
142 ErrorCallbacks errorCallbacks) = 0;
143 virtual void FaceAreaSegmentationColor(void* faceItem,
144 unsigned int* width,
145 unsigned int* height,
146 uint8_t** data,
147 size_t* length,
148 unsigned int cropMethod,
149 float cropScale,
150 unsigned char red,
151 unsigned char green,
152 unsigned char blue,
153 ErrorCallbacks errorCallbacks) = 0;
154 virtual unsigned int GetSharpnessId() = 0;
155 virtual unsigned int GetBrightnessId() = 0;
156 virtual unsigned int GetContrastId() = 0;
157 virtual unsigned int GetUniqueIntensityLevelsId() = 0;
158 virtual unsigned int GetShadowId() = 0;
159 virtual unsigned int GetNoseShadowId() = 0;
160 virtual unsigned int GetSpecularityId() = 0;
161 virtual unsigned int GetEyeGazeId() = 0;
162 virtual unsigned int GetEyeStatusRId() = 0;
163 virtual unsigned int GetEyeStatusLId() = 0;
164 virtual unsigned int GetGlassStatusId() = 0;
165 virtual unsigned int GetHeavyFrameId() = 0;
166 virtual unsigned int GetMouthStatusId() = 0;
167 virtual unsigned int GetBackgroundUniformityId() = 0;
168 virtual unsigned int GetAgeId() = 0;
169 virtual unsigned int GetRedEyeRId() = 0;
170 virtual unsigned int GetRedEyeLId() = 0;
171 virtual unsigned int GetGenderId() = 0;
172 virtual unsigned int GetEyeDistanceId() = 0;
173 virtual unsigned int GetFaceRelativeAreaId() = 0;
174 virtual unsigned int GetFaceRelativeAreaInImageId() = 0;
175 virtual unsigned int GetRollAngleId() = 0;
176 virtual unsigned int GetPitchAngleId() = 0;
177 virtual unsigned int GetYawAngleId() = 0;
178 virtual unsigned int GetFaceSizeId() = 0;
179 virtual unsigned int GetMaskId() = 0;
180 virtual unsigned int GetTintedGlassesId() = 0;
181
182 virtual unsigned int GetRightEyeOuterCornerId() = 0;
183 virtual unsigned int GetRightEyeCentreId() = 0;
184 virtual unsigned int GetRightEyeInnerCornerId() = 0;
185 virtual unsigned int GetLeftEyeInnerCornerId() = 0;
186 virtual unsigned int GetLeftEyeCentreId() = 0;
187 virtual unsigned int GetLeftEyeOuterCornerId() = 0;
188 virtual unsigned int GetNoseRootId() = 0;
189 virtual unsigned int GetNoseRightBottomId() = 0;
190 virtual unsigned int GetNoseTipId() = 0;
191 virtual unsigned int GetNoseLeftBottomId() = 0;
192 virtual unsigned int GetNoseBottomId() = 0;
193 virtual unsigned int GetMouthRightCornerId() = 0;
194 virtual unsigned int GetMouthCenterId() = 0;
195 virtual unsigned int GetMouthLeftCornerId() = 0;
196 virtual unsigned int GetMouthUpperEdgeId() = 0;
197 virtual unsigned int GetMouthLowerEdgeId() = 0;
198 virtual unsigned int GetRightEyebrowOuterEndId() = 0;
199 virtual unsigned int GetRightEyebrowInnerEndId() = 0;
200 virtual unsigned int GetLeftEyebrowInnerEndId() = 0;
201 virtual unsigned int GetLeftEyebrowOuterEndId() = 0;
202 virtual unsigned int GetRightEdgeId() = 0;
203 virtual unsigned int GetChinTipId() = 0;
204 virtual unsigned int GetLeftEdgeId() = 0;
205
206 virtual float GetPassiveLivenessFast(const std::shared_ptr<Logger>& logger,
207 void* faceItem,
208 ErrorCallbacks errorCallbacks) = 0;
209 virtual float GetPassiveLivenessAccurate(const std::shared_ptr<Logger>& logger,
210 void* faceItem,
211 ErrorCallbacks errorCallbacks) = 0;
212 virtual void* CreateOFIQFace(const std::shared_ptr<Logger>& logger,
213 const uint8_t* data,
214 size_t width,
215 size_t height,
216 unsigned int dpi,
217 size_t size,
218 FaceDestroyer* deleter,
219 ErrorCallbacks errorCallbacks) = 0;
220
221 virtual unsigned int GetMaxId() = 0;
222 virtual void DeleteBytes(uint8_t*) = 0;
223
224 FaceExecutor() = default;
225 virtual ~FaceExecutor() = default;
226 FaceExecutor(const FaceExecutor&) = delete;
227 FaceExecutor(FaceExecutor&&) = delete;
228 FaceExecutor& operator=(const FaceExecutor&) = delete;
229 FaceExecutor& operator=(FaceExecutor&&) = delete;
230 };
231
232 extern "C"
233 {
234 INNO_ENROLLMENT_API inno_FaceDetector_result inno_local_FaceDetector_Detect(LoggerCallBacks logCallbacks,
235 unsigned int height,
236 unsigned int width,
237 unsigned int resolution,
238 const uint8_t* data,
239 float minFaceSize,
240 float maxFaceSize,
241 unsigned int type,
242 ErrorCallbacks errorCallbacks);
243 INNO_ENROLLMENT_API void inno_local_Face_ReleaseItem(void* faceItem);
244 INNO_ENROLLMENT_API inno_FaceCrop_Rectangle inno_local_FaceCrop_CropRectangle(void* face,
245 unsigned int cropMethod,
246 float cropScale,
247 ErrorCallbacks errorCallbacks);
248 INNO_ENROLLMENT_API void inno_local_FaceCrop_CropImage(void* face,
249 unsigned int cropMethod,
250 float cropScale,
251 unsigned char red,
252 unsigned char green,
253 unsigned char blue,
254 unsigned int* cropWidth,
255 unsigned int* cropHeight,
256 FaceAllocator allocator,
257 void* container,
258 ErrorCallbacks errorCallbacks);
259
260 INNO_ENROLLMENT_API float inno_local_Face_GetAttribute(LoggerCallBacks logCallbacks,
261 void* faceItem,
262 unsigned int id,
263 const inno_FaceParams* params,
264 size_t paramsSize,
265 ErrorCallbacks errorCallbacks);
266 INNO_ENROLLMENT_API void inno_local_Face_GetKeypoint(LoggerCallBacks logCallbacks,
267 void* faceItem,
268 unsigned int id,
269 float* score,
270 float* x,
271 float* y,
272 ErrorCallbacks errorCallbacks);
273 INNO_ENROLLMENT_API void inno_local_Face_FaceAreaMask(void* faceItem,
274 unsigned int* width,
275 unsigned int* height,
276 uint8_t** data,
277 size_t* length,
278 unsigned int cropMethod,
279 float cropScale,
280 ErrorCallbacks errorCallbacks);
281 INNO_ENROLLMENT_API int inno_local_Face_FaceAreaSegmentation(void* faceItem,
282 unsigned int* width,
283 unsigned int* height,
284 uint8_t** data,
285 size_t* length,
286 unsigned int cropMethod,
287 float cropScale,
288 ErrorCallbacks errorCallbacks);
289 INNO_ENROLLMENT_API void inno_local_Face_FaceAreaSegmentationColor(void* faceItem,
290 unsigned int* width,
291 unsigned int* height,
292 uint8_t** data,
293 size_t* length,
294 unsigned int cropMethod,
295 float cropScale,
296 unsigned char red,
297 unsigned char green,
298 unsigned char blue,
299 ErrorCallbacks errorCallbacks);
300 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_Sharpness_id();
301 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_Brightness_id();
302 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_Contrast_id();
303 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_UniqueIntensityLevels_id();
304 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_Shadow_id();
305 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_NoseShadow_id();
306 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_Specularity_id();
307 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_EyeGaze_id();
308 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_EyeStatusR_id();
309 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_EyeStatusL_id();
310 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_GlassStatus_id();
311 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_HeavyFrame_id();
312 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_MouthStatus_id();
313 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_BackgroundUniformity_id();
314 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_Age_id();
315 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_RedEyeR_id();
316 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_RedEyeL_id();
317 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_Gender_id();
318 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_EyeDistance_id();
319 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_FaceRelativeArea_id();
320 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_FaceRelativeAreaInImage_id();
321 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_RollAngle_id();
322 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_PitchAngle_id();
323 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_YawAngle_id();
324 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_FaceSize_id();
325 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_Mask_id();
326 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_TintedGlasses_id();
327 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_Max_Attribute_id();
328 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_RightEyeOuterCorner_id();
329 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_RightEyeCentre_id();
330 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_RightEyeInnerCorner_id();
331 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_LeftEyeInnerCorner_id();
332 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_LeftEyeCentre_id();
333 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_LeftEyeOuterCorner_id();
334 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_NoseRoot_id();
335 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_NoseRightBottom_id();
336 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_NoseTip_id();
337 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_NoseLeftBottom_id();
338 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_NoseBottom_id();
339 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_MouthRightCorner_id();
340 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_MouthCenter_id();
341 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_MouthLeftCorner_id();
342 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_MouthUpperEdge_id();
343 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_MouthLowerEdge_id();
344 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_RightEyebrowOuterEnd_id();
345 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_RightEyebrowInnerEnd_id();
346 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_LeftEyebrowInnerEnd_id();
347 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_LeftEyebrowOuterEnd_id();
348 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_RightEdge_id();
349 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_ChinTip_id();
350 INNO_ENROLLMENT_API unsigned int inno_local_Face_Get_LeftEdge_id();
351 INNO_ENROLLMENT_API float inno_local_Face_Get_PassiveLivenessFast(LoggerCallBacks logCallbacks,
352 void* faceItem,
353 ErrorCallbacks errorCallbacks);
354 INNO_ENROLLMENT_API float inno_local_Face_Get_PassiveLivenessAccurate(LoggerCallBacks logCallbacks,
355 void* faceItem,
356 ErrorCallbacks errorCallbacks);
357 INNO_ENROLLMENT_API void* inno_local_CreateOFIQFace(LoggerCallBacks logCallbacks,
358 const uint8_t* data,
359 size_t width,
360 size_t height,
361 unsigned int dpi,
362 size_t size,
363 FaceDestroyer* deleter,
364 ErrorCallbacks errorCallbacks);
365 INNO_ENROLLMENT_API void inno_local_Face_DeleteBytes(const uint8_t* bytes);
366 INNO_ENROLLMENT_API void inno_local_Face_Extract(void* faceItem,
367 FaceAllocator allocator,
368 void* container,
369 unsigned int extractorType,
370 ErrorCallbacks errorCallbacks);
371 INNO_ENROLLMENT_API void inno_local_Face_Match(const uint8_t* probe,
372 size_t probeLength,
373 const uint8_t* gallery,
374 size_t galleryLength,
375 float* score,
376 ErrorCallbacks errorCallbacks);
377 INNO_ENROLLMENT_API int inno_local_Face_TemplateEmbeddingInfo(const uint8_t* tmpl,
378 size_t tmplLength,
379 int32_t* quality,
380 uint32_t* modelVersion,
381 uint32_t* enrollmentVersion,
382 ErrorCallbacks errorCallbacks);
383 }
384
385 class LocalFaceExecutor : public FaceExecutor
386 {
387 public:
388 inno_FaceDetector_result Detect(const std::shared_ptr<Logger>& log,
389 unsigned int height,
390 unsigned int width,
391 unsigned int dpi,
392 const uint8_t* data,
393 size_t /*dataSize*/,
394 float minFaceSize,
395 float maxFaceSize,
396 unsigned int type,
397 ErrorCallbacks errorCallbacks) final
398 {
399 const CallbackLogger slog(log);
400 return inno_local_FaceDetector_Detect(
401 slog.GetCallbacks(), height, width, dpi, data, minFaceSize, maxFaceSize, type, errorCallbacks);
402 }
403 void Extract(void* faceItem,
404 FaceAllocator allocator,
405 void* container,
406 unsigned int extractorType,
407 ErrorCallbacks errorCallbacks) final
408 {
409 inno_local_Face_Extract(faceItem, allocator, container, extractorType, errorCallbacks);
410 }
411 void Match(const uint8_t* probe,
412 size_t probeSize,
413 const uint8_t* gallery,
414 size_t gallerySize,
415 float* score,
416 ErrorCallbacks errorCallbacks) final
417 {
418 inno_local_Face_Match(probe, probeSize, gallery, gallerySize, score, errorCallbacks);
419 }
420 int GetTemplateEmbeddingInfo(const uint8_t* tmpl,
421 size_t tmplSize,
422 int32_t* quality,
423 uint32_t* modelVersion,
424 uint32_t* enrollmentVersion,
425 ErrorCallbacks errorCallbacks) final
426 {
427 return inno_local_Face_TemplateEmbeddingInfo(
428 tmpl, tmplSize, quality, modelVersion, enrollmentVersion, errorCallbacks);
429 }
430
431 FaceDestroyer DestroyImpl() final
432 {
433 return inno_local_Face_ReleaseItem;
434 }
435 inno_FaceCrop_Rectangle CropRectangle(void* face,
436 unsigned int cropMethod,
437 float cropScale,
438 ErrorCallbacks errorCallbacks) final
439 {
440 return inno_local_FaceCrop_CropRectangle(face, cropMethod, cropScale, errorCallbacks);
441 }
442 void CropImage(void* face,
443 unsigned int cropMethod,
444 float cropScale,
445 unsigned char red,
446 unsigned char green,
447 unsigned char blue,
448 unsigned int* cropWidth,
449 unsigned int* cropHeight,
450 FaceAllocator allocator,
451 void* container,
452 ErrorCallbacks errorCallbacks) final
453 {
454 inno_local_FaceCrop_CropImage(face,
455 cropMethod,
456 cropScale,
457 red,
458 green,
459 blue,
460 cropWidth,
461 cropHeight,
462 allocator,
463 container,
464 errorCallbacks);
465 }
466
467 float GetAttribute(const std::shared_ptr<Logger>& log,
468 void* faceItem,
469 unsigned int id,
470 const inno_FaceParams* params,
471 size_t paramsSize,
472 ErrorCallbacks errorCallbacks) final
473 {
474 const CallbackLogger slog(log);
475 return inno_local_Face_GetAttribute(slog.GetCallbacks(), faceItem, id, params, paramsSize, errorCallbacks);
476 }
477 void GetKeypoint(const std::shared_ptr<Logger>& log,
478 void* faceItem,
479 unsigned int id,
480 float* score,
481 float* x,
482 float* y,
483 ErrorCallbacks errorCallbacks) final
484 {
485 const CallbackLogger slog(log);
486 inno_local_Face_GetKeypoint(slog.GetCallbacks(), faceItem, id, score, x, y, errorCallbacks);
487 }
488 void FaceAreaMask(void* faceItem,
489 unsigned int* width,
490 unsigned int* height,
491 uint8_t** data,
492 size_t* length,
493 unsigned int cropMethod,
494 float cropScale,
495 ErrorCallbacks errorCallbacks) final
496 {
497 inno_local_Face_FaceAreaMask(faceItem, width, height, data, length, cropMethod, cropScale, errorCallbacks);
498 }
499 int FaceAreaSegmentation(void* faceItem,
500 unsigned int* width,
501 unsigned int* height,
502 uint8_t** data,
503 size_t* length,
504 unsigned int cropMethod,
505 float cropScale,
506 ErrorCallbacks errorCallbacks) final
507 {
508 return inno_local_Face_FaceAreaSegmentation(
509 faceItem, width, height, data, length, cropMethod, cropScale, errorCallbacks);
510 }
511 void FaceAreaSegmentationColor(void* faceItem,
512 unsigned int* width,
513 unsigned int* height,
514 uint8_t** data,
515 size_t* length,
516 unsigned int cropMethod,
517 float cropScale,
518 unsigned char red,
519 unsigned char green,
520 unsigned char blue,
521 ErrorCallbacks errorCallbacks) final
522 {
523 inno_local_Face_FaceAreaSegmentationColor(
524 faceItem, width, height, data, length, cropMethod, cropScale, red, green, blue, errorCallbacks);
525 }
526 unsigned int GetSharpnessId() final
527 {
528 return inno_local_Face_Get_Sharpness_id();
529 }
530 unsigned int GetBrightnessId() final
531 {
532 return inno_local_Face_Get_Brightness_id();
533 }
534 unsigned int GetContrastId() final
535 {
536 return inno_local_Face_Get_Contrast_id();
537 }
538 unsigned int GetUniqueIntensityLevelsId() final
539 {
540 return inno_local_Face_Get_UniqueIntensityLevels_id();
541 }
542 unsigned int GetShadowId() final
543 {
544 return inno_local_Face_Get_Shadow_id();
545 }
546 unsigned int GetNoseShadowId() final
547 {
548 return inno_local_Face_Get_NoseShadow_id();
549 }
550 unsigned int GetSpecularityId() final
551 {
552 return inno_local_Face_Get_Specularity_id();
553 }
554 unsigned int GetEyeGazeId() final
555 {
556 return inno_local_Face_Get_EyeGaze_id();
557 }
558 unsigned int GetEyeStatusRId() final
559 {
560 return inno_local_Face_Get_EyeStatusR_id();
561 }
562 unsigned int GetEyeStatusLId() final
563 {
564 return inno_local_Face_Get_EyeStatusL_id();
565 }
566 unsigned int GetGlassStatusId() final
567 {
568 return inno_local_Face_Get_GlassStatus_id();
569 }
570 unsigned int GetHeavyFrameId() final
571 {
572 return inno_local_Face_Get_HeavyFrame_id();
573 }
574 unsigned int GetMouthStatusId() final
575 {
576 return inno_local_Face_Get_MouthStatus_id();
577 }
578 unsigned int GetBackgroundUniformityId() final
579 {
580 return inno_local_Face_Get_BackgroundUniformity_id();
581 }
582 unsigned int GetAgeId() final
583 {
584 return inno_local_Face_Get_Age_id();
585 }
586 unsigned int GetRedEyeRId() final
587 {
588 return inno_local_Face_Get_RedEyeR_id();
589 }
590 unsigned int GetRedEyeLId() final
591 {
592 return inno_local_Face_Get_RedEyeL_id();
593 }
594 unsigned int GetGenderId() final
595 {
596 return inno_local_Face_Get_Gender_id();
597 }
598 unsigned int GetEyeDistanceId() final
599 {
600 return inno_local_Face_Get_EyeDistance_id();
601 }
602 unsigned int GetFaceRelativeAreaId() final
603 {
604 return inno_local_Face_Get_FaceRelativeArea_id();
605 }
606 unsigned int GetFaceRelativeAreaInImageId() final
607 {
608 return inno_local_Face_Get_FaceRelativeAreaInImage_id();
609 }
610 unsigned int GetRollAngleId() final
611 {
612 return inno_local_Face_Get_RollAngle_id();
613 }
614 unsigned int GetPitchAngleId() final
615 {
616 return inno_local_Face_Get_PitchAngle_id();
617 }
618 unsigned int GetYawAngleId() final
619 {
620 return inno_local_Face_Get_YawAngle_id();
621 }
622 unsigned int GetFaceSizeId() final
623 {
624 return inno_local_Face_Get_FaceSize_id();
625 }
626 unsigned int GetMaskId() final
627 {
628 return inno_local_Face_Get_Mask_id();
629 }
630 unsigned int GetTintedGlassesId() final
631 {
632 return inno_local_Face_Get_TintedGlasses_id();
633 }
634 unsigned int GetRightEyeOuterCornerId() final
635 {
636 return inno_local_Face_Get_RightEyeOuterCorner_id();
637 }
638 unsigned int GetRightEyeCentreId() final
639 {
640 return inno_local_Face_Get_RightEyeCentre_id();
641 }
642 unsigned int GetRightEyeInnerCornerId() final
643 {
644 return inno_local_Face_Get_RightEyeInnerCorner_id();
645 }
646 unsigned int GetLeftEyeInnerCornerId() final
647 {
648 return inno_local_Face_Get_LeftEyeInnerCorner_id();
649 }
650 unsigned int GetLeftEyeCentreId() final
651 {
652 return inno_local_Face_Get_LeftEyeCentre_id();
653 }
654 unsigned int GetLeftEyeOuterCornerId() final
655 {
656 return inno_local_Face_Get_LeftEyeOuterCorner_id();
657 }
658 unsigned int GetNoseRootId() final
659 {
660 return inno_local_Face_Get_NoseRoot_id();
661 }
662 unsigned int GetNoseRightBottomId() final
663 {
664 return inno_local_Face_Get_NoseRightBottom_id();
665 }
666 unsigned int GetNoseTipId() final
667 {
668 return inno_local_Face_Get_NoseTip_id();
669 }
670 unsigned int GetNoseLeftBottomId() final
671 {
672 return inno_local_Face_Get_NoseLeftBottom_id();
673 }
674 unsigned int GetNoseBottomId() final
675 {
676 return inno_local_Face_Get_NoseBottom_id();
677 }
678 unsigned int GetMouthRightCornerId() final
679 {
680 return inno_local_Face_Get_MouthRightCorner_id();
681 }
682 unsigned int GetMouthCenterId() final
683 {
684 return inno_local_Face_Get_MouthCenter_id();
685 }
686 unsigned int GetMouthLeftCornerId() final
687 {
688 return inno_local_Face_Get_MouthLeftCorner_id();
689 }
690 unsigned int GetMouthUpperEdgeId() final
691 {
692 return inno_local_Face_Get_MouthUpperEdge_id();
693 }
694 unsigned int GetMouthLowerEdgeId() final
695 {
696 return inno_local_Face_Get_MouthLowerEdge_id();
697 }
698 unsigned int GetRightEyebrowOuterEndId() final
699 {
700 return inno_local_Face_Get_RightEyebrowOuterEnd_id();
701 }
702 unsigned int GetRightEyebrowInnerEndId() final
703 {
704 return inno_local_Face_Get_RightEyebrowInnerEnd_id();
705 }
706 unsigned int GetLeftEyebrowInnerEndId() final
707 {
708 return inno_local_Face_Get_LeftEyebrowInnerEnd_id();
709 }
710 unsigned int GetLeftEyebrowOuterEndId() final
711 {
712 return inno_local_Face_Get_LeftEyebrowOuterEnd_id();
713 }
714 unsigned int GetRightEdgeId() final
715 {
716 return inno_local_Face_Get_RightEdge_id();
717 }
718 unsigned int GetChinTipId() final
719 {
720 return inno_local_Face_Get_ChinTip_id();
721 }
722 unsigned int GetLeftEdgeId() final
723 {
724 return inno_local_Face_Get_LeftEdge_id();
725 }
726 float GetPassiveLivenessFast(const std::shared_ptr<Logger>& logger,
727 void* faceItem,
728 ErrorCallbacks errorCallbacks) final
729 {
730 const CallbackLogger slog(logger);
731 return inno_local_Face_Get_PassiveLivenessFast(slog.GetCallbacks(), faceItem, errorCallbacks);
732 }
733 float GetPassiveLivenessAccurate(const std::shared_ptr<Logger>& logger,
734 void* faceItem,
735 ErrorCallbacks errorCallbacks) final
736 {
737 const CallbackLogger slog(logger);
738 return inno_local_Face_Get_PassiveLivenessAccurate(slog.GetCallbacks(), faceItem, errorCallbacks);
739 }
740 void* CreateOFIQFace(const std::shared_ptr<Logger>& logger,
741 const uint8_t* data,
742 size_t width,
743 size_t height,
744 unsigned int dpi,
745 size_t size,
746 FaceDestroyer* deleter,
747 ErrorCallbacks errorCallbacks) final
748 {
749 const CallbackLogger slog(logger);
750 return inno_local_CreateOFIQFace(slog.GetCallbacks(),
751 data,
752 width,
753 height,
754 dpi,
755 size,
756 deleter,
757 errorCallbacks);
758 }
759 unsigned int GetMaxId() final
760 {
761 return inno_local_Face_Get_Max_Attribute_id();
762 }
763 void DeleteBytes(uint8_t* bytes) final
764 {
765 inno_local_Face_DeleteBytes(bytes);
766 }
767 LocalFaceExecutor() = default;
768 virtual ~LocalFaceExecutor() = default;
769 LocalFaceExecutor(const LocalFaceExecutor&) = delete;
770 LocalFaceExecutor(LocalFaceExecutor&&) = delete;
771 LocalFaceExecutor& operator=(const LocalFaceExecutor&) = delete;
772 LocalFaceExecutor& operator=(LocalFaceExecutor&&) = delete;
773 };
774
775 extern "C"
776 {
777 struct inno_grcp_FaceChannel;
778 INNO_ENROLLMENT_API inno_grcp_FaceChannel* inno_grpc_Face_Channel_Create(const char* endpoint);
779 INNO_ENROLLMENT_API void inno_grpc_Face_Channel_Destroy(inno_grcp_FaceChannel* channel);
780
781 INNO_ENROLLMENT_API inno_FaceDetector_result inno_grpc_FaceDetector_Detect(inno_grcp_FaceChannel* channel,
782 LoggerCallBacks logCallbacks,
783 unsigned int height,
784 unsigned int width,
785 unsigned int dpi,
786 const uint8_t* data,
787 size_t size,
788 float minFaceSize,
789 float maxFaceSize,
790 unsigned int type,
791 ErrorCallbacks errorCallbacks);
792 INNO_ENROLLMENT_API void inno_grpc_FaceDetector_ReleaseItem(void* faceItem);
793 INNO_ENROLLMENT_API inno_FaceCrop_Rectangle inno_grpc_FaceCrop_CropRectangle(void* faceItem,
794 unsigned int cropMethod,
795 float cropScale,
796 ErrorCallbacks errorCallbacks);
797 INNO_ENROLLMENT_API void inno_grpc_FaceCrop_CropImage(void* face,
798 unsigned int cropMethod,
799 float cropScale,
800 unsigned char red,
801 unsigned char green,
802 unsigned char blue,
803 unsigned int* cropWidth,
804 unsigned int* cropHeight,
805 FaceAllocator allocator,
806 void* container,
807 ErrorCallbacks errorCallbacks);
808
809 INNO_ENROLLMENT_API float inno_grpc_Face_GetAttribute(void* faceItem,
810 unsigned int attrId,
811 const inno_FaceParams* params,
812 size_t paramsSize,
813 ErrorCallbacks errorCallbacks);
814 INNO_ENROLLMENT_API void inno_grpc_Face_GetKeypoint(void* faceItem,
815 unsigned int id,
816 float* score,
817 float* x,
818 float* y,
819 ErrorCallbacks errorCallbacks);
820 INNO_ENROLLMENT_API void inno_grpc_Face_FaceAreaMask(void* faceItem,
821 unsigned int* width,
822 unsigned int* height,
823 uint8_t** data,
824 size_t* length,
825 unsigned int cropMethod,
826 float cropScale,
827 ErrorCallbacks errorCallbacks);
828 INNO_ENROLLMENT_API int inno_grpc_Face_FaceAreaSegmentation(void* faceItem,
829 unsigned int* width,
830 unsigned int* height,
831 uint8_t** data,
832 size_t* length,
833 unsigned int cropMethod,
834 float cropScale,
835 ErrorCallbacks errorCallbacks);
836 INNO_ENROLLMENT_API void inno_grpc_Face_FaceAreaSegmentationColor(void* faceItem,
837 unsigned int* width,
838 unsigned int* height,
839 uint8_t** data,
840 size_t* length,
841 unsigned int cropMethod,
842 float cropScale,
843 unsigned char red,
844 unsigned char green,
845 unsigned char blue,
846 ErrorCallbacks errorCallbacks);
847 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_Sharpness_id();
848 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_Brightness_id();
849 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_Contrast_id();
850 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_UniqueIntensityLevels_id();
851 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_Shadow_id();
852 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_NoseShadow_id();
853 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_Specularity_id();
854 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_EyeGaze_id();
855 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_EyeStatusR_id();
856 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_EyeStatusL_id();
857 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_GlassStatus_id();
858 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_HeavyFrame_id();
859 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_MouthStatus_id();
860 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_BackgroundUniformity_id();
861 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_Age_id();
862 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_RedEyeR_id();
863 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_RedEyeL_id();
864 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_Roll_id();
865 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_Yaw_id();
866 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_Pitch_id();
867 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_Gender_id();
868 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_EyeDistance_id();
869 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_FaceRelativeArea_id();
870 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_FaceRelativeAreaInImage_id();
871 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_RollAngle_id();
872 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_PitchAngle_id();
873 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_YawAngle_id();
874 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_FaceSize_id();
875 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_Mask_id();
876 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_TintedGlasses_id();
877 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_RightEyeOuterCorner_id();
878 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_RightEyeCentre_id();
879 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_RightEyeInnerCorner_id();
880 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_LeftEyeInnerCorner_id();
881 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_LeftEyeCentre_id();
882 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_LeftEyeOuterCorner_id();
883 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_NoseRoot_id();
884 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_NoseRightBottom_id();
885 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_NoseTip_id();
886 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_NoseLeftBottom_id();
887 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_NoseBottom_id();
888 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_MouthRightCorner_id();
889 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_MouthCenter_id();
890 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_MouthLeftCorner_id();
891 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_MouthUpperEdge_id();
892 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_MouthLowerEdge_id();
893 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_RightEyebrowOuterEnd_id();
894 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_RightEyebrowInnerEnd_id();
895 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_LeftEyebrowInnerEnd_id();
896 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_LeftEyebrowOuterEnd_id();
897 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_RightEdge_id();
898 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_ChinTip_id();
899 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_LeftEdge_id();
900 INNO_ENROLLMENT_API float inno_grpc_Face_Get_PassiveLivenessFast(LoggerCallBacks logCallbacks,
901 void* faceItem,
902 ErrorCallbacks errorCallbacks);
903 INNO_ENROLLMENT_API float inno_grpc_Face_Get_PassiveLivenessAccurate(LoggerCallBacks logCallbacks,
904 void* faceItem,
905 ErrorCallbacks errorCallbacks);
906 INNO_ENROLLMENT_API unsigned int inno_grpc_Face_Get_Max_id();
907 INNO_ENROLLMENT_API void inno_grpc_Face_DeleteBytes(const uint8_t* bytes);
908 INNO_ENROLLMENT_API void inno_grpc_Face_Extract(void* faceItem,
909 FaceAllocator allocator,
910 void* container,
911 unsigned int extractorType,
912 ErrorCallbacks errorCallbacks);
913 INNO_ENROLLMENT_API void inno_grpc_Face_Match(void* faceItem,
914 const uint8_t* probe,
915 size_t probeSize,
916 const uint8_t* gallery,
917 size_t gallerySize,
918 float* score,
919 ErrorCallbacks errorCallbacks);
920 INNO_ENROLLMENT_API int inno_grpc_Face_TemplateEmbeddingInfo(void* faceItem,
921 const uint8_t* tmpl,
922 size_t tmplSize,
923 int32_t* quality,
924 uint32_t* modelVersion,
925 uint32_t* enrollmentVersion,
926 ErrorCallbacks errorCallbacks);
927 INNO_ENROLLMENT_API void* inno_grpc_CreateOFIQFace(inno_grcp_FaceChannel* channel,
928 LoggerCallBacks logCallbacks,
929 const uint8_t* data,
930 size_t width,
931 size_t height,
932 unsigned int dpi,
933 size_t size,
934 FaceDestroyer* deleter,
935 ErrorCallbacks errorCallbacks);
936 }
937
938 class GrpcFaceExecutor : public FaceExecutor
939 {
940 public:
941 inno_FaceDetector_result Detect(const std::shared_ptr<Logger>& log,
942 unsigned int height,
943 unsigned int width,
944 unsigned int dpi,
945 const uint8_t* data,
946 size_t dataSize,
947 float minFaceSize,
948 float maxFaceSize,
949 unsigned int type,
950 ErrorCallbacks errorCallbacks) final
951 {
952 const CallbackLogger slog(log);
953 return inno_grpc_FaceDetector_Detect(channel.get(),
954 slog.GetCallbacks(),
955 height,
956 width,
957 dpi,
958 data,
959 dataSize,
960 minFaceSize,
961 maxFaceSize,
962 type,
963 errorCallbacks);
964 }
965 void Extract(void* faceItem,
966 FaceAllocator allocator,
967 void* container,
968 unsigned int extractorType,
969 ErrorCallbacks errorCallbacks) final
970 {
971 inno_grpc_Face_Extract(faceItem, allocator, container, extractorType, errorCallbacks);
972 }
973 void Match(const uint8_t* probe,
974 size_t probeSize,
975 const uint8_t* gallery,
976 size_t gallerySize,
977 float* score,
978 ErrorCallbacks errorCallbacks) final
979 {
980 inno_grpc_Face_Match(channel.get(), probe, probeSize, gallery, gallerySize, score, errorCallbacks);
981 }
982
983 int GetTemplateEmbeddingInfo(const uint8_t* tmpl,
984 size_t tmplSize,
985 int32_t* quality,
986 uint32_t* modelVersion,
987 uint32_t* enrollmentVersion,
988 ErrorCallbacks errorCallbacks) final
989 {
990 return inno_grpc_Face_TemplateEmbeddingInfo(
991 channel.get(), tmpl, tmplSize, quality, modelVersion, enrollmentVersion, errorCallbacks);
992 }
993
994 FaceDestroyer DestroyImpl() final
995 {
996 return inno_grpc_FaceDetector_ReleaseItem;
997 }
998 inno_FaceCrop_Rectangle CropRectangle(void* faceItem,
999 unsigned int cropMethod,
1000 float cropScale,
1001 ErrorCallbacks errorCallbacks) final
1002 {
1003 return inno_grpc_FaceCrop_CropRectangle(faceItem, cropMethod, cropScale, errorCallbacks);
1004 }
1005 void CropImage(void* face,
1006 unsigned int cropMethod,
1007 float cropScale,
1008 unsigned char red,
1009 unsigned char green,
1010 unsigned char blue,
1011 unsigned int* cropWidth,
1012 unsigned int* cropHeight,
1013 FaceAllocator allocator,
1014 void* container,
1015 ErrorCallbacks errorCallbacks) final
1016 {
1017 inno_grpc_FaceCrop_CropImage(face,
1018 cropMethod,
1019 cropScale,
1020 red,
1021 green,
1022 blue,
1023 cropWidth,
1024 cropHeight,
1025 allocator,
1026 container,
1027 errorCallbacks);
1028 }
1029 float GetAttribute(const std::shared_ptr<Logger>& /*log*/,
1030 void* faceItem,
1031 unsigned int id,
1032 const inno_FaceParams* params,
1033 size_t paramsSize,
1034 ErrorCallbacks errorCallbacks) final
1035 {
1036 return inno_grpc_Face_GetAttribute(faceItem, id, params, paramsSize, errorCallbacks);
1037 }
1038 void GetKeypoint(const std::shared_ptr<Logger>& /*log*/,
1039 void* faceItem,
1040 unsigned int id,
1041 float* score,
1042 float* x,
1043 float* y,
1044 ErrorCallbacks errorCallbacks) final
1045 {
1046 inno_grpc_Face_GetKeypoint(faceItem, id, score, x, y, errorCallbacks);
1047 }
1048 void FaceAreaMask(void* faceItem,
1049 unsigned int* width,
1050 unsigned int* height,
1051 uint8_t** data,
1052 size_t* length,
1053 unsigned int cropMethod,
1054 float cropScale,
1055 ErrorCallbacks errorCallbacks) final
1056 {
1057 inno_grpc_Face_FaceAreaMask(faceItem, width, height, data, length, cropMethod, cropScale, errorCallbacks);
1058 }
1059 int FaceAreaSegmentation(void* faceItem,
1060 unsigned int* width,
1061 unsigned int* height,
1062 uint8_t** data,
1063 size_t* length,
1064 unsigned int cropMethod,
1065 float cropScale,
1066 ErrorCallbacks errorCallbacks) final
1067 {
1068 return inno_grpc_Face_FaceAreaSegmentation(
1069 faceItem, width, height, data, length, cropMethod, cropScale, errorCallbacks);
1070 }
1071 void FaceAreaSegmentationColor(void* faceItem,
1072 unsigned int* width,
1073 unsigned int* height,
1074 uint8_t** data,
1075 size_t* length,
1076 unsigned int cropMethod,
1077 float cropScale,
1078 unsigned char red,
1079 unsigned char green,
1080 unsigned char blue,
1081 ErrorCallbacks errorCallbacks) final
1082 {
1083 inno_grpc_Face_FaceAreaSegmentationColor(
1084 faceItem, width, height, data, length, cropMethod, cropScale, red, green, blue, errorCallbacks);
1085 }
1086 unsigned int GetSharpnessId() final
1087 {
1088 return inno_grpc_Face_Get_Sharpness_id();
1089 }
1090 unsigned int GetBrightnessId() final
1091 {
1092 return inno_grpc_Face_Get_Brightness_id();
1093 }
1094 unsigned int GetContrastId() final
1095 {
1096 return inno_grpc_Face_Get_Contrast_id();
1097 }
1098 unsigned int GetUniqueIntensityLevelsId() final
1099 {
1100 return inno_grpc_Face_Get_UniqueIntensityLevels_id();
1101 }
1102 unsigned int GetShadowId() final
1103 {
1104 return inno_grpc_Face_Get_Shadow_id();
1105 }
1106 unsigned int GetNoseShadowId() final
1107 {
1108 return inno_grpc_Face_Get_NoseShadow_id();
1109 }
1110 unsigned int GetSpecularityId() final
1111 {
1112 return inno_grpc_Face_Get_Specularity_id();
1113 }
1114 unsigned int GetEyeGazeId() final
1115 {
1116 return inno_grpc_Face_Get_EyeGaze_id();
1117 }
1118 unsigned int GetEyeStatusRId() final
1119 {
1120 return inno_grpc_Face_Get_EyeStatusR_id();
1121 }
1122 unsigned int GetEyeStatusLId() final
1123 {
1124 return inno_grpc_Face_Get_EyeStatusL_id();
1125 }
1126 unsigned int GetGlassStatusId() final
1127 {
1128 return inno_grpc_Face_Get_GlassStatus_id();
1129 }
1130 unsigned int GetHeavyFrameId() final
1131 {
1132 return inno_grpc_Face_Get_HeavyFrame_id();
1133 }
1134 unsigned int GetMouthStatusId() final
1135 {
1136 return inno_grpc_Face_Get_MouthStatus_id();
1137 }
1138 unsigned int GetBackgroundUniformityId() final
1139 {
1140 return inno_grpc_Face_Get_BackgroundUniformity_id();
1141 }
1142 unsigned int GetAgeId() final
1143 {
1144 return inno_grpc_Face_Get_Age_id();
1145 }
1146 unsigned int GetRedEyeRId() final
1147 {
1148 return inno_grpc_Face_Get_RedEyeR_id();
1149 }
1150 unsigned int GetRedEyeLId() final
1151 {
1152 return inno_grpc_Face_Get_RedEyeL_id();
1153 }
1154 unsigned int GetGenderId() final
1155 {
1156 return inno_grpc_Face_Get_Gender_id();
1157 }
1158 unsigned int GetEyeDistanceId() final
1159 {
1160 return inno_grpc_Face_Get_EyeDistance_id();
1161 }
1162 unsigned int GetFaceRelativeAreaId() final
1163 {
1164 return inno_grpc_Face_Get_FaceRelativeArea_id();
1165 }
1166 unsigned int GetFaceRelativeAreaInImageId() final
1167 {
1168 return inno_grpc_Face_Get_FaceRelativeAreaInImage_id();
1169 }
1170 unsigned int GetRollAngleId() final
1171 {
1172 return inno_grpc_Face_Get_RollAngle_id();
1173 }
1174 unsigned int GetPitchAngleId() final
1175 {
1176 return inno_grpc_Face_Get_PitchAngle_id();
1177 }
1178 unsigned int GetYawAngleId() final
1179 {
1180 return inno_grpc_Face_Get_YawAngle_id();
1181 }
1182 unsigned int GetFaceSizeId() final
1183 {
1184 return inno_grpc_Face_Get_FaceSize_id();
1185 }
1186 unsigned int GetMaskId() final
1187 {
1188 return inno_grpc_Face_Get_Mask_id();
1189 }
1190 unsigned int GetTintedGlassesId() final
1191 {
1192 return inno_grpc_Face_Get_TintedGlasses_id();
1193 }
1194 unsigned int GetRightEyeOuterCornerId() final
1195 {
1196 return inno_grpc_Face_Get_RightEyeOuterCorner_id();
1197 }
1198 unsigned int GetRightEyeCentreId() final
1199 {
1200 return inno_grpc_Face_Get_RightEyeCentre_id();
1201 }
1202 unsigned int GetRightEyeInnerCornerId() final
1203 {
1204 return inno_grpc_Face_Get_RightEyeInnerCorner_id();
1205 }
1206 unsigned int GetLeftEyeInnerCornerId() final
1207 {
1208 return inno_grpc_Face_Get_LeftEyeInnerCorner_id();
1209 }
1210 unsigned int GetLeftEyeCentreId() final
1211 {
1212 return inno_grpc_Face_Get_LeftEyeCentre_id();
1213 }
1214 unsigned int GetLeftEyeOuterCornerId() final
1215 {
1216 return inno_grpc_Face_Get_LeftEyeOuterCorner_id();
1217 }
1218 unsigned int GetNoseRootId() final
1219 {
1220 return inno_grpc_Face_Get_NoseRoot_id();
1221 }
1222 unsigned int GetNoseRightBottomId() final
1223 {
1224 return inno_grpc_Face_Get_NoseRightBottom_id();
1225 }
1226 unsigned int GetNoseTipId() final
1227 {
1228 return inno_grpc_Face_Get_NoseTip_id();
1229 }
1230 unsigned int GetNoseLeftBottomId() final
1231 {
1232 return inno_grpc_Face_Get_NoseLeftBottom_id();
1233 }
1234 unsigned int GetNoseBottomId() final
1235 {
1236 return inno_grpc_Face_Get_NoseBottom_id();
1237 }
1238 unsigned int GetMouthRightCornerId() final
1239 {
1240 return inno_grpc_Face_Get_MouthRightCorner_id();
1241 }
1242 unsigned int GetMouthCenterId() final
1243 {
1244 return inno_grpc_Face_Get_MouthCenter_id();
1245 }
1246 unsigned int GetMouthLeftCornerId() final
1247 {
1248 return inno_grpc_Face_Get_MouthLeftCorner_id();
1249 }
1250 unsigned int GetMouthUpperEdgeId() final
1251 {
1252 return inno_grpc_Face_Get_MouthUpperEdge_id();
1253 }
1254 unsigned int GetMouthLowerEdgeId() final
1255 {
1256 return inno_grpc_Face_Get_MouthLowerEdge_id();
1257 }
1258 unsigned int GetRightEyebrowOuterEndId() final
1259 {
1260 return inno_grpc_Face_Get_RightEyebrowOuterEnd_id();
1261 }
1262 unsigned int GetRightEyebrowInnerEndId() final
1263 {
1264 return inno_grpc_Face_Get_RightEyebrowInnerEnd_id();
1265 }
1266 unsigned int GetLeftEyebrowInnerEndId() final
1267 {
1268 return inno_grpc_Face_Get_LeftEyebrowInnerEnd_id();
1269 }
1270 unsigned int GetLeftEyebrowOuterEndId() final
1271 {
1272 return inno_grpc_Face_Get_LeftEyebrowOuterEnd_id();
1273 }
1274 unsigned int GetRightEdgeId() final
1275 {
1276 return inno_grpc_Face_Get_RightEdge_id();
1277 }
1278 unsigned int GetChinTipId() final
1279 {
1280 return inno_grpc_Face_Get_ChinTip_id();
1281 }
1282 unsigned int GetLeftEdgeId() final
1283 {
1284 return inno_grpc_Face_Get_LeftEdge_id();
1285 }
1286 float GetPassiveLivenessFast(const std::shared_ptr<Logger>& logger,
1287 void* faceItem,
1288 ErrorCallbacks errorCallbacks) final
1289 {
1290 const CallbackLogger slog(logger);
1291 return inno_grpc_Face_Get_PassiveLivenessFast(slog.GetCallbacks(), faceItem, errorCallbacks);
1292 }
1293 float GetPassiveLivenessAccurate(const std::shared_ptr<Logger>& logger,
1294 void* faceItem,
1295 ErrorCallbacks errorCallbacks) final
1296 {
1297 const CallbackLogger slog(logger);
1298 return inno_grpc_Face_Get_PassiveLivenessAccurate(slog.GetCallbacks(), faceItem, errorCallbacks);
1299 }
1300 void* CreateOFIQFace(const std::shared_ptr<Logger>& logger,
1301 const uint8_t* data,
1302 size_t width,
1303 size_t height,
1304 unsigned int dpi,
1305 size_t size,
1306 FaceDestroyer* deleter,
1307 ErrorCallbacks errorCallbacks) final
1308 {
1309 const CallbackLogger slog(logger);
1310 return inno_grpc_CreateOFIQFace(channel.get(),
1311 slog.GetCallbacks(),
1312 data,
1313 width,
1314 height,
1315 dpi,
1316 size,
1317 deleter,
1318 errorCallbacks);
1319 }
1320 unsigned int GetMaxId() final
1321 {
1322 return inno_grpc_Face_Get_Max_id();
1323 }
1324 void DeleteBytes(uint8_t* bytes) final
1325 {
1326 inno_grpc_Face_DeleteBytes(bytes);
1327 }
1333 explicit GrpcFaceExecutor(const std::string& endPoint)
1334 : channel(inno_grpc_Face_Channel_Create(endPoint.c_str()), inno_grpc_Face_Channel_Destroy)
1335 {
1336 }
1337
1338 GrpcFaceExecutor() = delete;
1339 virtual ~GrpcFaceExecutor() = default;
1340 GrpcFaceExecutor(const GrpcFaceExecutor&) = delete;
1341 GrpcFaceExecutor(GrpcFaceExecutor&&) = delete;
1342 GrpcFaceExecutor& operator=(const GrpcFaceExecutor&) = delete;
1343 GrpcFaceExecutor& operator=(GrpcFaceExecutor&&) = delete;
1344
1345 private:
1346 std::unique_ptr<inno_grcp_FaceChannel, void (*)(inno_grcp_FaceChannel*)> channel;
1347 };
1348
1355 class GlobalFaceExecutor
1356 {
1357 public:
1362 static std::shared_ptr<FaceExecutor> Get()
1363 {
1364 return GlobalFaceExecutor::Instance().GetInternal();
1365 }
1366
1372 static void Set(std::shared_ptr<FaceExecutor> executor)
1373 {
1374 if (executor == nullptr)
1375 {
1376 throw NullArgumentException("executor can not be null");
1377 }
1378
1379 GlobalFaceExecutor::Instance().SetInternal(std::move(executor));
1380 }
1381
1382 GlobalFaceExecutor() = delete;
1383 virtual ~GlobalFaceExecutor() = default;
1384 GlobalFaceExecutor(const GlobalFaceExecutor&) = delete;
1386 GlobalFaceExecutor& operator=(const GlobalFaceExecutor&) = delete;
1387 GlobalFaceExecutor& operator=(GlobalFaceExecutor&&) = delete;
1388
1389 private:
1390 std::shared_ptr<FaceExecutor> pe;
1391 std::mutex peMux;
1392
1393 static GlobalFaceExecutor& Instance()
1394 {
1395 static GlobalFaceExecutor e(std::make_shared<LocalFaceExecutor>());
1396 return e;
1397 }
1398
1399 std::shared_ptr<FaceExecutor> GetInternal()
1400 {
1401 const std::scoped_lock lock(peMux);
1402 return pe;
1403 }
1404
1405 void SetInternal(std::shared_ptr<FaceExecutor> executor)
1406 {
1407 const std::scoped_lock lock(peMux);
1408 pe = std::move(executor);
1409 }
1410
1411 // clang-tidy false positive
1412 // NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init,hicpp-member-init)
1413 explicit GlobalFaceExecutor(std::shared_ptr<FaceExecutor> e)
1414 : pe(std::move(e))
1415 {
1416 }
1417 };
1418} // namespace inno
1419// NOLINTEND(readability-convert-member-functions-to-static)
Holds instance of FaceExecutor.
Definition FaceExecutor.h:1355
static std::shared_ptr< FaceExecutor > Get()
Provides current executor.
Definition FaceExecutor.h:1361
static void Set(std::shared_ptr< FaceExecutor > executor)
Sets new global executor.
Definition FaceExecutor.h:1371
Null argument is not allowed.
Definition EnrollmentException.h:156
LoggerCallBacks contains logger handle and function pointers as callbacks.
Definition Logger.h:137