colorClustersKMeans {recolorize} | R Documentation |
Cluster pixel colors using K-means clustering
Description
Clusters pixel colors using kmeans
.
Usage
colorClustersKMeans(
pixel_matrix,
n = 10,
color_space = "Lab",
ref_white = "D65"
)
Arguments
pixel_matrix |
2D matrix of pixels to classify (rows = pixels, columns = channels). |
n |
Number of clusters to fit. |
color_space |
Color space in which to cluster colors, passed to
|
ref_white |
Reference white for converting to different color spaces. D65 (the default) corresponds to standard daylight. |
Details
Called by colorClusters
. See that documentation for
examples.
Value
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.
[Package recolorize version 0.1.0 Index]