Quantitative color profiling of images in a comparative framework using the R package colordistance
Color is a central aspect of biology, with important impacts on ecology and evolution. Organismal color may be adaptive or incidental, seasonal or permanent, species- or population-specific, or modified for breeding, defense or camouflage. Thus, measuring and comparing color among organisms provides important biological insights. However, color comparison is limited by color categorization methods, with few universal tools available for quantitative color profiling and comparison. We present a package of R tools for processing images of organisms (or other objects) in order to quantify color profiles, gather color trait data, and compare color palettes in a reproducible way. The package treats image pixels as 3D coordinates in “color space", producing a multidimensional color histogram for each image. Pairwise distances between histograms are computed using earth mover's distance or a combination of more conventional distance metrics. The user sets parameters for generating color histograms, and comparative color profile analysis is performed through pairwise comparisons to produce a color distance matrix for a set of images. The toolkit provided in the colordistance R package can be used for analyses involving quantitative color variation in organisms with statistical testing. We illustrate the use of colordistance with three biological examples: hybrid coloration in butterflyfishes; mimicry in wing coloration in Heliconius butterflies; and analysis of background matching in camouflaging flounder fish. The tools presented for quantitative color analysis may be applied to a broad range of questions in biology and other disciplines.