@thi.ng/pixel-dominant-colors
Version:
k-means based dominant color extraction from images/pixel buffers
20 lines • 924 B
TypeScript
import type { NumericArray } from "@thi.ng/api";
import type { KMeansOpts } from "@thi.ng/k-means";
import type { FloatBuffer } from "@thi.ng/pixel/float";
import type { DominantColor, DominantColorOpts } from "./api.js";
/**
* Takes a {@link FloatBuffer} and applies k-means clustering to extract the
* `num` dominant colors from the given image. The clustering can be configured
* via optionally provided `opts`. Returns array of `{ color, area }` objects
* (sorted by descending area), where `color` is a cluster's dominant color and
* `area` the normalized cluster size.
*
* @remarks
* See thi.ng/k-means for details about clustering implementation & options.
*
* @param img -
* @param num -
* @param opts -
*/
export declare const dominantColorsKmeans: (img: FloatBuffer | NumericArray[], num: number, opts?: Partial<DominantColorOpts & KMeansOpts>) => DominantColor[];
//# sourceMappingURL=kmeans.d.ts.map