Virtual Background
Accurately removes the background in real time and applies a virtual background (customizable):


Android Integration Guide
Methodology
setEffect(String effectName, int effectValue, String resourcePath, Map<String, String> extraInfo)
Virtual Background Settings
mXmagicApi.setEffect(EffectName.EFFECT_SEGMENTATION, 45, AppConfig.motionResPath + "/segmentMotionRes/video_segmentation_blur_45", null);
Custom Background Settings
Map<String, String> extraInfo = new HashMap<>();extraInfo.put("segType", "custom_background");extraInfo.put("bgType", "0");extraInfo.put("bgPath", imgPath);mXmagicApi.setEffect(EffectName.EFFECT_SEGMENTATION, 0, AppConfig.motionResPath + "/segmentMotionRes/video_empty_segmentation", extraInfo);
iOS Integration Guide
Methodology
- (void)setEffect:(NSString * _Nullable)effectName effectValue:(int)effectValue resourcePath:(NSString * _Nullable)resourcePath extraInfo:(NSDictionary * _Nullable)extraInfo;
Virtual Background Settings
NSString *path = [[[NSBundle mainBundle] pathForResource:@"segmentMotionRes" ofType:@"bundle"] stringByAppendingPathComponent:@"video_segmentation_blur_75"];[_xMagicKit setEffect:EFFECT_MOTION effectValue:0 resourcePath:path extraInfo:nil];
Custom Background Settings
NSString *resourcePath = [[[NSBundle mainBundle] pathForResource:@"segmentMotionRes" ofType:@"bundle"] stringByAppendingPathComponent:@"video_empty_segmentation"];NSMutableDictionary *dic = [NSMutableDictionary dictionary];dic[@"segType"] = @"custom_background";dic[@"bgType"] = 0;//Background type. 0 means image, 1 means video.dic[@"bgPath"] = @"/var/mobile/Containers/Data/Application/06B00BBC-9060-450F-8D3A-F6028D185682/Documents/MediaFile/image.png"; //Absolute path of custom background image. If video is selected as custom background, perform compression transcoding process and use the absolute path after processing.[_xMagicKit setEffect:EFFECT_SEGMENTATION effectValue:0 resourcePath:resourcePath extraInfo:dic];