Food Color Comparisons
Requires a Wolfram Notebook System
Interact on desktop, mobile and cloud with the free Wolfram CDF Player or other Wolfram Language products.
Requires a Wolfram Notebook System
Edit on desktop, mobile and cloud with any Wolfram Language product.
Colors are commonly represented in terms of the absolute magnitude of their coordinates in a specified color space, and differences between them in terms of the distance between their locations in that space. This Demonstration creates images for convenient visual comparison of two colors based on the numerical values of their CIE Lab or RGB coordinates. It can also translate continuous changes in any coordinate into an image that reveals visually how the perceived difference grows or diminishes.
Snapshot 1: beet in CIE Lab color space
Snapshot 2: tomato in CIE Lab color space with the rectangles touching
Snapshot 3: mustard in CIE Lab color space using antialiasing to blur the rectangles' edges
Snapshot 4: peanut butter in CIE Lab color space with the rectangles touching and using antialiasing
Snapshot 5: chocolate in RGB color space
Snapshot 6: condensed milk in RGB color space with the rectangles touching
Snapshot 7: spinach in RGB color space using antialiasing to blur the rectangles' edges
Snapshot 8: blueberry in RGB color space with the rectangles touching and using antialiasing
In many publications and technical documents, changes in color are reported in terms of changes in the magnitude of one or all of their coordinates in the color space being used. The difference between any two colors is frequently expressed in terms of , the Euclidean distance between them in that space, or any of its more elaborate modifications [1, 2, 3]. Although such numerical values can be easily subjected to statistical analysis, they cannot be intuitively translated into the visual changes or differences. At least in principle, this can be overcome by generating colors using their reported coordinates and comparing them visually. This Demonstration generates two images for comparison from entered CIE Lab or RGB coordinates. The first generated color can be a standard or reference, for example, and the second the sample whose visual appearance is to be assessed against it.
Given coordinates in CIE Lab color space can be converted into RGB space coordinates using Mathematica's ColorConvert function, which can then be used to generate an image of the same color.
In this Demonstration, the CIE Lab or RGB color space is chosen with a setter and the corresponding coordinates—, , and or , , and —with sliders. There are two rectangular images 1 (left) and 2 (right), whose colors are specified with three sliders for each. By using the "rectangles touch" box, they can be compared while visually touching each other or slightly separated. Checking the "use antialiasing" box blurs the edge pixels of the colored rectangles.
In the CIE Lab color space, the slider for the (lightness) coordinate can vary between 0 (black) and 100 (white). The coordinate sets the location on the green () to red () axis, while sets the location on the perpendicular blue () to yellow () axis. In the RGB color space, which is the default for Mathematica, the , , and sliders vary from 0. to 1.
The default food color setting is for an orange-colored food. To facilitate finding the six sliders' settings for the color of a food that is not listed, click the setter having the same or a similar color to the food of interest. For example, for apricot, select "orange," for green lettuce, select "spinach," and for raspberry, select "beet." This will display the chosen food's approximate coordinates in CIE Lab or RGB space. Having done that, you can use the coordinate sliders to exactly match the color of the food of interest.
Since perceived color depends on the illumination intensity and direction and is affected by other factors, the compared images in this Demonstration might not be exact replicas of the colored foods whose coordinates have been used to generate them. Yet, they still enable one to conveniently assess color differences that cannot be intuitively revealed from numerical data alone.
 Wikipedia. "Color." (Jul 16, 2015) en.wikipedia.org/wiki/Color.
 Wikipedia. "Color Space." (Jul 16, 2015) en.wikipedia.org/wiki/Color_space.
 Wikipedia. "Color Difference." (Jul 16, 2015) en.wikipedia.org/wiki/Color_difference.