labCentroids
labCentroids<
S>(pixels,k,options?):LabCentroid<S>[]
Defined in: packages/math-color/src/models/lab-centroids.ts:29
Performs K-means clustering on the OKLab values of an image’s pixels to identify dominant colors.
Type Parameters
Section titled “Type Parameters”S extends string
Parameters
Section titled “Parameters”pixels
Section titled “pixels”An array of OKLab pixel values to cluster.
number
The number of clusters (dominant colors) to identify.
options?
Section titled “options?”KmeansOptions
Optional parameters for K-means clustering.
Returns
Section titled “Returns”LabCentroid<S>[]
An array of WeightedCentroid objects representing the dominant colors and their weights.