Skip to main content

Function: estimateBackgroundColor()

estimateBackgroundColor(image): [number, number, number]

Defined in: src/generative/BackgroundKeyer.ts:27

Estimates the background color of an image by averaging its four corner pixels. Generated images that place the subject on a plain, uniform background (the generative_object demo instructs the model to do so) have corners that are a reliable sample.

Parameters​

image​

RgbaImage

The source RGBA image.

Returns​

[number, number, number]

The estimated [r, g, b] background color (0-255).