车辆检测SDK提供从图像中实时提取车辆、车牌信息的能力。
| 支持平台 | Android、iOS、Windows、Mac |
|---|---|
| 支持输入格式 | RGBA8888、BGRA8888、BGR888、RGB888、NV21、NV12、YUV420P |
| 支持最小输入尺寸 | 短边128 |
| 内存占用 | <3M (测试设备OppoR11) |
| 检测速度 | <7ms(测试设备iPhone7) |
详细接口说明查看头文件:bef_effect_ai_car_detect.h
BEF_SDK_API bef_effect_result_t bef_effect_ai_car_detect_create_handle(bef_ai_car_handle* handle);
参数说明
| 参数名 | 参数类型 | 参数说明 |
|---|---|---|
| handle | bef_ai_car_handle | 创建的车辆检测句柄 |
返回值
成功返回 BEF_RESULT_SUC, 失败返回相应错误码, 具体请参考 bef_effect_ai_public_define.h
BEF_SDK_API bef_effect_result_t bef_effect_ai_car_detect_init_model(bef_ai_car_handle handle, bef_ai_car_model_type modelType, const char* modelPath);
参数说明
| 参数名 | 参数类型 | 参数说明 |
|---|---|---|
| handle | bef_ai_car_handle | 车辆检测句柄 |
| modelType | bef_ai_car_model_type | 车辆检测模型类型 |
| modelPath | const char* | 模型文件的路径 |
返回值
成功返回 BEF_RESULT_SUC, 失败返回相应错误码, 具体请参考 bef_effect_ai_public_define.h
BEF_SDK_API bef_effect_result_t bef_effect_ai_car_detect_set_paramf(bef_ai_car_handle handle, bef_ai_car_param_type type, float value);
参数说明
| 参数名 | 参数类型 | 参数说明 |
|---|---|---|
| handle | bef_ai_car_handle | 车辆检测句柄 |
| use_tracking | bef_ai_car_param_type | 算法内部参数,目前传入 true 即可 |
| use_blur | float | 算法内部参数,目前传入 true 即可 |
返回值
成功返回 BEF_RESULT_SUC, 失败返回相应错误码, 具体请参考 bef_effect_ai_public_define.h
BEF_SDK_API bef_effect_result_t bef_effect_ai_car_detect_detect(bef_ai_car_handle 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_car_ret* car_info);
参数说明
| 参数名 | 参数类型 | 参数说明 |
|---|---|---|
| handle | bef_ai_car_handle | 车辆检测句柄 |
| image | const unsigned char* | 为传入图像的大小,图像大小任意 |
| pixel_format | bef_ai_pixel_format | 传入图像的类型 |
| image_width | int | 传入图像的宽 |
| image_height | int | 传入图像的高 |
| image_stride | int | 传入图像的步长 |
| orientation | bef_ai_rotate_type | 传入图像旋转角 |
| bef_ai_car_ret | bef_ai_car_ret | 检测结果 |
返回值
成功返回 BEF_RESULT_SUC, 失败返回相应错误码, 具体请参考 bef_effect_ai_public_define.h
BEF_SDK_API bef_effect_result_t bef_effect_ai_car_detect_destroy(bef_ai_car_handle handle);
参数说明
| 参数名 | 参数类型 | 参数说明 |
|---|---|---|
| handle | bef_ai_car_handle | 车辆检测句柄 |
返回值
成功返回 BEF_RESULT_SUC, 失败返回相应错误码, 具体请参考 bef_effect_ai_public_define.h
BEF_SDK_API bef_effect_result_t bef_effect_ai_car_detect_check_license(bef_ai_car_handle handle, const char* licensePath);
参数说明
| 参数名 | 参数类型 | 参数说明 |
|---|---|---|
| handle | bef_ai_car_handle | 车辆检测句柄 |
| licensePath | const char * | 授权文件字符串 |
返回值
成功返回 BEF_RESULT_SUC, 失败返回相应错误码, 具体请参考 bef_effect_ai_public_define.h
接口说明
详细接口说明查看文件:com.bytedance.labcv.effectsdk.CarDetect.java
public int createHandle(String licensePath);
参数说明
| 参数名 | 参数类型 | 参数说明 |
|---|---|---|
| licensePath | const char * | 授权文件绝对路径 |
返回值
成功返回BEF_RESULT_SUC,否则返回对应的错误码
public int setParam(BytedEffectConstants.CarParamType paramType, float paramValue)
参数说明
| 参数名 | 参数类型 | 参数说明 |
|---|---|---|
| paramType | BytedEffectConstants.CarParamType | 是否跟踪 传入true |
| paramValue | float | 是否模糊 传入true |
返回值
成功返回BEF_RESULT_SUC,否则返回对应的错误码
public int setModel(BytedEffectConstants.CarModelType modelType, String modelPath)
参数说明
| 参数名 | 参数类型 | 参数说明 |
|---|---|---|
| modelType | BytedEffectConstants.CarModelType | |
| modelPath | String |
返回值
成功返回BEF_RESULT_SUC,否则返回对应的错误码
public BefCarDetectInfo detect(ByteBuffer buffer, BytedEffectConstants.PixlFormat pixel_format, int image_width, int image_height, int image_stride, BytedEffectConstants.Rotation orientation)
参数说明
| 参数名 | 参数类型 | 参数说明 |
|---|---|---|
| buffer | ByteBuffer | 输入图像数据 |
| pixel_format | BytedEffectConstants.PixlFormat | 输入数据格式 |
| image_width | int | 输入图像宽度 |
| image_height | int | 输入图像高度 |
| image_stride | int | 输入图像步长 |
| orientation | BytedEffectConstants.Rotation | 输入图像旋转角 |
返回值
成功返回 类BefCarDetectInfo-车辆检测结果
public void release()
答:建议首先查看以下tag输出Error类型的日志:
bef_effect_ai 和SMASH_E_LOG 以及 EffectSDK
错误码请参考错误码表