Enrollment 28.2.0
Loading...
Searching...
No Matches
FaceCrop.h
Go to the documentation of this file.
1
9
10#pragma once
11
13#include "enrollment/Export.h"
14#include <ostream>
15#include <string>
16
17namespace inno
18{
22 */
23 enum class FaceCrop : uint8_t
24 {
33 FULL = 1,
39 TOKEN = 2,
43 };
44
45 // The numbers are from ISO standard and are tested in unit tests.
46 // NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers)
47
53 */
54 static constexpr bool IsFaceCropMethodValid(FaceCrop faceCrop)
55 {
56 switch (faceCrop)
57 {
59 [[fallthrough]];
60 case FaceCrop::FULL:
61 [[fallthrough]];
62 case FaceCrop::TOKEN:
63 [[fallthrough]];
65 return true;
66 default:
67 return false;
68 }
69 }
70
71 inline std::string ToString(FaceCrop faceCrop)
72 {
73 switch (faceCrop)
74 {
76 return "TOKEN_NOT_FRONTAL";
77 case FaceCrop::FULL:
78 return "FULL";
79 case FaceCrop::TOKEN:
80 return "TOKEN";
82 return "FULL_NOT_ALIGNED";
83 }
84 return "UNKNOWN";
85 }
86
87 inline std::ostream& operator<<(std::ostream& os, FaceCrop faceCrop)
88 {
89 os << ToString(faceCrop);
90 return os;
91 }
92} // namespace inno
static constexpr bool IsFaceCropMethodValid(FaceCrop faceCrop)
Function validates the value of FaceCrop enum.
Definition FaceCrop.h:53
FaceCrop
Defines different Crop methods.
Definition FaceCrop.h:23
@ FULL_NOT_ALIGNED
Crops bounding box provided by FaceCrop::FULL method as is from original FaceCapture.
Definition FaceCrop.h:41
@ TOKEN
Token Frontal Image cropping method defined in ISO/IEC 19794-5 standard.
Definition FaceCrop.h:38
@ FULL
Full Frontal Image cropping method defined in ISO/IEC 19794-5 standard.
Definition FaceCrop.h:32
@ TOKEN_NOT_FRONTAL
Image cropping method similar to TOKEN but works quite well even on non-frontal images It will produc...
Definition FaceCrop.h:26