View source: R/colorClusters.R
colorClustersHist | R Documentation |
Clusters pixel colors by dividing color space up into specified bins, then taking the average color of all the pixels within that bin.
colorClustersHist(
pixel_matrix,
bins = 3,
color_space = c("Lab", "sRGB", "Luv", "HSV"),
ref_white = "D65",
bin_avg = TRUE
)
pixel_matrix |
2D matrix of pixels to classify (rows = pixels, columns = channels). |
bins |
Number of bins for each channel OR a vector of length 3 with bins
for each channel. |
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. |
bin_avg |
Logical. Return the color centers as the average of the pixels assigned to the bin (the default), or the geometric center of the bin? |
Called by colorClusters()
. See that documentation for
examples.
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.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.