BackgroundFilterProcessor
public class BackgroundFilterProcessor
BackgroundFilterProcessor is a processor that uses SegmentationProcessor to process a frame by
creating the alpha mask of the foreground image and blending the mask with the input image which is then rendered on
top of a background image.
-
Static method to check whether BackgroundFilterProcessor can be used. This verifies that the builder has linked the necessary runtime framework (i.e.
AmazonChimeSDKMachineLearning) to use this class.Declaration
Swift
public static func isAvailable() -> BoolReturn Value
true if the class can be used, otherwise false.
-
Public constructor to initialize the processor.
Declaration
Swift
public init(logger: Logger)Parameters
loggerCustom logger to log events.
-
Creates the alpha mask [0-255] of the foreground image using
SegmentationProcessor.Declaration
Swift
public func createForegroundAlphaMask(inputFrameCG: CGImage, inputFrameCI: CIImage) -> CIImage?Parameters
inputFrameCGInput CGImage frame to produce the foreground image.
inputFrameCIInput CIImage frame to produce the foreground image.
Return Value
Alpha mask CGImage of the foreground.
-
Blends foreground alpha mask with input image to produce a foreground image which is rendered on top of a background image using
CIBlendWithAlphaMaskCIFilter.Declaration
Swift
public func blendWithWithAlphaMask(inputFrameCI: CIImage, maskImage: CIImage, backgroundImage: CIImage) -> CIImage?Parameters
inputFrameCIInput image which is used to blend the foreground alpha mask to produce the foreground image.
maskImageForeground alpha mask.
backgroundImageBackground image which can be a blurred or a custom background image.
-
Declaration
Swift
public func getBufferPool() -> CVPixelBufferPool?Return Value
Buffer pool used to store the final image data.