88 backgroundColor = std::move(color);
96 return backgroundColor;
109 alignedCrop = aligned;
140 RGBA backgroundColor = Colors::White;
141 bool alignedCrop =
true;
155 [[nodiscard]]
virtual std::shared_ptr<Image> CropPrint(
const Rectangle& rectangle,
158 CropablePrint() =
default;
159 virtual ~CropablePrint() =
default;
160 CropablePrint(
const CropablePrint&) =
delete;
161 CropablePrint(CropablePrint&&) =
delete;
162 CropablePrint& operator=(
const CropablePrint&) =
delete;
163 CropablePrint& operator=(CropablePrint&&) =
delete;
173 class PrintSegment final :
public Serializable
189 const std::scoped_lock lock(posMutex);
190 return pos.has_value();
200 const std::scoped_lock lock(posMutex);
211 const std::scoped_lock lock(posMutex);
213 if (!pos.has_value())
230 auto newRect =
roundingBox.Resize(newWidth, newHeight);
231 return std::make_shared<PrintSegment>(imagePrint, attr, newRect, angle, ConvertPosition(), exec);
243 std::shared_ptr<Print>
ToPrint()
246 return ToPrint(DefaultCropCfg);
261 const std::scoped_lock lock(posMutex);
263 if (not pos.has_value())
278 writer.Write(
"a", angle);
279 writer.Write(
"t", attr);
281 const std::scoped_lock lock(posMutex);
285 writer.Write(
"p",
static_cast<unsigned int>(pos.value()));
292 : roundingBox(s.roundingBox)
294 , imagePrint(s.imagePrint)
300 PrintSegment(PrintSegment&&) =
delete;
301 PrintSegment(std::shared_ptr<CropablePrint> pc,
306 std::shared_ptr<PrintExecutor> executor)
307 : roundingBox(std::move(r))
309 , imagePrint(std::move(pc))
310 , exec(std::move(executor))
311 , attr(std::move(pa))
319 PrintSegment& operator=(
const PrintSegment&) =
delete;
320 PrintSegment& operator=(PrintSegment&&) =
delete;
323 std::shared_ptr<CropablePrint> imagePrint;
324 std::shared_ptr<PrintExecutor> exec;
325 std::optional<PrintPosition> pos;
326 mutable std::mutex posMutex;
327 PrintAttributes attr;
329 int ConvertPosition()
const
331 const std::scoped_lock lock(posMutex);
334 return static_cast<int>(pos.value());
Base exception for all enrollment-sdk invalid argument exceptions.
Definition EnrollmentException.h:96
Base exception for all enrollment-sdk runtime exceptions.
Definition EnrollmentException.h:84
It holds width and height of Image.
Definition ImageAttribute.h:281
Holds print cropping configuration.
Definition PrintSegment.h:35
ImageHeight GetImageHeight() const
It gets output image height.
Definition PrintSegment.h:71
RGBA GetBackgroundColor() const
It provides background color for rounding box area that is out of image.
Definition PrintSegment.h:93
bool IsAlignedCroppingEnabled() const
Get Aligned Crop Configuration.
Definition PrintSegment.h:116
PrintCropConfiguration()=default
Create default PrintCropConfiguration object.
ImageWidth GetImageWidth() const
It gets output image width.
Definition PrintSegment.h:63
void SetImageDimensions(ImageWidth width, ImageHeight height)
Function sets output image dimension.
Definition PrintSegment.h:45
void SetBackgroundColor(RGBA color)
It sets background color rounding box area that is out of image.
Definition PrintSegment.h:85
void EnableAlignedCropping(bool aligned)
Enable Aligned Cropping.
Definition PrintSegment.h:106
Segment detected in print capture Usually the segment has also position that is assigned by segmentat...
Definition PrintSegment.h:173
void WriteTo(Writer &writer) const final
Function serializes slap segment.
Definition PrintSegment.h:274
const Rectangle roundingBox
Found rounding box of segmented fingertip.
Definition PrintSegment.h:176
void SetPosition(const PrintPosition &position)
Set the Position.
Definition PrintSegment.h:197
PrintPosition GetPosition()
Returns print position.
Definition PrintSegment.h:208
std::shared_ptr< Print > ToPrint(const PrintCropConfiguration &cfg)
It transforms segment to Print.
Definition PrintSegment.h:258
std::shared_ptr< PrintSegment > Resize(Rectangle::Width newWidth, Rectangle::Height newHeight) const
Create new segment with given width and height.
Definition PrintSegment.h:227
bool HasPosition() const
It checks if position is set.
Definition PrintSegment.h:186
std::shared_ptr< Print > ToPrint()
It transforms segment to Print.
Definition PrintSegment.h:242
static std::shared_ptr< Print > Create(std::shared_ptr< Image > img, const PrintPosition &position, const PrintAttributes &pa=PrintAttributes(), std::shared_ptr< PrintExecutor > executor=GlobalPrintExecutor::Get())
Constructor creates Print object.
Definition Print.h:625
It holds RGB color with transparency.
Definition ImageAttribute.h:908
It holds rectangle vertexes, width, height.
Definition ImageAttribute.h:357
Dimension Height
Rectangle height.
Definition ImageAttribute.h:367
Dimension Width
Rectangle width.
Definition ImageAttribute.h:371
Interface that MUST be implemented by all classes those want to be serialized.
Definition Writer.h:27
Provides interface for serialization of all classes.
Definition Writer.h:164
ImageDimension ImageHeight
Image Height.
Definition ImageAttribute.h:36
ImageDimension ImageWidth
Image Width.
Definition ImageAttribute.h:41
PrintPosition
It is position of finger on hands.
Definition PrintPosition.h:29