AvaBoost 是一款用于面部表情驱动的算法,可以输出 ARKit 体系下的 【52 维表情系数】以及【人脸姿态矩阵】。算法要求输入分辨率360x640或以上。
该算法为V4.5.0新增算法。
支持平台 | Android、iOS |
---|---|
支持输入格式 | RGBA8888、BGRA8888 |
内存占用 | <23M (测试设备OPPO R11) |
检测速度 | <37ms(测试设备OPPO R11) |
详细接口说明查看头文件:bef_effect_ai_avaboost.h
BEF_SDK_API bef_effect_result_t bef_effect_ai_avaboost_create(bef_effect_handle_t *handle);
参数说明
参数名 | 参数类型 | 参数说明 |
---|---|---|
handle | bef_effect_handle_t* | 创建的表情驱动算法句柄 |
返回值
成功返回 BEF_RESULT_SUC, 失败返回相应错误码, 具体请参考 bef_effect_ai_public_define.h
BEF_SDK_API bef_effect_result_t bef_effect_ai_avaboost_init(bef_effect_handle_t handle, const char *modelPath);
参数说明
参数名 | 参数类型 | 参数说明 |
---|---|---|
handle | bef_effect_handle_t | 表情驱动算法句柄 |
modelPath | const char* | 表情驱动算法模型路径 |
返回值
成功返回 BEF_RESULT_SUC, 失败返回相应错误码, 具体请参考 bef_effect_ai_public_define.h
BEF_SDK_API bef_effect_result_t bef_effect_ai_avaboost_detect( bef_effect_handle_t handle, const unsigned char *image, bef_ai_pixel_format pixel_format, int image_width, int image_height, int image_stride, bef_ai_rotate_type orientation, bef_ai_avaboost_ret* result );
参数说明
参数名 | 参数类型 | 参数说明 |
---|---|---|
handle | bef_effect_handle_t | 表情驱动算法句柄 |
image | const unsigned char* | 输入图像buffer |
pixel_format | bef_ai_pixel_format | 输入图像格式 |
image_width | int | 输入图像宽度 |
image_height | int | 输入图像高度 |
image_stride | int | 输入图像通道数 |
orientation | bef_ai_rotate_type | 输入图像是否存在旋转,人脸为正时认为图像不需要旋转 |
result | bef_ai_avaboost_ret* |
返回值
成功返回 BEF_RESULT_SUC, 失败返回相应错误码, 具体请参考 bef_effect_ai_public_define.h
/** * @brief avaboost授权 * @param [in] handle Created avaboost handle * 已创建的avaboost句柄 * @param [in] license 授权文件字符串 * @param [in] length 授权文件字符串长度 * @return If succeed return BEF_RESULT_SUC, other value please refer bef_effect_ai_public_define.h * 成功返回 BEF_RESULT_SUC, 授权码非法返回 BEF_RESULT_INVALID_LICENSE ,其它失败返回相应错误码, 具体请参考 bef_effect_ai_public_define.h */ BEF_SDK_API bef_effect_result_t bef_effect_ai_avaboost_check_license(bef_effect_handle_t handle, const char *licensePath); BEF_SDK_API bef_effect_result_t bef_effect_ai_avaboost_check_online_license(bef_effect_handle_t handle, const char *licensePath);
参数说明
参数名 | 参数类型 | 参数说明 |
---|---|---|
handle | bef_effect_handle_t | 表情驱动算法句柄 |
licensePath | const char * | 授权文件路径 |
返回值
成功返回 BEF_RESULT_SUC, 失败返回相应错误码, 具体请参考 bef_effect_ai_public_define.h
BEF_SDK_API bef_effect_result_t bef_effect_ai_avaboost_release(bef_effect_handle_t handle);
参数说明
参数名 | 参数类型 | 参数说明 |
---|---|---|
handle | bef_effect_handle_t | 表情驱动算法句柄 |
返回值
成功返回 BEF_RESULT_SUC, 失败返回相应错误码, 具体请参考 bef_effect_ai_public_define.h
['eyeLookDown_L', 'noseSneer_L', 'eyeLookIn_L', 'browInnerUp', 'eyeSquint_L', 'mouthClose', 'mouthLowerDown_R', 'jawOpen', 'mouthShrugLower', 'mouthLowerDown_L', 'mouthFunnel', 'eyeLookIn_R', 'eyeLookDown_R', 'noseSneer_R', 'mouthRollUpper', 'jawRight', 'mouthDimple_L', 'mouthRollLower', 'mouthSmile_L', 'mouthPress_L', 'mouthSmile_R', 'mouthPress_R', 'mouthDimple_R', 'mouthLeft', 'browDown_R', 'browDown_L', 'mouthFrown_L', 'eyeBlink_L', 'cheekSquint_L', 'browOuterUp_L', 'eyeLookUp_L', 'jawLeft', 'mouthStretch_L', 'mouthStretch_R', 'mouthPucker', 'eyeLookUp_R', 'browOuterUp_R', 'cheekSquint_R', 'eyeBlink_R', 'mouthUpperUp_L', 'mouthFrown_R', 'eyeSquint_R', 'jawForward', 'mouthUpperUp_R', 'cheekPuff', 'eyeLookOut_L', 'eyeLookOut_R', 'eyeWide_R', 'mouthRight', 'eyeWide_L', 'mouthShrugUpper', 'tongueOut']
接口说明
详细接口说明查看文件:com.effectsar.labcv.effectsdk.AvaBoost.java
public int init(Context context, String modelPath, String licensePath, boolean onlineLicense)
参数说明
参数名 | 参数类型 | 参数说明 |
---|---|---|
context | Context | 安卓context |
modelPath | String | 表情驱动算法模型路径 |
licensePath | String | 授权文件路径 |
onlineLicense | boolean | 配置在线授权或离线授权 |
返回值
成功返回BEF_RESULT_SUC,否则返回对应的错误码
public BefAvaBoostInfo detect(ByteBuffer buffer, EffectsSDKEffectConstants.PixlFormat pixelFormat, int imageWidth, int imageHeight, int imageStride, orientation)
参数说明
参数名 | 参数类型 | 参数说明 |
---|---|---|
buffer | ByteBuffer | 输入buffer |
pixelFormat | EffectsSDKEffectConstants.PixlFormat | 输入图像格式 |
imageWidth | int | 输入图像宽度 |
imageHeight | int | 输入图像高度 |
imageStride | int | 输入图像步长 |
orientation | EffectsSDKEffectConstants.Rotation | 输入图像是否存在旋转,人脸为正时认为图像不需要旋转 |
返回值
返回算法结果BefAvaBoostInfo对象,关于BefAvaBoostInfo可参考com.effectsar.labcv.effectsdk.AvaBoost.java,并且其定义与C接口bef_ai_avaboost_ret保持一致。
public void release()
答:建议首先查看以下tag输出Error类型的日志:
bef_effect_ai 和SMASH_E_LOG 以及 EffectSDK
错误码请参考错误码表