Quantitative color profiling of digital images with earth mover's distance using the R package colordistance

PeerJ. 2019 Feb 6:7:e6398. doi: 10.7717/peerj.6398. eCollection 2019.

Abstract

Biological color may be adaptive or incidental, seasonal or permanent, species- or population-specific, or modified for breeding, defense or camouflage. Although color is a hugely informative aspect of biology, quantitative color comparisons are notoriously difficult. Color comparison is limited by categorization methods, with available tools requiring either subjective classifications, or expensive equipment, software, and expertise. We present an R package for processing images of organisms (or other objects) in order to quantify color profiles, gather color trait data, and compare color palettes on the basis of color similarity and amount. The package treats image pixels as 3D coordinates in a "color space," producing a multidimensional color histogram for each image. Pairwise distances between histograms are computed using earth mover's distance, a technique borrowed from computer vision, that compares histograms using transportation costs. Users choose a color space, parameters for generating color histograms, and a pairwise comparison method to produce a color distance matrix for a set of images. The package is intended as a more rigorous alternative to subjective, manual digital image analyses, not as a replacement for more advanced techniques that rely on detailed spectrophotometry methods unavailable to many users. Here, we outline the basic functions of colordistance, provide guidelines for the available color spaces and quantification methods, and compare this toolkit with other available methods. The tools presented for quantitative color analysis may be applied to a broad range of questions in biology and other disciplines.

Keywords: Camouflage; Color; Earth mover’s distance; Image processing; Phylogenetics; R packages; Statistics.

Grants and funding

This research was supported by NSF grants IOS 1425049 and DEB 1541547 to Mark Westneat. The funders had no role in study design, data collection and analysis, decision to publish, or preparation of the manuscript.