拍照夜景增强采用多帧合成技术,本文以下的多帧夜景增强实际上就是功能中的拍照夜景增强。
多帧夜景提供多帧图片合成,进行夜景增强。
支持平台 | Android、iOS |
---|---|
支持输入格式 | nv21、nv12 |
要求 | 连续4张图或者连续6张图,除最后一帧ev为-2, 其余帧 ev为0,应用层,参考demo camera2 captureBurst方法 |
详细接口说明查看头文件:bef_ai_image_quality_enhancement_photo_night_scene.h
BEF_SDK_API bef_effect_result_t bef_ai_image_quality_enhancement_photo_night_scene_create(bef_image_quality_enhancement_handle* handle, const char* skin_seg_path, int width, int height, int image_number, bef_ai_lens_yuv_type type);
参数说明
参数名 | 参数类型 | 参数说明 |
---|---|---|
handle | bef_image_quality_enhancement_handle | 创建的多帧夜景算法句柄 |
skin_seg_path | const char* | 皮肤分割模型的路径 |
width | int | 输入帧的宽 |
height | int | 输入帧的高 |
image_number | int | 输入帧的数量 4 或者6 |
type | bef_ai_lens_yuv_type | 输入帧的类型,只能只nv21,或者 nv12 |
返回值
成功返回 BEF_RESULT_SUC, 失败返回相应错误码, 具体请参考 bef_effect_ai_public_define.h
// 当前版本暂不支持模型设置, model_path 设置成空字符串就好 bef_effect_result_t bef_ai_image_quality_enhancement_photo_night_scene_check_license(JNIEnv* env, jobject context, bef_image_quality_enhancement_handle handle, const char* license_path)
参数说明
参数名 | 参数类型 | 参数说明 |
---|---|---|
env | JNIEnv | java 环境 |
context | jobject | java context |
handle | bef_image_quality_enhancement_handle | 多帧夜景算法的句柄 |
license_path | const char* | 模型文件路径 |
// 当前版本暂不支持模型设置, model_path 设置成空字符串就好 bef_effect_result_t bef_ai_image_quality_enhancement_photo_night_scene_check_online_license(bef_image_quality_enhancement_handle handle, const char* license_path)
参数说明
参数名 | 参数类型 | 参数说明 |
---|---|---|
handle | bef_image_quality_enhancement_handle | 多帧夜景算法的句柄 |
license_path | const char* | 模型文件路径 |
返回值
成功返回 BEF_RESULT_SUC, 失败返回相应错误码, 具体请参考 bef_effect_ai_public_define.h
bef_effect_result_t bef_ai_image_quality_enhancement_photo_night_scene_process(bef_image_quality_enhancement_handle handle, void** input, int input_size, void **output)
参数说明
参数名 | 参数类型 | 参数说明 |
---|---|---|
handle | bef_image_quality_enhancement_handle | 多帧夜景算法的句柄 |
input | void** | 输入buffer数组 每一个void* 为每一帧图片的地址 |
input_size | int | 输入图像的帧数,必须为4 或者6 |
output | void ** | 输出图像的地址,explame void* ret_addr = nullptr; 传入 &ret_addr;ret_addr返回值为夜景增强帧的数据 |
返回值
成功返回 BEF_RESULT_SUC, 失败返回相应错误码, 具体请参考 bef_effect_ai_public_define.h
BEF_SDK_API void bef_ai_image_quality_enhancement_photo_night_scene_destroy(bef_image_quality_enhancement_handle handle);
参数说明
参数名 | 参数类型 | 参数说明 |
---|---|---|
handle | bef_image_quality_enhancement_handle | 多帧夜景算法的句柄 |
接口说明
详细接口说明查看文件:com.bytedance.labcv.effectsdk.PhotoNightScene.java
4.4.3版本后查看文件:com.effectsar.labcv.effectsdk.PhotoNightScene.java
public int init( Context context, String license, String skinSegPath, int width, int height, int imageNumber, int format, boolean onlineLicense)
参数说明
参数名 | 参数类型 | 参数说明 |
---|---|---|
context | Context | 应用上下文 |
skinSegPath | String | 皮肤分割模型路径 |
width | int | 输入的宽 |
height | int | 输入的高 |
imageNumber | int | 输入帧的数量 |
format | BytedEffectConstants.YUV420Type | nv12 或者 nv21 |
onlineLicense | boolean | 授权类型 |
返回值
成功返回BEF_RESULT_SUC,否则返回对应的错误码
public ByteBuffer process( ByteBuffer process(ByteBuffer[] input))
参数说明
参数名 | 参数类型 | 参数说明 |
---|---|---|
input | ByteBuffer[] | 多帧输入图像, 数组里面需要是direct_buffer |
返回值
ByteBuffer 返回和输入类型一致的buffer,必须和初始化类型一致
public void destroy()
答:建议首先查看以下tag输出Error类型的日志:
bef_effect_ai 和SMASH_E_LOG 以及 EffectSDK
错误码请参考错误码表