Clusters pixel colors using stats::kmeans().
colorClustersKMeans(
pixel_matrix,
n = 10,
color_space = "Lab",
ref_white = "D65"
)A list with the following elements:
pixel_assignments: A vector of color center assignments for each pixel.
centers: A matrix of color centers.
sizes: The number of pixels assigned to each cluster.
2D matrix of pixels to classify (rows = pixels, columns = channels).
Number of clusters to fit.
Color space in which to cluster colors, passed to
[grDevices]{convertColor}. One of "sRGB", "Lab", "Luv", or
"XYZ". Default is "Lab", a perceptually uniform (for humans) color space.
Reference white for converting to different color spaces. D65 (the default) corresponds to standard daylight.
Called by colorClusters(). See that documentation for
examples.