extractClusters {colordistance} | R Documentation |
Extract cluster values and sizes from kmeans fit objects
Description
Extract a list of dataframes with the same format as those returned by
getHistList
, where each dataframe has 3 color attributes (R, G,
B or H, S, V) and a size attribute (Pct) for every cluster.
Usage
extractClusters(getKMeansListObject, ordering = TRUE, normalize = FALSE)
Arguments
getKMeansListObject |
A list of |
ordering |
Logical. Should clusters by reordered by color similarity? If
|
normalize |
Logical. Should each cluster be normalized to show R:G:B or
H:S:V ratios rather than absolute values? Can be helpful for inconsistent
lighting, but reduces variation. See |
Value
A list of dataframes (same length as input list), each with 4 columns: R, G, B (or H, S, V) and Pct (cluster size), with one row per cluster.
Note
Names are inherited from the list passed to the function.
Examples
clusterList <- colordistance::getKMeansList(system.file("extdata",
"Heliconius/Heliconius_A", package="colordistance"), bins=3)
colordistance::extractClusters(clusterList)