Interface FilterConfig

Run input through image filters before inference

  • available only in Browser environments
  • image filters run with near-zero latency as they are executed on the GPU using WebGL
interface FilterConfig {
    autoBrightness: boolean;
    blur: number;
    brightness: number;
    contrast: number;
    enabled: boolean;
    equalization: boolean;
    flip: boolean;
    height: number;
    hue: number;
    kodachrome: boolean;
    negative: boolean;
    pixelate: number;
    polaroid: boolean;
    return: boolean;
    saturation: number;
    sepia: boolean;
    sharpness: number;
    technicolor: boolean;
    vintage: boolean;
    width: number;
}

Properties

autoBrightness: boolean

apply auto-brighness

blur: number

range: 0 (no blur) to N (blur radius in pixels)

brightness: number

range: -1 (darken) to 1 (lighten)

contrast: number

range: -1 (reduce contrast) to 1 (increase contrast)

enabled: boolean

are image filters enabled?

equalization: boolean

perform image histogram equalization

  • equalization is performed on input as a whole and detected face before its passed for further analysis
flip: boolean

flip input as mirror image

height: number

resize input height

  • if both width and height are set to 0, there is no resizing
  • if just one is set, second one is scaled automatically
  • if both are set, values are used as-is
hue: number

range: 0 (no change) to 360 (hue rotation in degrees)

kodachrome: boolean

image kodachrome colors

negative: boolean

image negative

pixelate: number

range: 0 (no pixelate) to N (number of pixels to pixelate)

polaroid: boolean

image polaroid camera effect

return: boolean

return processed canvas imagedata in result

saturation: number

range: -1 (reduce saturation) to 1 (increase saturation)

sepia: boolean

image sepia colors

sharpness: number

range: 0 (no sharpening) to 1 (maximum sharpening)

technicolor: boolean

image technicolor colors

vintage: boolean

image vintage colors

width: number

resize input width

  • if both width and height are set to 0, there is no resizing
  • if just one is set, second one is scaled automatically
  • if both are set, values are used as-is