bef_effect_ai_headseg.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #ifndef _BEF_EFFECT_HEADSEG_AI_H
  2. #define _BEF_EFFECT_HEADSEG_AI_H
  3. #if defined(__ANDROID__) || defined(TARGET_OS_ANDROID)
  4. #include <jni.h>
  5. #endif
  6. #include "bef_effect_ai_public_define.h"
  7. #define HS_FACE_KEY_POINT_NUM 106
  8. typedef long long bef_ai_headseg_handle;
  9. typedef struct
  10. {
  11. int net_input_width; //网络输入的大小
  12. int net_input_height;
  13. } bef_ai_headseg_config;
  14. typedef struct
  15. {
  16. int face_id;
  17. bef_ai_fpoint points[HS_FACE_KEY_POINT_NUM];
  18. } bef_ai_headseg_faceinfo;
  19. typedef struct
  20. {
  21. int face_id;
  22. unsigned char* alpha;
  23. unsigned char* crop;
  24. int width;
  25. int height;
  26. int channel;
  27. double matrix[6];
  28. } bef_ai_headseg_face_result;
  29. typedef struct
  30. {
  31. unsigned char* image;
  32. int image_width;
  33. int image_height;
  34. int image_stride;
  35. bef_ai_pixel_format pixel_format; // kPixelFormat_BGRA8888 或者 kPixelFormat_RGBA8888
  36. bef_ai_rotate_type orient;
  37. bef_ai_headseg_faceinfo* face_info;
  38. int face_count;
  39. } bef_ai_headseg_input;
  40. typedef struct
  41. {
  42. bef_ai_headseg_face_result* face_result;
  43. int face_count;
  44. } bef_ai_headseg_output;
  45. typedef enum
  46. {
  47. BEF_AI_HS_ENABLE_TRACKING = 1, // default set to 1 传递true 用于 防抖
  48. BEF_AI_HS_MAX_FACE = 2,
  49. } bef_ai_headseg_paramtype;
  50. BEF_SDK_API
  51. int BEF_AI_HSeg_CreateHandler(bef_ai_headseg_handle* out);
  52. BEF_SDK_API
  53. int BEF_AI_HSeg_CheckLicense(bef_ai_headseg_handle handle, const char* licensePath);
  54. BEF_SDK_API
  55. int BEF_AI_HSeg_CheckOnlineLicense(bef_ai_headseg_handle handle, const char* licensePath);
  56. //设置网络输入参数
  57. BEF_SDK_API
  58. int BEF_AI_HSeg_SetConfig(bef_ai_headseg_handle handle, bef_ai_headseg_config* config);
  59. //设置模型参数
  60. BEF_SDK_API
  61. int BEF_AI_HSeg_SetModelFromBuff(bef_ai_headseg_handle handle,
  62. const unsigned char* param,
  63. unsigned int param_len);
  64. //设置模块参数
  65. BEF_SDK_API
  66. int BEF_AI_HSeg_SetParam(bef_ai_headseg_handle handle, bef_ai_headseg_paramtype type, float value);
  67. BEF_SDK_API
  68. // int HS_InitModel(HeadSegHandle handle, const char* param);
  69. int BEF_AI_HSeg_InitModel(bef_ai_headseg_handle handle, const char* param_path);
  70. BEF_SDK_API
  71. int BEF_AI_HSeg_DoHeadSeg(bef_ai_headseg_handle handle,
  72. bef_ai_headseg_input* input,
  73. bef_ai_headseg_output* output);
  74. BEF_SDK_API
  75. int BEF_AI_HSeg_ReleaseHandle(bef_ai_headseg_handle handle);
  76. #endif // _BEF_EFFECT_HEADSEG_AI_H