脏镜头检测提供了一套在拍摄前判断镜头是否脏污的解决方案,从源头上防止因镜头脏污而产生的低质视频,给用户的拍摄提供更强的保障。
V4.4.2及之后版本新增算法,iOS11以下机器不支持除画质模块除插帧外的算法。
支持平台 | Android、iOS |
---|---|
支持输入格式 | BGR888 |
内存占用 | <11.99M (测试设备OPPO R11) |
检测速度 | <3.29ms(测试设备OPPO R11) |
双端接口非线程安全,需要保证单线程进行算法的创建、执行和销毁。详细接口说明查看头文件:bef_ai_image_quality_enhancement_taint_detect.h
BEF_SDK_API bef_effect_result_t bef_ai_image_quality_enhancement_taint_detect_create( bef_image_quality_enhancement_handle *handle, bef_ai_taint_scene_detect_param *param); typedef struct bef_ai_taint_scene_detect_param { int detectFrequency; const char* modelPath; const char* kernelBinPath; bef_ai_lens_backend_type backendType; int numThread; // only make sense when backendType is CPU, default set 2 }bef_ai_taint_scene_detect_param;
参数说明
参数名 | 参数类型 | 参数说明 |
---|---|---|
handle | bef_image_quality_enhancement_handle* | 创建的脏镜头检测算法句柄 |
config | bef_ai_taint_scene_detect_param* | 算法初始化时的配置参数 |
返回值
成功返回 BEF_RESULT_SUC, 失败返回相应错误码, 具体请参考 bef_effect_ai_public_define.h
注意:
算法输入要求为宽高224的BGR小图,小图不能是使用crop后丢失了内容的图像,必须是scale出来的小图。
switchScene表示如果算法实例是复用的话,每次检测一开始第一帧设置下true,第二帧及以后就是false了。相当于,把以前检测结果缓存的信息给reset掉。如果每次检测启动一个算法实例,这里不用配置这个逻辑,直接设置成false即可。
BEF_SDK_API bef_effect_result_t bef_ai_image_quality_enhancement_taint_detect_process( bef_image_quality_enhancement_handle handle, bef_ai_taint_scene_detect_buffer *input, float *score); typedef struct bef_ai_taint_scene_detect_buffer { void *inBuffer; bool switchScene; }bef_ai_taint_scene_detect_buffer;
参数说明
参数名 | 参数类型 | 参数说明 |
---|---|---|
handle | bef_image_quality_enhancement_handle | 脏镜头检测算法句柄 |
input | bef_ai_taint_scene_detect_buffer* | 脏镜头检测算法输入 |
score | float* | 脏镜头概率输出 |
返回值
成功返回 BEF_RESULT_SUC, 失败返回相应错误码, 具体请参考 bef_effect_ai_public_define.h
BEF_SDK_API bef_effect_result_t bef_ai_image_quality_enhancement_taint_detect_destroy( bef_image_quality_enhancement_handle handle);
参数说明
参数名 | 参数类型 | 参数说明 |
---|---|---|
handle | bef_image_quality_enhancement_handle | 脏镜头检测算法句柄 |
返回值
成功返回 BEF_RESULT_SUC, 失败返回相应错误码, 具体请参考 bef_effect_ai_public_define.h
// 离线license检测方式 BEF_SDK_API bef_effect_result_t bef_ai_image_quality_enhancement_taint_detect_check_license( bef_image_quality_enhancement_handle handle, const char* licensePath); // 在线license检测方式 BEF_SDK_API bef_effect_result_t bef_ai_image_quality_enhancement_taint_detect_check_online_license( bef_image_quality_enhancement_handle handle, const char* licensePath)
参数说明
参数名 | 参数类型 | 参数说明 |
---|---|---|
handle | bef_image_quality_enhancement_handle | 脏镜头检测算法句柄 |
licensePath | const char * | 授权文件路径 |
返回值
成功返回 BEF_RESULT_SUC, 失败返回相应错误码, 具体请参考 bef_effect_ai_public_define.h
接口说明
详细接口说明查看文件:com.bytedance.labcv.effectsdk.TaintSceneDetect.java
public int init( Context context, TaintDetectParam param, String licensePath, boolean onlineLicense);
参数说明
参数名 | 参数类型 | 参数说明 |
---|---|---|
context | Context | 安卓context |
param | TaintDetectParam | 脏镜头检测参数 |
licensePath | String | 授权文件路径 |
onlineLicense | boolean | 配置在线授权或离线授权 |
返回值
成功返回BEF_RESULT_SUC,否则返回对应的错误码
备注
关于TaintDetectParam可参考com.bytedance.labcv.effectsdk.TaintSceneDetect.java,并且其定义与C接口bef_ai_image_quality_enhancement_taint_detect保持一致。
public float process( ByteBuffer buffer);
参数说明
参数名 | 参数类型 | 参数说明 |
---|---|---|
buffer | ByteBuffer | 输入buffer |
返回值
返回脏镜头判断概率值
public void release()
答:建议首先查看以下tag输出Error类型的日志:
bef_effect_ai 和SMASH_E_LOG 以及 EffectSDK
错误码请参考错误码表