You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

261 lines
10 KiB

1 year ago
  1. #pragma once
  2. #include <fsdk/Log.h>
  3. #include <fsdk/Def.h>
  4. #include <fsdk/IObject.h>
  5. #include <fsdk/ILicense.h>
  6. #include <fsdk/IDetector.h>
  7. #include <fsdk/IDescriptor.h>
  8. #include <fsdk/ISettingsProvider.h>
  9. #include <fsdk/IWarper.h>
  10. #include <fsdk/Estimators/IAGSEstimator.h>
  11. #include <fsdk/Estimators/IHeadPoseEstimator.h>
  12. #include <fsdk/Estimators/IEyeEstimator.h>
  13. #include <fsdk/Estimators/IGlassesEstimator.h>
  14. #include <fsdk/Estimators/IBestShotQualityEstimator.h>
  15. #include <fsdk/Estimators/ILivenessOneShotRGBEstimator.h>
  16. #include <fsdk/Estimators/IMedicalMaskEstimator.h>
  17. #include <fsdk/Estimators/IQualityEstimator.h>
  18. #include <fsdk/Types/FaceEngineEdition.h>
  19. /**
  20. * @mainpage LUNA SDK
  21. * @section IntroSection Introduction
  22. * Welcome to the FaceEngine reference manual! This documentations covers all public interfaces and types.
  23. *
  24. * \b Advanced \b usage
  25. * Advanced usage is covered in the Face Engine handbook. Please contact us via e-mail: info@visionlabs.ru
  26. * if you haven't got one.
  27. *
  28. * \b Example \b code
  29. * Examples located at /examples folder of LUNA SDK package.
  30. *
  31. * @section StructureSection Structure
  32. * LUNA SDK consists of the following modules:
  33. * \li Detectors: detect faces on images, and find landmarks on it
  34. * \li Warper: normalize face position, scale and orientation by detection and landmarks.
  35. * \li Estimators: estimate various properties of images such as blurriness.
  36. * \li Descriptors: facilities to create and match face templates (aka descriptors).
  37. * */
  38. //! SDK namespace.
  39. namespace fsdk {
  40. #ifndef DOXYGEN_SHOULD_SKIP_THIS
  41. DECLARE_SMARTPTR(IFaceEngineMobile);
  42. #endif
  43. /**
  44. * @addtogroup CoreGroup
  45. * @{
  46. * */
  47. /**
  48. * @brief Root LUNA SDK object interface.
  49. * @note Face Engine also implements factory interface so all usual factory options apply.
  50. * */
  51. struct IFaceEngineMobile : IRefCounted {
  52. /**
  53. * @brief Creates a detector of given type.
  54. * @returns Error code; @see FSDKError and detector object if succeeded, null if failed.
  55. * */
  56. virtual ResultValue<FSDKError, IDetectorPtr> createDetector() noexcept = 0;
  57. /**
  58. * @brief Creates Head pose estimator.
  59. * @returns Error code; @see FSDKError and Head pose estimator if succeeded, null if failed.
  60. * */
  61. virtual ResultValue<FSDKError, IHeadPoseEstimatorPtr> createHeadPoseEstimator() noexcept = 0;
  62. /**
  63. * @brief Creates AGS estimator.
  64. * @returns Error code; @see FSDKError and AGS estimator if succeeded, null if failed.
  65. * */
  66. virtual ResultValue<FSDKError, IAGSEstimatorPtr> createAGSEstimator() noexcept = 0;
  67. /**
  68. * @brief Creates Eye estimator.
  69. * @returns Error code; @see FSDKError and Eye estimator if succeed, null if failed.
  70. * */
  71. virtual ResultValue<FSDKError, IEyeEstimatorPtr> createEyeEstimator() noexcept = 0;
  72. /**
  73. * @brief Creates MedicalMask estimator.
  74. * @return ResultValue with error code and IMedicalMaskEstimatorPtr instance.
  75. * @see ResultValue, FSDKError, IMedicalMaskEstimatorPtr
  76. * */
  77. virtual ResultValue<FSDKError, IMedicalMaskEstimatorPtr> createMedicalMaskEstimator() noexcept = 0;
  78. /**
  79. * @brief Creates Glasses estimator.
  80. * @return ResultValue with error code and IGlassesEstimatorPtr instance.
  81. * @see ResultValue, FSDKError, IGlassesEstimatorPtr
  82. * */
  83. virtual ResultValue<FSDKError, IGlassesEstimatorPtr> createGlassesEstimator() noexcept = 0;
  84. /**
  85. * @brief Creates Quality estimator.
  86. * @return ResultValue with error code and IQualityEstimatorPtr instance.
  87. * @see ResultValue, FSDKError, IQualityEstimatorPtr
  88. * */
  89. virtual ResultValue<FSDKError, IQualityEstimatorPtr> createQualityEstimator() noexcept = 0;
  90. /**
  91. * @brief Creates BestShotQuality estimator.
  92. * @returns Error code; @see FSDKError and BestShotQuality estimator if succeed, null if failed.
  93. * */
  94. virtual ResultValue<FSDKError, IBestShotQualityEstimatorPtr> createBestShotQualityEstimator() noexcept = 0;
  95. /**
  96. * @brief Creates Liveness OneShot estimator.
  97. * @return Error code; @see FSDKError and OneShot liveness estimator if succeed, null if failed.
  98. * */
  99. virtual ResultValue<FSDKError, ILivenessOneShotRGBEstimatorPtr> createLivenessOneShotRGBEstimator() noexcept = 0;
  100. /**
  101. * @brief Creates Descriptor.
  102. * @param [in] version descriptor version.
  103. * @details face descriptor will created by default, to create human
  104. * descriptor pass version, minimum version of human descriptor is DV_MIN_HUMAN_DESCRIPTOR_VERSION == 102
  105. * @see DescriptorVersion
  106. * @returns Error code; @see FSDKError and Descriptor if succeed, null if failed.
  107. * */
  108. virtual ResultValue<FSDKError, IDescriptorPtr> createDescriptor(uint32_t version = 0) noexcept = 0;
  109. /**
  110. * @brief Creates and loads Descriptor from Archive.
  111. * @param [in] archive Archive with descriptor.
  112. * @param [in] flags Archive flag.
  113. * @returns Error code; @see FSDKError and Descriptor if succeed, null if failed.
  114. * */
  115. virtual ResultValue<FSDKError, IDescriptorPtr> createDescriptor(IArchive* archive, uint32_t flags = 0) noexcept = 0;
  116. /**
  117. * @brief Creates Batch of descriptors.
  118. * @details face descriptor batch will be created by default, to create human
  119. * descriptor batch you must pass version, minimum version of human descriptor is DV_MIN_HUMAN_DESCRIPTOR_VERSION == 102
  120. * @see DescriptorVersion
  121. * @param [in] size - amount of descriptors in batch.
  122. * @param [in] version - descriptor version in batch. If 0 - use dafault version from config.
  123. * @returns Error code; @see FSDKError and Batch if succeed, null if failed.
  124. * */
  125. virtual ResultValue<FSDKError, IDescriptorBatchPtr> createDescriptorBatch(int32_t size, uint32_t version = 0) noexcept = 0;
  126. /**
  127. * @brief Creates descriptor extractor.
  128. * @param [in] version descriptor version.
  129. * @details face descriptor extractor will created by default, to create human descriptor extractor
  130. * descriptor you must pass version, minimum version of human descriptor is DV_MIN_HUMAN_DESCRIPTOR_VERSION == 102
  131. * @see DescriptorVersion
  132. * @returns Error code; @see FSDKError and Descriptor extractor if succeed, null if failed.
  133. * */
  134. virtual ResultValue<FSDKError, IDescriptorExtractorPtr> createExtractor(uint32_t version = 0) noexcept = 0;
  135. /**
  136. * @brief Creates descriptor matcher.
  137. * @param [in] version descriptor version.
  138. * @details face descriptor matcher will created by default, to create human descriptor matcher
  139. * you must pass version, minimum version of human descriptor is DV_MIN_HUMAN_DESCRIPTOR_VERSION == 102
  140. * @see DescriptorVersion
  141. * @returns Error code; @see FSDKError and Descriptor matcher if succeed, null if failed.
  142. * */
  143. virtual ResultValue<FSDKError, IDescriptorMatcherPtr> createMatcher(uint32_t version = 0) noexcept = 0;
  144. /**
  145. * @brief Creates warper.
  146. * @return Warper if succeed, null if failed.
  147. * */
  148. virtual ResultValue<FSDKError, IWarperPtr> createWarper() noexcept = 0;
  149. /**
  150. * @brief Get LUNA SDK ditribution edition.
  151. * @return Edition of LUNA SDK instance. Posible values:
  152. * \li CompleteEdition - full edition with all function.
  153. * \li FrontEndEdition - short edition with excluded descriptor functions.
  154. * Extractor, matcher, descriptor, batch and index cannot be created.
  155. * */
  156. virtual FaceEngineEdition getFaceEngineEdition() const noexcept = 0;
  157. /**
  158. * @brief Sets data directory.
  159. * @param [in] path path to data directory.
  160. * */
  161. virtual void setDataDirectory(const char* path) noexcept = 0;
  162. /**
  163. * @brief Gets data directory.
  164. * @details By default is set to "./data".
  165. * @return path to data directory.
  166. * */
  167. virtual const char* getDataDirectory() const noexcept = 0;
  168. /**
  169. * @brief Sets settings provider.
  170. * @param [in] provider settings provider.
  171. * */
  172. virtual void setSettingsProvider(ISettingsProvider* provider) noexcept = 0;
  173. /**
  174. * @brief Sets runtime settings provider.
  175. * @param [in] provider runtime settings provider.
  176. * */
  177. virtual void setRuntimeSettingsProvider(ISettingsProvider* provider) noexcept = 0;
  178. /**
  179. * @brief Gets settings provider.
  180. * @return settings provider.
  181. * */
  182. virtual ISettingsProvider* getSettingsProvider() const noexcept = 0;
  183. /**
  184. * @brief Gets runtime settings provider.
  185. * @return runtime settings provider.
  186. * */
  187. virtual ISettingsProvider* getRuntimeSettingsProvider() const noexcept = 0;
  188. /**
  189. * @brief Get current License object, which was set for FaceEngine object.
  190. * @return pointer to current license object, nullptr if no any license was set to.
  191. */
  192. virtual ILicense* getLicense() const noexcept = 0;
  193. };
  194. /**
  195. * @brief Makes License activation with some platform specific manner. Network connection is required.
  196. * @param [in] license pointer to the license object which should be activated
  197. * @param [in] configPath path to license.conf file with licensing settings.
  198. * @return true if license was successfully activated.
  199. */
  200. FSDK_API Result<FSDKError> activateLicense(ILicense* license, const char* configPath) noexcept;
  201. /**
  202. * @brief Makes License activation with some platform specific manner. Network connection is required.
  203. * @param [in] license pointer to the license object which should be activated
  204. * @param [in] provider settings provider.
  205. * @return true if license was successfully activated.
  206. */
  207. FSDK_API Result<FSDKError> activateLicense(ILicense* license, ISettingsProvider* settings) noexcept;
  208. /**
  209. * @brief Create the LUNA SDK root object.
  210. * @param [in] dataPath [optional] path to folder with FSDK data. Default: ./data (on windows), /opt/visionlabs/data (on linux)
  211. * @param [in] configPath [optional] path to faceengine.conf file. Default: <dataPath>/faceengine.cong
  212. * @param [in] runtimePath [optional] path to runtime.conf file. Default: <dataPath>/runtime.cong
  213. * @returns Error code; @see FSDKError and face engine object if succeeded, null if failed.
  214. * */
  215. FSDK_API ResultValue<FSDKError, IFaceEngineMobilePtr> createFaceEngineMobile(
  216. const char* dataPath = nullptr,
  217. const char* configPath = nullptr,
  218. const char* runtimePath = nullptr) noexcept;
  219. /**
  220. * @brief Create a settings provider.
  221. * @param [in] path configuration file path.
  222. * @return settings provider object if succeeded, null if failed.
  223. * */
  224. FSDK_API ResultValue<FSDKError, ISettingsProviderPtr> createSettingsProvider(const char* path) noexcept;
  225. } // namespace fsdk