13#include "enrollment/Export.h"
30 struct INNO_ENROLLMENT_API inno_FaceCrop_Rectangle
42 struct INNO_ENROLLMENT_API inno_FaceDetector_face
45 inno_FaceCrop_Rectangle roundingBox;
46 unsigned int confidence;
49 struct INNO_ENROLLMENT_API inno_FaceDetector_result
51 static const unsigned int MaxFaces = 16;
52 inno_FaceDetector_face faces[MaxFaces];
55 struct INNO_ENROLLMENT_API inno_FaceParams
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;
63 using FaceDestroyer = void (*)(
void*);
64 using FaceAllocator = uint8_t* (*)(
void*,
size_t);
70 static constexpr size_t MaxErrorMessage = 200;
71 virtual inno_FaceDetector_result Detect(
const std::shared_ptr<Logger>& log,
80 ErrorCallbacks errorCallbacks) = 0;
81 virtual void Extract(
void* faceItem,
82 FaceAllocator allocator,
84 unsigned int extractorType,
85 ErrorCallbacks errorCallbacks) = 0;
86 virtual void Match(
const uint8_t* probe,
88 const uint8_t* gallery,
91 ErrorCallbacks errorCallbacks) = 0;
92 virtual int GetTemplateEmbeddingInfo(
const uint8_t* tmpl,
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,
102 ErrorCallbacks errorCallbacks) = 0;
103 virtual void CropImage(
void* face,
104 unsigned int cropMethod,
109 unsigned int* cropWidth,
110 unsigned int* cropHeight,
111 FaceAllocator allocator,
113 ErrorCallbacks errorCallbacks) = 0;
114 virtual float GetAttribute(
const std::shared_ptr<Logger>& log,
117 const inno_FaceParams* params,
119 ErrorCallbacks errorCallbacks) = 0;
120 virtual void GetKeypoint(
const std::shared_ptr<Logger>& ,
126 ErrorCallbacks errorCallbacks) = 0;
127 virtual void FaceAreaMask(
void* faceItem,
129 unsigned int* height,
132 unsigned int cropMethod,
134 ErrorCallbacks errorCallbacks) = 0;
135 virtual int FaceAreaSegmentation(
void* faceItem,
137 unsigned int* height,
140 unsigned int cropMethod,
142 ErrorCallbacks errorCallbacks) = 0;
143 virtual void FaceAreaSegmentationColor(
void* faceItem,
145 unsigned int* height,
148 unsigned int cropMethod,
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;
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;
206 virtual float GetPassiveLivenessFast(
const std::shared_ptr<Logger>& logger,
208 ErrorCallbacks errorCallbacks) = 0;
209 virtual float GetPassiveLivenessAccurate(
const std::shared_ptr<Logger>& logger,
211 ErrorCallbacks errorCallbacks) = 0;
212 virtual void* CreateOFIQFace(
const std::shared_ptr<Logger>& logger,
218 FaceDestroyer* deleter,
219 ErrorCallbacks errorCallbacks) = 0;
221 virtual unsigned int GetMaxId() = 0;
222 virtual void DeleteBytes(uint8_t*) = 0;
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;
234 INNO_ENROLLMENT_API inno_FaceDetector_result inno_local_FaceDetector_Detect(LoggerCallBacks logCallbacks,
237 unsigned int resolution,
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,
247 ErrorCallbacks errorCallbacks);
248 INNO_ENROLLMENT_API
void inno_local_FaceCrop_CropImage(
void* face,
249 unsigned int cropMethod,
254 unsigned int* cropWidth,
255 unsigned int* cropHeight,
256 FaceAllocator allocator,
258 ErrorCallbacks errorCallbacks);
260 INNO_ENROLLMENT_API
float inno_local_Face_GetAttribute(LoggerCallBacks logCallbacks,
263 const inno_FaceParams* params,
265 ErrorCallbacks errorCallbacks);
266 INNO_ENROLLMENT_API
void inno_local_Face_GetKeypoint(LoggerCallBacks logCallbacks,
272 ErrorCallbacks errorCallbacks);
273 INNO_ENROLLMENT_API
void inno_local_Face_FaceAreaMask(
void* faceItem,
275 unsigned int* height,
278 unsigned int cropMethod,
280 ErrorCallbacks errorCallbacks);
281 INNO_ENROLLMENT_API
int inno_local_Face_FaceAreaSegmentation(
void* faceItem,
283 unsigned int* height,
286 unsigned int cropMethod,
288 ErrorCallbacks errorCallbacks);
289 INNO_ENROLLMENT_API
void inno_local_Face_FaceAreaSegmentationColor(
void* faceItem,
291 unsigned int* height,
294 unsigned int cropMethod,
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,
353 ErrorCallbacks errorCallbacks);
354 INNO_ENROLLMENT_API
float inno_local_Face_Get_PassiveLivenessAccurate(LoggerCallBacks logCallbacks,
356 ErrorCallbacks errorCallbacks);
357 INNO_ENROLLMENT_API
void* inno_local_CreateOFIQFace(LoggerCallBacks logCallbacks,
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,
369 unsigned int extractorType,
370 ErrorCallbacks errorCallbacks);
371 INNO_ENROLLMENT_API
void inno_local_Face_Match(
const uint8_t* probe,
373 const uint8_t* gallery,
374 size_t galleryLength,
376 ErrorCallbacks errorCallbacks);
377 INNO_ENROLLMENT_API
int inno_local_Face_TemplateEmbeddingInfo(
const uint8_t* tmpl,
380 uint32_t* modelVersion,
381 uint32_t* enrollmentVersion,
382 ErrorCallbacks errorCallbacks);
385 class LocalFaceExecutor :
public FaceExecutor
388 inno_FaceDetector_result Detect(
const std::shared_ptr<Logger>& log,
397 ErrorCallbacks errorCallbacks)
final
399 const CallbackLogger slog(log);
400 return inno_local_FaceDetector_Detect(
401 slog.GetCallbacks(), height, width, dpi, data, minFaceSize, maxFaceSize, type, errorCallbacks);
403 void Extract(
void* faceItem,
404 FaceAllocator allocator,
406 unsigned int extractorType,
407 ErrorCallbacks errorCallbacks)
final
409 inno_local_Face_Extract(faceItem, allocator, container, extractorType, errorCallbacks);
411 void Match(
const uint8_t* probe,
413 const uint8_t* gallery,
416 ErrorCallbacks errorCallbacks)
final
418 inno_local_Face_Match(probe, probeSize, gallery, gallerySize, score, errorCallbacks);
420 int GetTemplateEmbeddingInfo(
const uint8_t* tmpl,
423 uint32_t* modelVersion,
424 uint32_t* enrollmentVersion,
425 ErrorCallbacks errorCallbacks)
final
427 return inno_local_Face_TemplateEmbeddingInfo(
428 tmpl, tmplSize, quality, modelVersion, enrollmentVersion, errorCallbacks);
431 FaceDestroyer DestroyImpl() final
433 return inno_local_Face_ReleaseItem;
435 inno_FaceCrop_Rectangle CropRectangle(
void* face,
436 unsigned int cropMethod,
438 ErrorCallbacks errorCallbacks)
final
440 return inno_local_FaceCrop_CropRectangle(face, cropMethod, cropScale, errorCallbacks);
442 void CropImage(
void* face,
443 unsigned int cropMethod,
448 unsigned int* cropWidth,
449 unsigned int* cropHeight,
450 FaceAllocator allocator,
452 ErrorCallbacks errorCallbacks)
final
454 inno_local_FaceCrop_CropImage(face,
467 float GetAttribute(
const std::shared_ptr<Logger>& log,
470 const inno_FaceParams* params,
472 ErrorCallbacks errorCallbacks)
final
474 const CallbackLogger slog(log);
475 return inno_local_Face_GetAttribute(slog.GetCallbacks(), faceItem,
id, params, paramsSize, errorCallbacks);
477 void GetKeypoint(
const std::shared_ptr<Logger>& log,
483 ErrorCallbacks errorCallbacks)
final
485 const CallbackLogger slog(log);
486 inno_local_Face_GetKeypoint(slog.GetCallbacks(), faceItem,
id, score, x, y, errorCallbacks);
488 void FaceAreaMask(
void* faceItem,
490 unsigned int* height,
493 unsigned int cropMethod,
495 ErrorCallbacks errorCallbacks)
final
497 inno_local_Face_FaceAreaMask(faceItem, width, height, data, length, cropMethod, cropScale, errorCallbacks);
499 int FaceAreaSegmentation(
void* faceItem,
501 unsigned int* height,
504 unsigned int cropMethod,
506 ErrorCallbacks errorCallbacks)
final
508 return inno_local_Face_FaceAreaSegmentation(
509 faceItem, width, height, data, length, cropMethod, cropScale, errorCallbacks);
511 void FaceAreaSegmentationColor(
void* faceItem,
513 unsigned int* height,
516 unsigned int cropMethod,
521 ErrorCallbacks errorCallbacks)
final
523 inno_local_Face_FaceAreaSegmentationColor(
524 faceItem, width, height, data, length, cropMethod, cropScale, red, green, blue, errorCallbacks);
526 unsigned int GetSharpnessId() final
528 return inno_local_Face_Get_Sharpness_id();
530 unsigned int GetBrightnessId() final
532 return inno_local_Face_Get_Brightness_id();
534 unsigned int GetContrastId() final
536 return inno_local_Face_Get_Contrast_id();
538 unsigned int GetUniqueIntensityLevelsId() final
540 return inno_local_Face_Get_UniqueIntensityLevels_id();
542 unsigned int GetShadowId() final
544 return inno_local_Face_Get_Shadow_id();
546 unsigned int GetNoseShadowId() final
548 return inno_local_Face_Get_NoseShadow_id();
550 unsigned int GetSpecularityId() final
552 return inno_local_Face_Get_Specularity_id();
554 unsigned int GetEyeGazeId() final
556 return inno_local_Face_Get_EyeGaze_id();
558 unsigned int GetEyeStatusRId() final
560 return inno_local_Face_Get_EyeStatusR_id();
562 unsigned int GetEyeStatusLId() final
564 return inno_local_Face_Get_EyeStatusL_id();
566 unsigned int GetGlassStatusId() final
568 return inno_local_Face_Get_GlassStatus_id();
570 unsigned int GetHeavyFrameId() final
572 return inno_local_Face_Get_HeavyFrame_id();
574 unsigned int GetMouthStatusId() final
576 return inno_local_Face_Get_MouthStatus_id();
578 unsigned int GetBackgroundUniformityId() final
580 return inno_local_Face_Get_BackgroundUniformity_id();
582 unsigned int GetAgeId() final
584 return inno_local_Face_Get_Age_id();
586 unsigned int GetRedEyeRId() final
588 return inno_local_Face_Get_RedEyeR_id();
590 unsigned int GetRedEyeLId() final
592 return inno_local_Face_Get_RedEyeL_id();
594 unsigned int GetGenderId() final
596 return inno_local_Face_Get_Gender_id();
598 unsigned int GetEyeDistanceId() final
600 return inno_local_Face_Get_EyeDistance_id();
602 unsigned int GetFaceRelativeAreaId() final
604 return inno_local_Face_Get_FaceRelativeArea_id();
606 unsigned int GetFaceRelativeAreaInImageId() final
608 return inno_local_Face_Get_FaceRelativeAreaInImage_id();
610 unsigned int GetRollAngleId() final
612 return inno_local_Face_Get_RollAngle_id();
614 unsigned int GetPitchAngleId() final
616 return inno_local_Face_Get_PitchAngle_id();
618 unsigned int GetYawAngleId() final
620 return inno_local_Face_Get_YawAngle_id();
622 unsigned int GetFaceSizeId() final
624 return inno_local_Face_Get_FaceSize_id();
626 unsigned int GetMaskId() final
628 return inno_local_Face_Get_Mask_id();
630 unsigned int GetTintedGlassesId() final
632 return inno_local_Face_Get_TintedGlasses_id();
634 unsigned int GetRightEyeOuterCornerId() final
636 return inno_local_Face_Get_RightEyeOuterCorner_id();
638 unsigned int GetRightEyeCentreId() final
640 return inno_local_Face_Get_RightEyeCentre_id();
642 unsigned int GetRightEyeInnerCornerId() final
644 return inno_local_Face_Get_RightEyeInnerCorner_id();
646 unsigned int GetLeftEyeInnerCornerId() final
648 return inno_local_Face_Get_LeftEyeInnerCorner_id();
650 unsigned int GetLeftEyeCentreId() final
652 return inno_local_Face_Get_LeftEyeCentre_id();
654 unsigned int GetLeftEyeOuterCornerId() final
656 return inno_local_Face_Get_LeftEyeOuterCorner_id();
658 unsigned int GetNoseRootId() final
660 return inno_local_Face_Get_NoseRoot_id();
662 unsigned int GetNoseRightBottomId() final
664 return inno_local_Face_Get_NoseRightBottom_id();
666 unsigned int GetNoseTipId() final
668 return inno_local_Face_Get_NoseTip_id();
670 unsigned int GetNoseLeftBottomId() final
672 return inno_local_Face_Get_NoseLeftBottom_id();
674 unsigned int GetNoseBottomId() final
676 return inno_local_Face_Get_NoseBottom_id();
678 unsigned int GetMouthRightCornerId() final
680 return inno_local_Face_Get_MouthRightCorner_id();
682 unsigned int GetMouthCenterId() final
684 return inno_local_Face_Get_MouthCenter_id();
686 unsigned int GetMouthLeftCornerId() final
688 return inno_local_Face_Get_MouthLeftCorner_id();
690 unsigned int GetMouthUpperEdgeId() final
692 return inno_local_Face_Get_MouthUpperEdge_id();
694 unsigned int GetMouthLowerEdgeId() final
696 return inno_local_Face_Get_MouthLowerEdge_id();
698 unsigned int GetRightEyebrowOuterEndId() final
700 return inno_local_Face_Get_RightEyebrowOuterEnd_id();
702 unsigned int GetRightEyebrowInnerEndId() final
704 return inno_local_Face_Get_RightEyebrowInnerEnd_id();
706 unsigned int GetLeftEyebrowInnerEndId() final
708 return inno_local_Face_Get_LeftEyebrowInnerEnd_id();
710 unsigned int GetLeftEyebrowOuterEndId() final
712 return inno_local_Face_Get_LeftEyebrowOuterEnd_id();
714 unsigned int GetRightEdgeId() final
716 return inno_local_Face_Get_RightEdge_id();
718 unsigned int GetChinTipId() final
720 return inno_local_Face_Get_ChinTip_id();
722 unsigned int GetLeftEdgeId() final
724 return inno_local_Face_Get_LeftEdge_id();
726 float GetPassiveLivenessFast(
const std::shared_ptr<Logger>& logger,
728 ErrorCallbacks errorCallbacks)
final
730 const CallbackLogger slog(logger);
731 return inno_local_Face_Get_PassiveLivenessFast(slog.GetCallbacks(), faceItem, errorCallbacks);
733 float GetPassiveLivenessAccurate(
const std::shared_ptr<Logger>& logger,
735 ErrorCallbacks errorCallbacks)
final
737 const CallbackLogger slog(logger);
738 return inno_local_Face_Get_PassiveLivenessAccurate(slog.GetCallbacks(), faceItem, errorCallbacks);
740 void* CreateOFIQFace(
const std::shared_ptr<Logger>& logger,
746 FaceDestroyer* deleter,
747 ErrorCallbacks errorCallbacks)
final
749 const CallbackLogger slog(logger);
750 return inno_local_CreateOFIQFace(slog.GetCallbacks(),
759 unsigned int GetMaxId() final
761 return inno_local_Face_Get_Max_Attribute_id();
763 void DeleteBytes(uint8_t* bytes)
final
765 inno_local_Face_DeleteBytes(bytes);
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;
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);
781 INNO_ENROLLMENT_API inno_FaceDetector_result inno_grpc_FaceDetector_Detect(inno_grcp_FaceChannel* channel,
782 LoggerCallBacks logCallbacks,
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,
796 ErrorCallbacks errorCallbacks);
797 INNO_ENROLLMENT_API
void inno_grpc_FaceCrop_CropImage(
void* face,
798 unsigned int cropMethod,
803 unsigned int* cropWidth,
804 unsigned int* cropHeight,
805 FaceAllocator allocator,
807 ErrorCallbacks errorCallbacks);
809 INNO_ENROLLMENT_API
float inno_grpc_Face_GetAttribute(
void* faceItem,
811 const inno_FaceParams* params,
813 ErrorCallbacks errorCallbacks);
814 INNO_ENROLLMENT_API
void inno_grpc_Face_GetKeypoint(
void* faceItem,
819 ErrorCallbacks errorCallbacks);
820 INNO_ENROLLMENT_API
void inno_grpc_Face_FaceAreaMask(
void* faceItem,
822 unsigned int* height,
825 unsigned int cropMethod,
827 ErrorCallbacks errorCallbacks);
828 INNO_ENROLLMENT_API
int inno_grpc_Face_FaceAreaSegmentation(
void* faceItem,
830 unsigned int* height,
833 unsigned int cropMethod,
835 ErrorCallbacks errorCallbacks);
836 INNO_ENROLLMENT_API
void inno_grpc_Face_FaceAreaSegmentationColor(
void* faceItem,
838 unsigned int* height,
841 unsigned int cropMethod,
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,
902 ErrorCallbacks errorCallbacks);
903 INNO_ENROLLMENT_API
float inno_grpc_Face_Get_PassiveLivenessAccurate(LoggerCallBacks logCallbacks,
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,
911 unsigned int extractorType,
912 ErrorCallbacks errorCallbacks);
913 INNO_ENROLLMENT_API
void inno_grpc_Face_Match(
void* faceItem,
914 const uint8_t* probe,
916 const uint8_t* gallery,
919 ErrorCallbacks errorCallbacks);
920 INNO_ENROLLMENT_API
int inno_grpc_Face_TemplateEmbeddingInfo(
void* faceItem,
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,
934 FaceDestroyer* deleter,
935 ErrorCallbacks errorCallbacks);
938 class GrpcFaceExecutor :
public FaceExecutor
941 inno_FaceDetector_result Detect(
const std::shared_ptr<Logger>& log,
950 ErrorCallbacks errorCallbacks)
final
952 const CallbackLogger slog(log);
953 return inno_grpc_FaceDetector_Detect(channel.get(),
965 void Extract(
void* faceItem,
966 FaceAllocator allocator,
968 unsigned int extractorType,
969 ErrorCallbacks errorCallbacks)
final
971 inno_grpc_Face_Extract(faceItem, allocator, container, extractorType, errorCallbacks);
973 void Match(
const uint8_t* probe,
975 const uint8_t* gallery,
978 ErrorCallbacks errorCallbacks)
final
980 inno_grpc_Face_Match(channel.get(), probe, probeSize, gallery, gallerySize, score, errorCallbacks);
983 int GetTemplateEmbeddingInfo(
const uint8_t* tmpl,
986 uint32_t* modelVersion,
987 uint32_t* enrollmentVersion,
988 ErrorCallbacks errorCallbacks)
final
990 return inno_grpc_Face_TemplateEmbeddingInfo(
991 channel.get(), tmpl, tmplSize, quality, modelVersion, enrollmentVersion, errorCallbacks);
994 FaceDestroyer DestroyImpl() final
996 return inno_grpc_FaceDetector_ReleaseItem;
998 inno_FaceCrop_Rectangle CropRectangle(
void* faceItem,
999 unsigned int cropMethod,
1001 ErrorCallbacks errorCallbacks)
final
1003 return inno_grpc_FaceCrop_CropRectangle(faceItem, cropMethod, cropScale, errorCallbacks);
1005 void CropImage(
void* face,
1006 unsigned int cropMethod,
1009 unsigned char green,
1011 unsigned int* cropWidth,
1012 unsigned int* cropHeight,
1013 FaceAllocator allocator,
1015 ErrorCallbacks errorCallbacks)
final
1017 inno_grpc_FaceCrop_CropImage(face,
1029 float GetAttribute(
const std::shared_ptr<Logger>& ,
1032 const inno_FaceParams* params,
1034 ErrorCallbacks errorCallbacks)
final
1036 return inno_grpc_Face_GetAttribute(faceItem,
id, params, paramsSize, errorCallbacks);
1038 void GetKeypoint(
const std::shared_ptr<Logger>& ,
1044 ErrorCallbacks errorCallbacks)
final
1046 inno_grpc_Face_GetKeypoint(faceItem,
id, score, x, y, errorCallbacks);
1048 void FaceAreaMask(
void* faceItem,
1049 unsigned int* width,
1050 unsigned int* height,
1053 unsigned int cropMethod,
1055 ErrorCallbacks errorCallbacks)
final
1057 inno_grpc_Face_FaceAreaMask(faceItem, width, height, data, length, cropMethod, cropScale, errorCallbacks);
1059 int FaceAreaSegmentation(
void* faceItem,
1060 unsigned int* width,
1061 unsigned int* height,
1064 unsigned int cropMethod,
1066 ErrorCallbacks errorCallbacks)
final
1068 return inno_grpc_Face_FaceAreaSegmentation(
1069 faceItem, width, height, data, length, cropMethod, cropScale, errorCallbacks);
1071 void FaceAreaSegmentationColor(
void* faceItem,
1072 unsigned int* width,
1073 unsigned int* height,
1076 unsigned int cropMethod,
1079 unsigned char green,
1081 ErrorCallbacks errorCallbacks)
final
1083 inno_grpc_Face_FaceAreaSegmentationColor(
1084 faceItem, width, height, data, length, cropMethod, cropScale, red, green, blue, errorCallbacks);
1086 unsigned int GetSharpnessId() final
1088 return inno_grpc_Face_Get_Sharpness_id();
1090 unsigned int GetBrightnessId() final
1092 return inno_grpc_Face_Get_Brightness_id();
1094 unsigned int GetContrastId() final
1096 return inno_grpc_Face_Get_Contrast_id();
1098 unsigned int GetUniqueIntensityLevelsId() final
1100 return inno_grpc_Face_Get_UniqueIntensityLevels_id();
1102 unsigned int GetShadowId() final
1104 return inno_grpc_Face_Get_Shadow_id();
1106 unsigned int GetNoseShadowId() final
1108 return inno_grpc_Face_Get_NoseShadow_id();
1110 unsigned int GetSpecularityId() final
1112 return inno_grpc_Face_Get_Specularity_id();
1114 unsigned int GetEyeGazeId() final
1116 return inno_grpc_Face_Get_EyeGaze_id();
1118 unsigned int GetEyeStatusRId() final
1120 return inno_grpc_Face_Get_EyeStatusR_id();
1122 unsigned int GetEyeStatusLId() final
1124 return inno_grpc_Face_Get_EyeStatusL_id();
1126 unsigned int GetGlassStatusId() final
1128 return inno_grpc_Face_Get_GlassStatus_id();
1130 unsigned int GetHeavyFrameId() final
1132 return inno_grpc_Face_Get_HeavyFrame_id();
1134 unsigned int GetMouthStatusId() final
1136 return inno_grpc_Face_Get_MouthStatus_id();
1138 unsigned int GetBackgroundUniformityId() final
1140 return inno_grpc_Face_Get_BackgroundUniformity_id();
1142 unsigned int GetAgeId() final
1144 return inno_grpc_Face_Get_Age_id();
1146 unsigned int GetRedEyeRId() final
1148 return inno_grpc_Face_Get_RedEyeR_id();
1150 unsigned int GetRedEyeLId() final
1152 return inno_grpc_Face_Get_RedEyeL_id();
1154 unsigned int GetGenderId() final
1156 return inno_grpc_Face_Get_Gender_id();
1158 unsigned int GetEyeDistanceId() final
1160 return inno_grpc_Face_Get_EyeDistance_id();
1162 unsigned int GetFaceRelativeAreaId() final
1164 return inno_grpc_Face_Get_FaceRelativeArea_id();
1166 unsigned int GetFaceRelativeAreaInImageId() final
1168 return inno_grpc_Face_Get_FaceRelativeAreaInImage_id();
1170 unsigned int GetRollAngleId() final
1172 return inno_grpc_Face_Get_RollAngle_id();
1174 unsigned int GetPitchAngleId() final
1176 return inno_grpc_Face_Get_PitchAngle_id();
1178 unsigned int GetYawAngleId() final
1180 return inno_grpc_Face_Get_YawAngle_id();
1182 unsigned int GetFaceSizeId() final
1184 return inno_grpc_Face_Get_FaceSize_id();
1186 unsigned int GetMaskId() final
1188 return inno_grpc_Face_Get_Mask_id();
1190 unsigned int GetTintedGlassesId() final
1192 return inno_grpc_Face_Get_TintedGlasses_id();
1194 unsigned int GetRightEyeOuterCornerId() final
1196 return inno_grpc_Face_Get_RightEyeOuterCorner_id();
1198 unsigned int GetRightEyeCentreId() final
1200 return inno_grpc_Face_Get_RightEyeCentre_id();
1202 unsigned int GetRightEyeInnerCornerId() final
1204 return inno_grpc_Face_Get_RightEyeInnerCorner_id();
1206 unsigned int GetLeftEyeInnerCornerId() final
1208 return inno_grpc_Face_Get_LeftEyeInnerCorner_id();
1210 unsigned int GetLeftEyeCentreId() final
1212 return inno_grpc_Face_Get_LeftEyeCentre_id();
1214 unsigned int GetLeftEyeOuterCornerId() final
1216 return inno_grpc_Face_Get_LeftEyeOuterCorner_id();
1218 unsigned int GetNoseRootId() final
1220 return inno_grpc_Face_Get_NoseRoot_id();
1222 unsigned int GetNoseRightBottomId() final
1224 return inno_grpc_Face_Get_NoseRightBottom_id();
1226 unsigned int GetNoseTipId() final
1228 return inno_grpc_Face_Get_NoseTip_id();
1230 unsigned int GetNoseLeftBottomId() final
1232 return inno_grpc_Face_Get_NoseLeftBottom_id();
1234 unsigned int GetNoseBottomId() final
1236 return inno_grpc_Face_Get_NoseBottom_id();
1238 unsigned int GetMouthRightCornerId() final
1240 return inno_grpc_Face_Get_MouthRightCorner_id();
1242 unsigned int GetMouthCenterId() final
1244 return inno_grpc_Face_Get_MouthCenter_id();
1246 unsigned int GetMouthLeftCornerId() final
1248 return inno_grpc_Face_Get_MouthLeftCorner_id();
1250 unsigned int GetMouthUpperEdgeId() final
1252 return inno_grpc_Face_Get_MouthUpperEdge_id();
1254 unsigned int GetMouthLowerEdgeId() final
1256 return inno_grpc_Face_Get_MouthLowerEdge_id();
1258 unsigned int GetRightEyebrowOuterEndId() final
1260 return inno_grpc_Face_Get_RightEyebrowOuterEnd_id();
1262 unsigned int GetRightEyebrowInnerEndId() final
1264 return inno_grpc_Face_Get_RightEyebrowInnerEnd_id();
1266 unsigned int GetLeftEyebrowInnerEndId() final
1268 return inno_grpc_Face_Get_LeftEyebrowInnerEnd_id();
1270 unsigned int GetLeftEyebrowOuterEndId() final
1272 return inno_grpc_Face_Get_LeftEyebrowOuterEnd_id();
1274 unsigned int GetRightEdgeId() final
1276 return inno_grpc_Face_Get_RightEdge_id();
1278 unsigned int GetChinTipId() final
1280 return inno_grpc_Face_Get_ChinTip_id();
1282 unsigned int GetLeftEdgeId() final
1284 return inno_grpc_Face_Get_LeftEdge_id();
1286 float GetPassiveLivenessFast(
const std::shared_ptr<Logger>& logger,
1288 ErrorCallbacks errorCallbacks)
final
1290 const CallbackLogger slog(logger);
1291 return inno_grpc_Face_Get_PassiveLivenessFast(slog.GetCallbacks(), faceItem, errorCallbacks);
1293 float GetPassiveLivenessAccurate(
const std::shared_ptr<Logger>& logger,
1295 ErrorCallbacks errorCallbacks)
final
1297 const CallbackLogger slog(logger);
1298 return inno_grpc_Face_Get_PassiveLivenessAccurate(slog.GetCallbacks(), faceItem, errorCallbacks);
1300 void* CreateOFIQFace(
const std::shared_ptr<Logger>& logger,
1301 const uint8_t* data,
1306 FaceDestroyer* deleter,
1307 ErrorCallbacks errorCallbacks)
final
1309 const CallbackLogger slog(logger);
1310 return inno_grpc_CreateOFIQFace(channel.get(),
1311 slog.GetCallbacks(),
1320 unsigned int GetMaxId() final
1322 return inno_grpc_Face_Get_Max_id();
1324 void DeleteBytes(uint8_t* bytes)
final
1326 inno_grpc_Face_DeleteBytes(bytes);
1333 explicit GrpcFaceExecutor(
const std::string& endPoint)
1334 : channel(inno_grpc_Face_Channel_Create(endPoint.c_str()), inno_grpc_Face_Channel_Destroy)
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;
1346 std::unique_ptr<inno_grcp_FaceChannel, void (*)(inno_grcp_FaceChannel*)> channel;
1355 class GlobalFaceExecutor
1362 static std::shared_ptr<FaceExecutor>
Get()
1364 return GlobalFaceExecutor::Instance().GetInternal();
1372 static void Set(std::shared_ptr<FaceExecutor> executor)
1374 if (executor ==
nullptr)
1379 GlobalFaceExecutor::Instance().SetInternal(std::move(executor));
1390 std::shared_ptr<FaceExecutor> pe;
1399 std::shared_ptr<FaceExecutor> GetInternal()
1401 const std::scoped_lock lock(peMux);
1405 void SetInternal(std::shared_ptr<FaceExecutor> executor)
1407 const std::scoped_lock lock(peMux);
1408 pe = std::move(executor);
1413 explicit GlobalFaceExecutor(std::shared_ptr<FaceExecutor> e)
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