You need to enable JavaScript to run this app.
导航
车端脱敏算法
最近更新时间:2025.03.17 14:05:17首次发布时间:2025.03.17 14:05:17
我的收藏
有用
有用
无用
无用
简介

对视频中的车牌和人脸进行检测,输出车牌或人脸的位置矩形框、类别和置信度;目前应用在车端脱敏功能中。

C接口说明

详细接口说明查看头文件: bef_effect_ai_license_cake.h

1.创建算法句柄

BEF_SDK_API
bef_effect_result_t bef_effect_ai_license_cake_create(bef_effect_handle_t *handle);

参数说明

参数名参数类型参数说明
handlebef_effect_handle_t*创建的算法句柄
BEF_SDK_API
bef_effect_result_t bef_effect_ai_license_cake_init(bef_effect_handle_t handle, const char *modelPath);

参数说明

参数名参数类型参数说明
handlebef_ai_facefitting_handle创建的算法句柄
model_pathconst char *模型的路径

返回值
成功返回 BEF_RESULT_SUC, 失败返回相应错误码, 具体请参考 bef_effect_ai_public_define.h

2. 算法执行

BEF_SDK_API
bef_effect_result_t bef_effect_ai_license_cake_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,
                                                         int *license_cake_info_num,
                                                         bef_ai_license_cake_info **license_cake_info)

参数说明

参数名参数类型参数说明
handlebef_effect_handle_t算法句柄
imageconst unsigned char *输入图像数据
pixel_formatbef_ai_pixel_format输入图像格式
image_widthint输入输入图像的宽度 (以像素为单位)
image_heightint输入图像高输入图像的高度 (以像素为单位)
image_strideint输入图像每一行的步长 (以像素为单位)
orientationbef_ai_rotate_type输入图像的转向,具体请参考 bef_effect_ai_public_define.h 中的 bef_rotate_type
license_cake_info_numint最大支持检测数(10)
license_cake_infobef_ai_license_cake_info检测结果

返回值
成功返回 BEF_RESULT_SUC, 失败返回相应错误码, 具体请参考 bef_effect_ai_public_define.h

3.释放句柄

BEF_SDK_API bef_effect_result_t
bef_effect_result_t bef_effect_ai_license_cake_release(bef_effect_handle_t handle);

参数说明

参数名参数类型参数说明
handlebef_effect_handle_t算法的句柄

返回值
成功返回 BEF_RESULT_SUC, 失败返回相应错误码, 具体请参考 bef_effect_ai_public_define.h

4.license cake 算法授权

// 离线license检测方式
BEF_SDK_API
bef_effect_result_t bef_effect_ai_license_cake_check_license(bef_effect_handle_t handle, const char* licensePath)

// 在线license检测方式
BEF_SDK_API 
bef_effect_result_t bef_effect_ai_license_cake_check_online_license(bef_effect_handle_t handle, const char *licensePath)

参数说明

参数名参数类型参数说明
handlebef_effect_handle_t算法句柄
licensePathconst char *授权文件字符串

返回值
成功返回 BEF_RESULT_SUC, 失败返回相应错误码, 具体请参考 bef_effect_ai_public_define.h

5. 算法设置参数

/**
 * @brief 模型参数类型
 */
typedef enum {
    ALGORITHM_PARAMS_KEY_LICENSEFACE_DEDETECTION_DETECT_INTERVAL = 0,                   // 定义执行检测算法帧率,例如每隔n帧执行一次检测算法
    ALGORITHM_PARAMS_KEY_LICENSEFACE_DEDETECTION_SIDE_MODEL_LEN = 1,                    // 定义执行检测算法的输入分辨率
    ALGORITHM_PARAMS_KEY_LICENSEFACE_DEDETECTION_DETECT_USE_REGRESSOR = 2,              // 定义是否执行跟踪(回归)算法,暂未ready
    ALGORITHM_PARAMS_KEY_LICENSEFACE_DEDETECTION_DETECT_USE_TRACKER = 3,                // 定义是否执行跟踪(卡尔曼滤波)算法,暂未ready
} bef_ai_license_cake_param_type;

BEF_SDK_API
bef_effect_result_t bef_effect_ai_license_cake_set_paramS(bef_effect_handle_t handle, bef_ai_license_cake_param_type type, const char *value);

BEF_SDK_API
bef_effect_result_t bef_effect_ai_license_cake_set_paramF(bef_effect_handle_t handle, bef_ai_license_cake_param_type type, float value);

BEF_SDK_API
bef_effect_result_t bef_effect_ai_license_cake_set_paramI(bef_effect_handle_t handle, bef_ai_license_cake_param_type type, int value);

Java 接口说明

接口说明
详细接口说明查看文件:com.bytedance.labcv.effectsdk.LicenseCakeDetect.java

1.初始化LicenseCake 句柄

int init(Context context, String modelPath, String licensePath, boolean onlineLicense) 

参数说明

参数名参数类型参数说明
contextStringjava context
modelPathString模型目录路径
licensePathString授权文件绝对路径
onlineLicenseboolean授权类型

返回值
成功返回BEF_RESULT_SUC,否则返回对应的错误码

2.License Cake 算法处理 并得到结果

public BefLicenseCakeInfo detect(ByteBuffer buffer, BytedEffectConstants.PixlFormat pixelFormat, int imageWidth, int imageHeight, int imageStride, BytedEffectConstants.Rotation orientation)

参数说明

参数名参数类型参数说明
bufferByteBuffer图像输出
pixelFormatBytedEffectConstants.PixlFormat图像格式
image_widthint输入输入图像的宽度 (以像素为单位)
image_heightint输入图像高输入图像的高度 (以像素为单位)
image_strideint输入图像每一行的步长 (以像素为单位)
orientationBytedEffectConstants.Rotation输入图像的转向

算法结果
BefLicenseCakeInfo:LicenseCake的算法结果

3.释放License Cake句柄

public void release()
FAQ

1.如果出现任何异常,请查看是否有以下类型日志

答:建议首先查看以下tag输出Error类型的日志:
bef_effect_ai 和SMASH_E_LOG 以及 EffectSDK

错误码

错误码请参考错误码表