Background Removal for Video Conferences

API Interface of the iOS Framework

Define selfie segmentation model variable

private var selfieSegmentationModel: SelfieSegmentationModel?

Configure and Instantiate the model with SelfieSegmentationModelBuilder

@interface SelfieSegmentationModelBuilder : NSObject

- (instancetype _Nonnull)init;

/**
 * \brief Creates a new instance of \a SelfieSegmentationModel.
 *
 * \param error Object containing error information if model instantiation fails.
 *
 * \returns Pointer to the new instance of \a SelfieSegmentationModel if instantiation
 * is successful, \a nil otherwise.
 *
 * \note Model instantiation is a blocking call which can take some time, therefore
 * this should be done on a separate serial dispatch queue.
 * That won't block the main queue which keeps the UI responsive.
 */
- (SelfieSegmentationModel* _Nullable)build:(NSError* _Nullable* _Nonnull)error;

@end

Example:

Model instantiation is a blocking call that can take some time, therefore this should be done on a separate serial dispatch queue. That won't block the main queue which keeps the UI responsive.

Schedule the task with SelfieSegmentationModel.segment method when the model is instantiated

SelfieSegmentationModel returns its results through the SelfieSegmentationDelegate

Example:

Each MaskData instance is represented with the following class

Last updated