The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
The charisma package provides a standardized and
reproducible framework for characterizing and classifying discrete color
classes from digital images of biological organisms. This vignette walks
you through the basic workflow and demonstrates key features of the
package.
charisma automatically determines the presence or
absence of 10 human-visible color categories in images:
The package uses a biologically-inspired Color Look-Up Table (CLUT) that partitions HSV color space into non-overlapping regions, ensuring each color maps to exactly one category.
charisma depends on spatial R packages that require
system-level libraries. Install these first:
macOS (via Homebrew):
Ubuntu/Debian:
Fedora/RedHat:
The package includes an example image of a colorful bird (Tangara fastuosa):
The simplest analysis uses default parameters:
Key parameters:
threshold: Minimum proportion of pixels for a color to
be retained (0-1)interactive: Enable manual color
merging/replacementplot: Show diagnostic plots during processingpavo: Compute color pattern geometry statisticsThe charisma workflow consists of three main stages:
Images are pre-processed using the recolorize package
to:
Each color cluster is converted from RGB to HSV and matched against the CLUT:
In interactive mode, you can manually refine classifications:
Interactive operations:
c(2,3))Thresholds automatically remove colors with low pixel proportions:
# No threshold - keep all colors
result_0 <- charisma(img_path, threshold = 0.0)
# 5% threshold - remove colors < 5% of image
result_5 <- charisma(img_path, threshold = 0.05)
# 10% threshold - remove colors < 10% of image
result_10 <- charisma(img_path, threshold = 0.10)Higher thresholds are useful for:
Save results for reproducibility:
# Save with automatic timestamping
out_dir <- file.path("~", "Documents", "charisma_outputs")
result <- charisma(
img_path,
threshold = 0.05,
logdir = out_dir
)This creates:
charisma_objects/: Timestamped .RDS files (full
charisma object)diagnostic_plots/: Timestamped .PDF files
(visualization)Load and re-analyze saved objects:
The charisma object contains all classification data:
The default CLUT covers 10 human-visible colors, but you can create custom CLUTs:
# View default CLUT
View(charisma::clut)
# Use custom CLUT
my_clut <- charisma::clut # Start with default
# ... modify HSV ranges ...
result <- charisma(img_path, clut = my_clut)
# Validate custom CLUT (ensures complete HSV coverage)
validation <- validate(clut = my_clut)CLUT validation tests every HSV coordinate to ensure:
charisma output integrates seamlessly with phylogenetic
packages:
# Process multiple species
species_colors <- lapply(image_paths, function(img) {
result <- charisma(img, threshold = 0.05)
summarize(result)
})
# Combine into data frame
color_matrix <- do.call(rbind, species_colors)
# Use with geiger, phytools, pavo, etc.
library(geiger)
library(phytools)
# Fit evolutionary models
fit_er <- fitDiscrete(
phylogeny,
color_matrix[, "blue"],
model = "ER"
)
fit_ard <- fitDiscrete(
phylogeny,
color_matrix[, "blue"],
model = "ARD"
)
# Reconstruct ancestral states
ancestral <- ace(
color_matrix[, "blue"],
phylogeny,
type = "discrete"
)threshold = 0.0 and manually curatethreshold values on a subsetbins = 4 and cutoff = 20 as starting
pointslogdirvalidate()If you use charisma in your research, please cite:
Schwartz, S.T., Tsai, W.L.E., Karan, E.A., Juhn, M.S., Shultz, A.J., McCormack, J.E., Smith, T.B., and Alfaro, M.E. (2025). charisma: An R package to perform reproducible color characterization of digital images for biological studies. (In Review).
?charisma,
?charisma2, ?color2labelcharisma builds upon and integrates with:
recolorize
(Weller et al. 2024) for image preprocessingpavo
(Maia et al. 2019) for color pattern geometryimager
(Barthelme, 2025) for image processing operationsWe thank the developers of these excellent packages for making this work possible.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.