bef_effect_ai_human_distance.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. #ifndef ANDROIDDEMO_BEF_EFFECT_AI_HUMAN_DIATANCE_H
  2. #define ANDROIDDEMO_BEF_EFFECT_AI_HUMAN_DIATANCE_H
  3. #if defined(__ANDROID__) || defined(TARGET_OS_ANDROID)
  4. #include<jni.h>
  5. #endif
  6. #include "bef_effect_ai_public_define.h"
  7. #include "bef_effect_ai_face_detect.h"
  8. #include "bef_effect_ai_face_attribute.h"
  9. /*
  10. *@brief 距离检测结果结构体
  11. *@param
  12. * face_count 有效的人脸个数
  13. **/
  14. typedef struct bef_ai_human_distance_result_st {
  15. float distances[BEF_MAX_FACE_NUM];
  16. int face_count; //有效的人脸个数,即表示attr_info中的前face_count个人脸是有效的
  17. }bef_ai_human_distance_result;
  18. /**
  19. * @brief 距离检测参数类型
  20. */
  21. typedef enum{
  22. BEF_HumanDistanceEdgeMode,
  23. BEF_HumanDistanceCameraFov
  24. }bef_ai_human_distance_param_type;
  25. typedef enum {
  26. BEF_HumanDistanceModel1 = 1
  27. }bef_human_distance_model_type;
  28. /**
  29. * 创建距离检测的句柄
  30. *@brief 初始化handle
  31. *@param [out] handle Created face verify handle
  32. * 创建的人手检测句柄
  33. *@return If succeed return BEF_RESULT_SUC, other value please see bef_effect_ai_public_define.h
  34. * 成功返回 BEF_RESULT_SUC, 失败返回相应错误码, 具体请参考 bef_effect_ai_public_define.h
  35. */
  36. BEF_SDK_API bef_effect_result_t
  37. bef_effect_ai_human_distance_create(
  38. bef_effect_handle_t *handle
  39. );
  40. BEF_SDK_API bef_effect_result_t
  41. bef_effect_ai_human_distance_load_model(
  42. bef_effect_handle_t handle,
  43. bef_human_distance_model_type mode_type,
  44. const char *path
  45. );
  46. /**
  47. * 设置距离检测参数
  48. *@brief 初始化后的handle
  49. *@param [out] handle Created face verify handle
  50. * 创建的人手检测句柄
  51. *
  52. *@return If succeed return BEF_RESULT_SUC, other value please see bef_effect_ai_public_define.h
  53. * 成功返回 BEF_RESULT_SUC, 失败返回相应错误码, 具体请参考 bef_effect_ai_public_define.h
  54. */
  55. BEF_SDK_API bef_effect_result_t
  56. bef_effect_ai_human_distance_setparam(
  57. bef_effect_handle_t handle,
  58. bef_ai_human_distance_param_type param_type,
  59. float value
  60. );
  61. /**
  62. * @brief 距离检测
  63. * @param [in] handle Created face attribute detect handle
  64. * 已创建的距离检测句柄
  65. * @param [in] image Image base address
  66. * 输入图片的数据指针
  67. * @param [in] pixel_format Pixel format of input image
  68. * 输入图片的格式
  69. * @param [in] image_width Image width
  70. * 输入图像的宽度 (以像素为单位)
  71. * @param [in] image_height Image height
  72. * 输入图像的高度 (以像素为单位)
  73. * @param [in] image_stride Image stride in each row
  74. * 输入图像每一行的步长 (以像素为单位)
  75. * @param [in] ptr_base_info 人脸检测结果
  76. * @return If succeed return BEF_RESULT_SUC, other value please see bef_effect_base_define.h
  77. * 成功返回 BEF_RESULT_SUC, 失败返回相应错误码, 具体请参考 bef_effect_base_define.h
  78. */
  79. BEF_SDK_API bef_effect_result_t
  80. bef_effect_ai_human_distance_detect(
  81. bef_effect_handle_t handle,
  82. const unsigned char *src_image_data,
  83. bef_ai_pixel_format pixel_format,
  84. int width,
  85. int height,
  86. int image_stride,
  87. bef_ai_rotate_type orientation,
  88. const bef_ai_face_info *ptr_base_info,
  89. const bef_ai_face_attribute_result *ptr_attr_info,
  90. bef_ai_human_distance_result *ptr_human_distance_info
  91. );
  92. /**
  93. * @brief 距离检测
  94. * @param [in] handle Created face attribute detect handle
  95. * 已创建的距离检测句柄
  96. * @param [in] image Image base address
  97. * 输入图片的数据指针
  98. * @param [in] pixel_format Pixel format of input image
  99. * 输入图片的格式
  100. * @param [in] image_width Image width
  101. * 输入图像的宽度 (以像素为单位)
  102. * @param [in] image_height Image height
  103. * 输入图像的高度 (以像素为单位)
  104. * @param [in] image_stride Image stride in each row
  105. * 输入图像每一行的步长 (以像素为单位)
  106. * @param [in] device_name 设备名称
  107. * @param [in] ptr_base_info 人脸检测结果
  108. * @return If succeed return BEF_RESULT_SUC, other value please see bef_effect_base_define.h
  109. * 成功返回 BEF_RESULT_SUC, 失败返回相应错误码, 具体请参考 bef_effect_base_define.h
  110. */
  111. BEF_SDK_API
  112. bef_effect_result_t
  113. bef_effect_ai_human_distance_detect_V2(
  114. bef_effect_handle_t handle,
  115. const unsigned char *src_image_data,
  116. bef_ai_pixel_format pixel_format,
  117. int width,
  118. int height,
  119. int image_stride,
  120. const char *device_name,
  121. bool is_front,
  122. bef_ai_rotate_type orientation,
  123. const bef_ai_face_info *ptr_base_info,
  124. const bef_ai_face_attribute_result *ptr_attr_info,
  125. bef_ai_human_distance_result *ptr_human_distance_info
  126. );
  127. /**
  128. * @param [in] handle Destroy the created human distance detect handle
  129. * 销毁创建的距离估计检测句柄
  130. */
  131. BEF_SDK_API void
  132. bef_effect_ai_human_distance_destroy(
  133. bef_effect_handle_t handle
  134. );
  135. /**
  136. * @brief 距离检测授权
  137. * @param [in] handle Created face attribute detect handle
  138. * 已创建的距离检测句柄
  139. * @param [in] license 授权文件字符串
  140. * @param [in] length 授权文件字符串长度
  141. * @return If succeed return BEF_RESULT_SUC, other value please refer bef_effect_ai_public_define.h
  142. * 成功返回 BEF_RESULT_SUC, 授权码非法返回 BEF_RESULT_INVALID_LICENSE ,其它失败返回相应错误码, 具体请参考 bef_effect_ai_public_define.h
  143. */
  144. #if defined(__ANDROID__) || defined(TARGET_OS_ANDROID)
  145. BEF_SDK_API bef_effect_result_t bef_effect_ai_human_distance_check_license(JNIEnv* env,
  146. jobject context, bef_effect_handle_t handle, const char *licensePath);
  147. #else
  148. #ifdef __APPLE__
  149. BEF_SDK_API bef_effect_result_t bef_effect_ai_human_distance_check_license(bef_effect_handle_t handle,
  150. const char *licensePath);
  151. #endif
  152. #endif
  153. BEF_SDK_API bef_effect_result_t
  154. bef_effect_ai_human_distance_check_online_license(bef_effect_handle_t handle,
  155. const char *licensePath);
  156. #endif //ANDROIDDEMO_BEF_EFFECT_AI_HUMAN_DIATANCE_H