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.

75 lines
2.7 KiB

1 year ago
  1. #pragma once
  2. #include <fsdk/IObject.h>
  3. #include <fsdk/FSDKError.h>
  4. #include <fsdk/Optional.h>
  5. #include <fsdk/Types.h>
  6. namespace fsdk {
  7. #ifndef DOXYGEN_SHOULD_SKIP_THIS
  8. DECLARE_SMARTPTR(IGlassesEstimator);
  9. #endif
  10. /** @brief Glasses estimation enum.
  11. * \li \c noglasses: checks whether person is wearing glasses or not.
  12. * true - no glasses, false - with glasses;
  13. * \li \c eyeglasses: checks whether person is wearing eyeglasses or not.
  14. * true - eyeglasses, false - not eyeglasses;
  15. * \li \c sunglasses: checks whether person is wearing sunglasses or not.
  16. * true - sunglasses, false - not sunglasses.
  17. * */
  18. enum class GlassesEstimation: uint8_t{
  19. NoGlasses,//!< Person is not wearing glasses
  20. EyeGlasses,//!< Person is wearing eyeglasses
  21. SunGlasses,//!< Person is wearing sunglasses
  22. EstimationError//!< failed to estimate
  23. };
  24. /**
  25. * @brief Glasses estimator interface.
  26. * @note This estimator is designed to work with a person face image;
  27. **/
  28. struct IGlassesEstimator : IRefCounted {
  29. /**
  30. * brief checks whether person wearing any glasses or not.
  31. * @param [in] warp image with warped face; @see IWarper for details.
  32. * @return ResultValue with error code and output enum value inside.
  33. * @see GlassesEstimation, Image, ResultValue and FSDKError for details.
  34. * @note warp format must be R8G8B8, @see Format.
  35. * */
  36. virtual ResultValue<FSDKError, GlassesEstimation>
  37. estimate(const Image& warp) const noexcept = 0;
  38. /**
  39. * @brief Checks if people are wearing glasses or not for multiple warped images in a single estimate function call
  40. * @param [in] warps span of images with warped faces.
  41. * @param [out] glassesEstimations output GlassesEstimation span.
  42. * @return Result with error code.
  43. * @see Span, GlassesEstimation, Image, Result and FSDKError for details.
  44. * @note warps format must be R8G8B8, @see Format.
  45. * @note all spans should be based on user owned continuous collections.
  46. * @note all spans should be equal size.
  47. * */
  48. virtual Result<FSDKError>
  49. estimate(
  50. Span<const Image> warps,
  51. Span<GlassesEstimation> glassesEstimations) const noexcept = 0;
  52. /**
  53. * @brief Validate input of multiple frames in a single function call.
  54. * @param [in] warps span of images with warped faces.
  55. * @param [out] errors output span of errors for each image.
  56. * @return Result with error code.
  57. * @see Span, Image, Result and FSDKError for details.
  58. * @note warps format must be R8G8B8, @see Format.
  59. * @note all spans should be based on user owned continuous collections.
  60. * @note all spans should be equal size.
  61. * */
  62. virtual Result<FSDKError>
  63. validate(
  64. Span<const Image> warps,
  65. Span<Result<FSDKError>> errors) const noexcept = 0;
  66. };
  67. } // namespace fsdk