腾讯特效SDK人像分割_音视频解决方案_同尘科技

腾讯特效SDK 1年前 (2023-10-31) 浏览 56

在直播、会议等场景实现虚拟背景,实时精准分割,支持自定义背景:


iOS 接口使用

iOS 集成指引

iOS 集成 SDK 指引,请参见 独立集成腾讯特效。

虚拟背景设置

NSString *motionSegResPath = [[NSBundle mainBundle] pathForResource:@"segmentMotionRes" ofType:@"bundle"];//这里是segmentMotionRes文件夹的绝对路径NSString *propertyType = @"motion";         //配置美颜的效果类型,这里以分割为例NSString *propertyName = @"video_segmentation_blur_75"; //配置美颜的名称,这里以背景模糊-强为例NSString *propertyValue = motionSegResPath;  //配置动效的路径NSDictionary *dic = @{@"bgName":@"BgSegmentation.bg.png", @"bgType":@0, @"timeOffset": @0},@"icon":@"segmentation.linjian.png"};//配置预留字段[self.beautyKit configPropertyWithType:propertyType withName:propertyName withData:propertyValue withExtraInfo:dic];

自定义背景设置

NSString *motionSegResPath = [[NSBundle mainBundle] pathForResource:@"segmentMotionRes" ofType:@"bundle"];//这里是segmentMotionRes文件夹的绝对路径NSString *propertyType = @"motion";         //配置美颜的效果类型,这里以分割为例NSString *propertyName = @"video_empty_segmentation"; //配置美颜的名称,这里以自定义背景为例NSString *propertyValue = motionSegResPath;  //配置动效的路径NSString *imagePath = @"/var/mobile/Containers/Data/Application/06B00BBC-9060-450F-8D3A-F6028D185682/Documents/MediaFile/image.png"; //自定义背景图片的绝对路径。如果自定义背景选择的是视频,需要对视频进行压缩转码处理,使用压缩转码处理后的绝对路径int bgType = 0;//自定义背景的类型。 0表示图片,1表示视频int timeOffset = 0;//时长。图片背景时,为0;视频背景时为视频的时长NSDictionary *dic = @{@"bgName":imagePath, @"bgType":@(bgType), @"timeOffset": @(timeOffset)},@"icon":@"segmentation.linjian.png"};//配置预留字段[self.beautyKit configPropertyWithType:propertyType withName:propertyName withData:propertyValue withExtraInfo:dic];

Android 接口使用

Android 集成指引

Android 集成 SDK 指引,请参见 独立集成腾讯特效。

设置属性接口

void updateProperty(XmagicProperty p) 

分割参数:

属性字段 说明
category Category.SEGMENTATION
ID 源文件夹名称,必填示例:video_segmentation_blur_45“无” ID 为 XmagicProperty.ID_NONE自定义分割 ID 值必须使用:XmagicConstant.SegmentationId.CUSTOM_SEG_ID
resPath 必填,自定义分割素材的全路径
effkey null(自定义背景除外),自定义背景的值为选择的资源路径
effValue null

虚拟背景设置

//初始化XmagicPropertyXmagicProperty xmagicProperty = new XmagicProperty(Category.SEGMENTATION,"video_segmentation_blur_45",resPath,null,null);//设置属性xmagicApi.updateProperty(xmagicProperty) 

自定义背景设置

XmagicProperty xmagicProperty = new XmagicProperty(Category.SEGMENTATION,XmagicConstant.SegmentationId.CUSTOM_SEG_ID,resPath,null,null);
xmagicApi.updateProperty(xmagicProperty)



对音视频的解决方案有疑惑?想了解解决方案收费? 联系解决方案专家

腾讯云限时活动1折起,即将结束: 马上收藏

同尘科技为腾讯云授权服务中心,购买腾讯云享受折上折,更有现金返利:同意关联,立享优惠

阿里云解决方案也看看?: 点击对比阿里云的解决方案

- 0人点赞 -

发表点评 (0条)

not found

暂无评论,你要说点什么吗?