13#include "enrollment/Export.h"
36 class Config :
public Serializable
42 enum class Type : uint8_t
82 maxDetectionSize = value;
90 return maxDetectionSize;
101 minDetectionSize = value;
109 return minDetectionSize;
118 writer.Write(
"t",
static_cast<unsigned int>(type));
119 writer.Write(
"i", minDetectionSize);
120 writer.Write(
"x", maxDetectionSize);
152 float minDetectionSize = DefaultMinDetectionSize;
153 float maxDetectionSize = DefaultMaxDetectionSize;
154 static constexpr float DefaultMinDetectionSize = 0.05F;
155 static constexpr float DefaultMaxDetectionSize = 0.95F;
170 [[nodiscard]] std::shared_ptr<IrisSegment>
Detect(
const std::shared_ptr<Image>& image,
174 log.LogInfo(
"Iris detection for %v with cfg %v ...", image, cfg);
175 auto bgr = image->AsRawBGR();
177 auto r = exec->Detect(log.GetLogger(),
180 static_cast<unsigned int>(bgr.dpi),
182 cfg.GetMinDetectionSize(),
183 cfg.GetMaxDetectionSize(),
184 static_cast<unsigned int>(cfg.GetDetector()),
187 if (r.irises[0] ==
nullptr)
192 if (r.irises[1] !=
nullptr)
196 for (
auto& iris : r.irises)
200 exec->DestroyImpl()(iris);
206 const auto& firstIrisBB = r.irisRoundingBoxes[0];
207 const Rectangle irisRect = { { firstIrisBB.topLeftX, firstIrisBB.topLeftY },
208 { firstIrisBB.topRightX, firstIrisBB.topLeftY },
209 { firstIrisBB.bottomRightX, firstIrisBB.bottomRightY },
210 { firstIrisBB.bottomLeftX, firstIrisBB.bottomLeftY } };
212 const auto& firstPupilBB = r.pupilRoundingBoxes[0];
213 const Rectangle pupilRect = { { firstPupilBB.topLeftX, firstPupilBB.topLeftY },
214 { firstPupilBB.topRightX, firstPupilBB.topLeftY },
215 { firstPupilBB.bottomRightX, firstPupilBB.bottomRightY },
216 { firstPupilBB.bottomLeftX, firstPupilBB.bottomLeftY } };
218 auto segment = IrisSegment::Create(Iris::Create(image,
221 std::shared_ptr<void>(r.irises[0], exec->DestroyImpl()),
231 log.LogInfo(
"Iris detection result %v", segment);
255 , cfg(std::move(config))
266 , exec(std::move(executor))
267 , cfg(std::move(config))
281 explicit IrisDetector(std::shared_ptr<IrisExecutor> executor)
283 , exec(std::move(executor))
300 std::shared_ptr<IrisExecutor> exec;
Base exception for all enrollment-sdk runtime exceptions.
Definition EnrollmentException.h:84
Holds instance of IrisExecutor.
Definition IrisExecutor.h:369
Holds instance of Logger.
Definition Logger.h:275
@ INSIDE
Object is fully in Image.
Definition Image.h:129
Iris attributes Holds the iris attributes.
Definition IrisAttributes.h:32
Iris detector configuration.
Definition IrisDetector.h:36
void WriteTo(Writer &writer) const final
Function serializes configuration via provided Writer.
Definition IrisDetector.h:115
Type GetDetector() const
Function gets detection type.
Definition IrisDetector.h:68
float GetMaxDetectionSize() const
Function gets max detection size.
Definition IrisDetector.h:87
Type
Type of neural network detector.
Definition IrisDetector.h:42
@ ACCURATE
Neural network iris detector with very high accuracy.
Definition IrisDetector.h:48
@ FAST
The fastest iris detector is used when fast mode is used.
Definition IrisDetector.h:54
static Config Default()
Provides default configuration.
Definition IrisDetector.h:129
Config()=default
Creates Default configuration.
void SetDetector(Type value)
Function sets type of detector.
Definition IrisDetector.h:60
float GetMinDetectionSize() const
Function gets min detection size.
Definition IrisDetector.h:106
void SetMaxDetectionSize(float value)
Function sets max detection size.
Definition IrisDetector.h:79
void SetMinDetectionSize(float value)
Function sets min detection size.
Definition IrisDetector.h:98
IrisDetector implements detection by means of Innovatrics IFace.
Definition IrisDetector.h:29
IrisDetector()
Construct a new IrisDetector object GlobalIrisExecutor is used for execution of iris functionality.
Definition IrisDetector.h:239
std::shared_ptr< IrisSegment > Detect(const std::shared_ptr< Image > &image, const IrisPosition &position, const IrisAttributes &ia=IrisAttributes()) const
Detect iris in given image.
Definition IrisDetector.h:169
IrisDetector(std::shared_ptr< IrisExecutor > executor)
Construct a new IrisDetector object Default Config is used.
Definition IrisDetector.h:280
IrisDetector(Config config, std::shared_ptr< IrisExecutor > executor)
Construct a new IrisDetector object.
Definition IrisDetector.h:263
IrisDetector(Config config)
Construct a new IrisDetector object GlobalIrisExecutor is used for execution of iris functionality.
Definition IrisDetector.h:251
Null argument is not allowed.
Definition EnrollmentException.h:156
It holds rectangle vertexes, width, height.
Definition ImageAttribute.h:357
Provides interface for serialization of all classes.
Definition Writer.h:164
IrisPosition
It is position of iris on face iso_19794-6_2011.
Definition IrisPosition.h:22