Face Engine SDK  4.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 "IObject.h"
11 #include "Face.h"
12 #include "Human.h"
13 #include "FSDKError.h"
14 #include "Types.h"
15 #include "IResultBatch.h"
16 
17 #include <functional>
18 
19 namespace fsdk {
20 
21 #ifndef DOXYGEN_SHOULD_SKIP_THIS
22  DECLARE_SMARTPTR(IDetector);
23  DECLARE_SMARTPTR(IHumanDetector);
24 #endif
25 
31  RM_RGB = 0,
33  };
34 
50  };
51 
60  DCT_COUNT
61  };
62 
67  dtBBox = 0,
68  dt5Landmarks = 1<<0,
69  dt68Landmarks = 1<<1,
70  dtAll = 0xffff
71  };
72 
73  inline DetectionType operator | (DetectionType a, DetectionType b)
74  { return static_cast<DetectionType>(static_cast<int>(a) | static_cast<int>(b)); }
75 
80  DCT_BOX = 0,
81  DCT_POINTS = 1<<0,
82  DCT_ALL = 0xffff
83  };
84 
85  inline HumanDetectionType operator | (HumanDetectionType a, HumanDetectionType b) {
86  return static_cast<HumanDetectionType>(static_cast<int>(a) | static_cast<int>(b));
87  }
88 
93  public:
94  virtual bool compare(const Image& img, const BaseDetection<float>& a, const BaseDetection<float>& b) const = 0;
95  virtual ~IDetectionComparer() = default;
96  };
97 
102  public:
103  typedef std::function<bool(const Image& img, const BaseDetection<float>&, const BaseDetection<float>&)> Function;
104  explicit FunctionDetectionComparer(const Function& function) : func(function)
105  {}
106  bool compare(const Image& img, const BaseDetection<float>& a, const BaseDetection<float>& b) const
107  { return func(img, a, b); }
108  private:
109  Function func;
110  };
111 
127  const Span<const Image> images,
128  const Span<const Rect> rectangles,
129  int detectionPerImageNum,
130  DetectionType type = dtBBox) noexcept = 0;
131 
140  const Image& image,
141  const Rect& rect,
142  DetectionType type = dtBBox) noexcept = 0;
143 
148  virtual void setDetectionComparer(DetectionComparerType comparerType) noexcept = 0;
149 
155  virtual void setCustomDetectionComparer(const IDetectionComparer* comparer) noexcept = 0;
164  redetectOne(
165  Face& face,
166  DetectionType type = dtBBox) noexcept = 0;
167 
176  redetectOne(
177  const fsdk::Image& image,
178  const fsdk::FloatRect& rect,
179  fsdk::DetectionType type = fsdk::dtBBox) noexcept = 0;
180 
193  virtual Result<FSDKError>
194  FSDK_DEPRECATED("This call is deprecated since v.3.9.3. Consider "
195  "redetect(\n"
196  "\tconst Span<Face>& faces,\n"
197  "\tDetectionType type,\n"
198  "\tconst Span<Result<FSDKError>>& outErrors) call.\n")
199  redetect(
200  const Span<Face>& faces,
201  DetectionType type = dtBBox,
202  const Span<FSDKError>* outErrors = nullptr) noexcept = 0;
203 
218  virtual Result<FSDKError>
219  redetect(
220  const fsdk::Span<fsdk::Face>& faces,
221  fsdk::DetectionType type,
222  const fsdk::Span<fsdk::Result<fsdk::FSDKError>>& outErrors) noexcept = 0;
223 
231  estimateOrientation(const Image &image) noexcept = 0;
232  };
233 
238  /*
239  * @brief Batched detect of human bodies
240  * @param images input images span; format must be R8G8B8.
241  * @param rectangles input rectangles of interest span.
242  * @param detectionPerImageNum max number of detections per input image.
243  * @return ResultValue with error code and collections of Detection objects (contains bbox and score).
244  * @note all spans should be based on user owned continuous collections.
245  * @note all spans should be equal size.
246  */
248  detect(
249  const Span<const Image>& image,
250  const Span<const Rect>& rect,
251  uint32_t detectionPerImageNum,
252  HumanDetectionType type = DCT_BOX) const noexcept = 0;
253 
254  /*
255  * @brief redetect one person from input image;
256  * @param human fsdk::Human structure with valid image and bbox inside;
257  * @return ResultValue with ErrorCode and bool (true - if detection found);
258  * @note human structure will be overriden once redetect finish it's job.
259  **/
261  redetectOne(Human& human) const noexcept = 0;
262  };
263 
266 }
Get all supported parameters.
Definition: IDetector.h:82
Syntax sugar, allows you to use lambdas to define a BestDetection comparer.
Definition: IDetector.h:101
Detector type 2.
Definition: IDetector.h:47
#define DECLARE_SMARTPTR(X)
Smart ptr declaration helper macro.
Definition: Def.h:59
BestDetection - most centered detection.
Definition: IDetector.h:57
Default detector cpecified in config file;.
Definition: IDetector.h:45
Common data types and structures.
virtual fsdk::ResultValue< fsdk::FSDKError, fsdk::OrientationType > estimateOrientation(const Image &image) noexcept=0
Estimate orientation of all image (Normal, Right90deg, Left90deg or UpsideDown).
IR image processing mode.
Definition: IDetector.h:32
virtual void setCustomDetectionComparer(const IDetectionComparer *comparer) noexcept=0
Set custom detection comparer object.
Detector type 3.
Definition: IDetector.h:48
Object system types and interfaces.
Get bounding boxes of faces.
Definition: IDetector.h:67
Common SDK error codes.
Definition: Face.h:9
DetectionComparerType
Strategy of BestDetections comparer.
Definition: IDetector.h:55
Detector type count.
Definition: IDetector.h:49
Base strong reference counted object interface.
Definition: IRefCounted.h:36
human body detector interface.
Definition: IDetector.h:237
virtual ResultValue< FSDKError, Ref< IResultBatch< Face > > > detect(const Span< const Image > images, const Span< const Rect > rectangles, int detectionPerImageNum, DetectionType type=dtBBox) noexcept=0
Detect faces and landmarks on multiple images.
face detector interface.
Definition: IDetector.h:115
Detector type 1.
Definition: IDetector.h:46
Get bounding boxes and 68 facial landmarks.
Definition: IDetector.h:69
bestDetection - the largest detection
Definition: IDetector.h:59
Get all supported parameters.
Definition: IDetector.h:70
Interface of BestDetection comparer. Implement it if you want to use own BestDetection strategy...
Definition: IDetector.h:92
Addon for Result to output some value aside the result. Specialization for copiable types...
Definition: ResultValue.h:21
Get 17 keypoints of human, with score for each one.
Definition: IDetector.h:81
Get bounding boxes of human bodies.
Definition: IDetector.h:80
virtual ResultValue< FSDKError, Face > detectOne(const Image &image, const Rect &rect, DetectionType type=dtBBox) noexcept=0
Light function to get just one best detection from single input image.
Definition: Human.h:9
Image.
Definition: Image.h:37
virtual ResultValue< FSDKError, bool > redetectOne(Face &face, DetectionType type=dtBBox) noexcept=0
bestDetection - most centered with high score
Definition: IDetector.h:58
Get bounding boxes and 5 facial landmarks.
Definition: IDetector.h:68
virtual Result< FSDKError > redetect(const fsdk::Span< fsdk::Face > &faces, fsdk::DetectionType type, const fsdk::Span< fsdk::Result< fsdk::FSDKError >> &outErrors) noexcept=0
Batched redetect faces.
virtual void setDetectionComparer(DetectionComparerType comparerType) noexcept=0
Set detection comparer from SDK defined list.
virtual Result< FSDKError > FSDK_DEPRECATED("This call is deprecated since v.3.9.3. Consider ""redetect(\n""\tconst Span<Face>& faces,\n""\tDetectionType type,\n""\tconst Span<Result<FSDKError>>& outErrors) call.\n") redetect(const Span< Face > &faces
Batched redetect faces.
ObjectDetectorClassType
Object detector type enumeration.
Definition: IDetector.h:44
DetectionType
Detection type enumeration.
Definition: IDetector.h:66
RecognitionMode
Recognition mode structure. Determines which recognition mode to use.
Definition: IDetector.h:30
HumanDetectionType
Human detection type enumeration.
Definition: IDetector.h:79
BestDetection - detections with highest score.
Definition: IDetector.h:56
RGB image processing mode.
Definition: IDetector.h:31
Span. Not owning data view. It incapsulated pointer to the continuous array with one or more T objec...
Definition: Span.h:13
Face detection. Stores a detected face bounding box within a source image frame as well as detection...
Definition: Detection.h:10