Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Back to top
Toggle table of contents sidebar

# PortraitProcessor.removeBackground Method

Module: PortraitProcessor

## Definition

Removes the background on the specified portrait image.

Important

This method requires the `FaceBackgroundSegmenter1A` model to be loaded.

Python

    remove_background(self, image: Image, red: int, green: int, blue: int) -> None

Parameters

> `image` Image
> in The portrait image.
> `red` int
> in Green channel of the background color. Must be a value from 0 to 255.
> `green` int
> in Red channel of the background color. Must be a value from 0 to 255.
> `blue` int
> in Blue channel of the background color. Must be a value from 0 to 255.

Exceptions

> FaceException
> An error has occurred during Face Library execution.

Dart

    void removeBackground(Image image, int red, int green, int blue)

Parameters

> `image` Image
> in The portrait image.
> `red` int
> in Green channel of the background color. Must be a value from 0 to 255.
> `green` int
> in Red channel of the background color. Must be a value from 0 to 255.
> `blue` int
> in Blue channel of the background color. Must be a value from 0 to 255.

Exceptions

> FaceException
> An error has occurred during Face Library execution.

C#

    public void RemoveBackground(Image image, int red, int green, int blue)

Parameters

> `image` Image
> in The portrait image.
> `red` int
> in Green channel of the background color. Must be a value from 0 to 255.
> `green` int
> in Red channel of the background color. Must be a value from 0 to 255.
> `blue` int
> in Blue channel of the background color. Must be a value from 0 to 255.

Exceptions

> FaceException
> An error has occurred during Face Library execution.

Java

    public void removeBackground(Image image, int red, int green, int blue) throws FaceException

Parameters

> `image` Image
> in The portrait image.
> `red` int
> in Green channel of the background color. Must be a value from 0 to 255.
> `green` int
> in Red channel of the background color. Must be a value from 0 to 255.
> `blue` int
> in Blue channel of the background color. Must be a value from 0 to 255.

Exceptions

> FaceException
> An error has occurred during Face Library execution.

Swift

    public func removeBackground(image: Image, red: Int32, green: Int32, blue: Int32) throws

Parameters

> `image` Image
> in The portrait image.
> `red` Int32
> in Green channel of the background color. Must be a value from 0 to 255.
> `green` Int32
> in Red channel of the background color. Must be a value from 0 to 255.
> `blue` Int32
> in Blue channel of the background color. Must be a value from 0 to 255.

Exceptions

> FaceException
> An error has occurred during Face Library execution.

C

    int id3FacePortraitProcessor_RemoveBackground (
        ID3_FACE_PORTRAIT_PROCESSOR hPortraitProcessor,
        ID3_FACE_IMAGE hImage,
        int red,
        int green,
        int blue)

Parameters

> `hPortraitProcessor` ID3_FACE_PORTRAIT_PROCESSOR
> in Handle to the PortraitProcessor object.
> `hImage` ID3_FACE_IMAGE
> in The portrait image.
> `red` int
> in Green channel of the background color. Must be a value from 0 to 255.
> `green` int
> in Red channel of the background color. Must be a value from 0 to 255.
> `blue` int
> in Blue channel of the background color. Must be a value from 0 to 255.

Returns

> `int`
> An error code.
> See id3FaceError file for the list of possible error codes.