Interface DominantColorOpts

Options for dominantColors, an extension of KMeansOpts.

interface DominantColorOpts {
    dist: IDistance<ReadonlyVec>;
    filter: Fn2<Float32Array, number, boolean>;
    initial: number[];
    maxIter: number;
    rnd: IRandom;
    strategy: CentroidStrategy;
}

Hierarchy

  • KMeansOpts
    • DominantColorOpts

Properties

dist: IDistance<ReadonlyVec>

Distance function/metric to use for finding nearest centroid.

filter: Fn2<Float32Array, number, boolean>

Predicate used to only include pixels in the analysis for which the filter returns truthy result. E.g. to pre-exclude weakly saturated or dark colors etc. The second arg is the index of the pixel in the image's pixel buffer.

If omitted, all pixels will be included (default).

initial: number[]

Array of initial centroids (i.e. indices of selected points in samples array given to kmeans).

maxIter: number

Max. iteration count

rnd: IRandom

PRNG instance to use for random centroid selection

strategy: CentroidStrategy

Centroid refinement strategy (default: means).

Generated using TypeDoc