12#include "enrollment/Export.h"
42 "Not possible to set transparent background for already set crop method " + ToString(cropMethod));
45 cropBackground = background;
55 return cropBackground;
80 " crop method when scale is not 1.0");
85 " when background is transparent");
113 static constexpr float MinScale = 0.3F;
114 static constexpr float MaxScale = 2.0F;
115 if (scale < MinScale || scale > MaxScale)
143 writer.Write(
"c", cropBackground);
144 writer.Write(
"m",
static_cast<unsigned int>(cropMethod));
145 writer.Write(
"s", cropScale);
162 RGBA cropBackground = Colors::White;
164 float cropScale = 1.0F;
166 [[nodiscard]]
bool IsScale()
const
168 static constexpr int Scale100 = 100;
169 return static_cast<int>(cropScale * Scale100) != Scale100;
171 static bool IsBackgroundTransparent(
const RGBA& background)
175 [[nodiscard]]
bool IsBackgroundTransparent()
const
Base exception for all enrollment-sdk invalid argument exceptions.
Definition EnrollmentException.h:96
void WriteTo(Writer &writer) const final
Function serializes configuration via provided Writer.
Definition FaceCropConfiguration.h:140
void SetCropBackground(const RGBA &background)
Set the Crop Background color Background with transparency is only allowed when method is FaceCrop::F...
Definition FaceCropConfiguration.h:36
void SetCropMethod(FaceCrop method)
Set the Crop method.
Definition FaceCropConfiguration.h:69
FaceCrop GetCropMethod() const
Get the Crop method.
Definition FaceCropConfiguration.h:95
RGBA GetCropBackground() const
Get the Crop Background object.
Definition FaceCropConfiguration.h:52
void SetCropScale(float scale)
Set the Crop scale.
Definition FaceCropConfiguration.h:110
FaceCropConfiguration()=default
Default configuration is.
float GetCropScale() const
Get the Crop scale.
Definition FaceCropConfiguration.h:131
It holds RGB color with transparency.
Definition ImageAttribute.h:908
@ FULLY_OPAQUE
Color is fully opaque, means it is visible.
Definition ImageAttribute.h:920
unsigned char transparency
Transparency where 0 is fully transparent and 255 is fully opaque.
Definition ImageAttribute.h:913
Provides interface for serialization of all classes.
Definition Writer.h:164
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
@ 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