bef_effect_ai_lightcls.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. #ifndef ANDROIDDEMO_BEF_EFFECT_AI_LIGHTCLS_H
  2. #define ANDROIDDEMO_BEF_EFFECT_AI_LIGHTCLS_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 LIGHT_CLASSES 7
  8. //typedef enum {
  9. // Indoor_Yellow = 0,
  10. // Indoor_White,
  11. // Indoor_weak,
  12. // Sunny,
  13. // Cloudy,
  14. // Night,
  15. // Backlight
  16. //} bef_ai_light_cls_light_type;
  17. typedef struct bef_ai_light_cls_result_st {
  18. int selected_index;
  19. float prob;
  20. } bef_ai_light_cls_result;
  21. /**
  22. @brief 创建光线检测句柄
  23. @param [in] handle 待创建的光线检测句柄
  24. @param [in] model_path 模型文件路径
  25. @return If succeed return BEF_RESULT_SUC, other value please see bef_effect_ai_public_define.h
  26. 成功返回 BEF_RESULT_SUC, 失败返回相应错误码, 具体请参考 bef_effect_ai_public_define.h
  27. */
  28. BEF_SDK_API bef_effect_result_t
  29. bef_effect_ai_lightcls_create(
  30. bef_effect_handle_t *handle,
  31. const char *model_path,
  32. int fps
  33. );
  34. /**
  35. @brief 光线检测
  36. @param [in] handle Created light detect handle
  37. 已创建的光线检测句柄
  38. @param [in] image Image base address
  39. 输入图片的数据指针
  40. @param [in] pixel_format Pixel format of input image
  41. 输入图片的格式
  42. @param [in] image_width Image width
  43. 输入图像的宽度 (以像素为单位)
  44. @param [in] image_height Image height
  45. 输入图像的高度 (以像素为单位)
  46. @param [in] image_stride Image stride in each row
  47. 输入图像每一行的步长 (以像素为单位)
  48. @param [in] orientation Image orientation
  49. 输入图像的转向,具体请参考 bef_effect_ai_public_define.h 中的 bef_rotate_type
  50. @param [out] bef_ai_light_cls_result 存放结果信息,需外部分配好内存
  51. @return If succeed return BEF_RESULT_SUC, other value please see bef_effect_ai_public_define.h
  52. 成功返回 BEF_RESULT_SUC, 失败返回相应错误码, 具体请参考 bef_effect_ai_public_define.h
  53. */
  54. BEF_SDK_API bef_effect_result_t
  55. bef_effect_ai_lightcls_detect(
  56. bef_effect_handle_t handle,
  57. const unsigned char *image,
  58. bef_ai_pixel_format pixel_format,
  59. int image_width,
  60. int image_height,
  61. int image_stride,
  62. bef_ai_rotate_type orientation,
  63. bef_ai_light_cls_result *result
  64. );
  65. /**
  66. @param [in] handle Destroy the created light detect handle
  67. 销毁创建的光线检测句柄
  68. */
  69. BEF_SDK_API bef_effect_result_t
  70. bef_effect_ai_lightcls_release(
  71. bef_effect_handle_t handle
  72. );
  73. /**
  74. @brief 光线检测授权
  75. @param [in] handle Created light detect handle
  76. 已创建的光线检测句柄
  77. @param [in] license 授权文件字符串
  78. @param [in] length 授权文件字符串长度
  79. @return If succeed return BEF_RESULT_SUC, other value please refer bef_effect_ai_public_define.h
  80. 成功返回 BEF_RESULT_SUC, 授权码非法返回 BEF_RESULT_INVALID_LICENSE ,其它失败返回相应错误码, 具体请参考 bef_effect_ai_public_define.h
  81. */
  82. #if defined(__ANDROID__) || defined(TARGET_OS_ANDROID)
  83. BEF_SDK_API bef_effect_result_t
  84. bef_effect_ai_lightcls_check_license(
  85. JNIEnv* env,
  86. jobject context,
  87. bef_effect_handle_t handle,
  88. const char *licensePath
  89. );
  90. #else
  91. #ifdef __APPLE__
  92. BEF_SDK_API bef_effect_result_t
  93. bef_effect_ai_lightcls_check_license(
  94. bef_effect_handle_t handle,
  95. const char *licensePath
  96. );
  97. #endif
  98. #endif
  99. BEF_SDK_API bef_effect_result_t
  100. bef_effect_ai_lightcls_check_online_license(bef_effect_handle_t handle, const char *licensePath);
  101. #endif //ANDROIDDEMO_BEF_EFFECT_AI_LIGHTCLS_H