Face Engine SDK  5.6.0
A face detection, recognition and tracking engine.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
IDetector.h
Go to the documentation of this file.
1 
8 #pragma once
9 
10 #include "FSDKError.h"
11 #include "IFaceDetectionBatch.h"
12 #include "IObject.h"
13 #include "Types.h"
14 #include "Types/Face.h"
15 
16 #include <functional>
17 
18 namespace fsdk {
19 
20 #ifndef DOXYGEN_SHOULD_SKIP_THIS
21  DECLARE_SMARTPTR(IDetector);
22 #endif
23 
28  enum class SensorType {
29  Visible = 0,
30  NIR
31  };
32 
48  };
49 
58  DCT_COUNT
59  };
60 
65  DT_BBOX = 0,
66  DT_LANDMARKS5 = 1<<0,
67  DT_LANDMARKS68 = 1<<1,
68  DT_ALL = 0xffff
69  };
70 
71  inline DetectionType operator | (DetectionType a, DetectionType b)
72  { return static_cast<DetectionType>(static_cast<int>(a) | static_cast<int>(b)); }
73 
78  public:
79  virtual bool compare(const Image& img, const Detection& a, const Detection& b) const = 0;
80  virtual ~IDetectionComparer() = default;
81  };
82 
87  public:
88  typedef std::function<bool(const Image& img, const Detection&, const Detection&)> Function;
89  explicit FunctionDetectionComparer(const Function& function) : func(function)
90  {}
91  bool compare(const Image& img, const Detection& a, const Detection& b) const
92  { return func(img, a, b); }
93  private:
94  Function func;
95  };
96 
114  detect(
115  Span<const Image> images,
116  Span<const Rect> ROIs,
117  uint32_t perImageNum,
118  DetectionType type = DT_BBOX
119  ) noexcept = 0;
120 
131  detectOne(
132  const Image& image,
133  const Rect& rect,
134  DetectionType type = DT_BBOX) noexcept = 0;
135 
153  redetect(
154  Span<const Image> images,
155  Ref<IFaceDetectionBatch> detectionBatch,
156  DetectionType type = DT_BBOX
157  ) noexcept = 0;
158 
175  redetect(
176  Span<const Image> images,
177  Span<Span<const Detection>> detections,
178  DetectionType type = DT_BBOX
179  ) noexcept = 0;
180 
191  redetectOne(
192  const Image& image,
193  const Detection& detection,
194  DetectionType type = DT_BBOX) noexcept = 0;
195 
201  virtual void setDetectionComparer(DetectionComparerType comparerType) noexcept = 0;
202 
209  virtual void setCustomDetectionComparer(const IDetectionComparer* comparer) noexcept = 0;
210 
224  virtual Result<FSDKError>
225  validate(
226  Span<const Image> images,
227  Span<Span<const Detection>> detections,
228  Span<Span<Result<FSDKError>>> errors) const noexcept = 0;
229 
242  virtual Result<FSDKError>
243  validate(
244  Span<const Image> images,
245  Span<const Rect> rects,
246  uint32_t detectionPerImageNum,
247  Span<Result<FSDKError>> outErrors) const noexcept = 0;
248 
261  virtual Result<FSDKError>
262  validate(
263  Span<const Image> images,
264  Ref<IFaceDetectionBatch> detectionBatch,
265  Span<Result<FSDKError>> outErrors) const noexcept = 0;
266  };
267 
270 }
virtual ResultValue< FSDKError, Ref< IFaceDetectionBatch > > redetect(Span< const Image > images, Ref< IFaceDetectionBatch > detectionBatch, DetectionType type=DT_BBOX) noexcept=0
Batched redetect faces on multiple images. based on the detection results for the previous frames...
virtual Result< FSDKError > validate(Span< const Image > images, Span< Span< const Detection >> detections, Span< Span< Result< FSDKError >>> errors) const noexcept=0
Validate input of multiple frames in a single function call.
Syntax sugar, allows you to use lambdas to define a BestDetection comparer.
Definition: IDetector.h:86
Detector type 2.
Definition: IDetector.h:45
#define DECLARE_SMARTPTR(X)
Smart ptr declaration helper macro.
Definition: Def.h:59
BestDetection - most centered detection.
Definition: IDetector.h:55
Default detector cpecified in config file.
Definition: IDetector.h:43
A structure that encapsulates an action result enumeration.
Definition: Result.h:29
Common data types and structures.
virtual void setCustomDetectionComparer(const IDetectionComparer *comparer) noexcept=0
Set custom detection comparer object.
Detector type 3.
Definition: IDetector.h:46
Smart pointer for reference counted objects.
Definition: Ref.h:22
Object system types and interfaces.
Get bounding boxes of faces.
Definition: IDetector.h:65
Common SDK error codes.
DetectionComparerType
Strategy of BestDetections comparer.
Definition: IDetector.h:53
NIR sensor type.
Detector type count.
Definition: IDetector.h:47
virtual ResultValue< FSDKError, Face > detectOne(const Image &image, const Rect &rect, DetectionType type=DT_BBOX) noexcept=0
Light function to get just one best detection from single input image.
Base strong reference counted object interface.
Definition: IRefCounted.h:36
face detector interface.
Definition: IDetector.h:100
virtual ResultValue< FSDKError, Ref< IFaceDetectionBatch > > detect(Span< const Image > images, Span< const Rect > ROIs, uint32_t perImageNum, DetectionType type=DT_BBOX) noexcept=0
Detect faces and their parameters on multiple images.
Detector type 1.
Definition: IDetector.h:44
bestDetection - the largest detection.
Definition: IDetector.h:57
SensorType
Sensor type structure. Determines which type of camera sensor is used to perform face recognition...
Definition: IDetector.h:28
Get all supported parameters.
Definition: IDetector.h:68
BestDetection - detections with highest score.
Definition: IDetector.h:54
Interface of BestDetection comparer. Implement it if you want to use own BestDetection strategy...
Definition: IDetector.h:77
Addon for Result to output some value aside the result. Specialization for copiable types...
Definition: ResultValue.h:25
Visible sensor type.
Image.
Definition: Image.h:38
virtual void setDetectionComparer(DetectionComparerType comparerType) noexcept=0
Set detection comparer from SDK defined list.
virtual ResultValue< FSDKError, Face > redetectOne(const Image &image, const Detection &detection, DetectionType type=DT_BBOX) noexcept=0
Redetect face.
ObjectDetectorClassType
Object detector type enumeration.
Definition: IDetector.h:42
DetectionType
Detection type enumeration.
Definition: IDetector.h:64
Get bounding boxes and 5 facial landmarks.
Definition: IDetector.h:66
Get bounding boxes and 68 facial landmarks.
Definition: IDetector.h:67
Detection structure. Stores a detected bounding box within a source image rect.
Definition: Detection.h:10
Span. Not owning data view. It incapsulated pointer to the continuous array with one or more T objec...
Definition: Span.h:14
bestDetection - most centered with high score.
Definition: IDetector.h:56