Main Content


Display measured and reference color as color patches



displayColorPatch(colorValues) displays measured and reference colors, colorValues, for color patch regions of interest (ROIs) in a test chart. The function displays measured color values as squares surrounded by a thick boundary of the corresponding reference color.


displayColorPatch(colorValues,Name,Value) displays measured color values with additional name-value arguments to control aspects of the display.


collapse all

Read an image of a ColorChecker® chart into the workspace.

I = imread("colorCheckerTestImage.jpg");

Create a colorChecker object, then display the chart with ROI annotations.

chart = colorChecker(I);

Measure the color in each color patch ROI.

colorTable = measureColor(chart);

On a color patch diagram, display the measured and reference colors and the color error (ΔE).


This example shows how to display the color patch diagram from measurements of color accuracy on an Imatest® eSFR chart.

Read an image of an eSFR chart into the workspace.

I = imread("eSFRTestImage.jpg");

Create an esfrChart object. Display the chart, highlighting the 16 color patches.

chart = esfrChart(I);
displayChart(chart,displayEdgeROIs=false, ...

Measure the color in all color patch ROIs.

colorTable = measureColor(chart);

Display the color accuracy measurements without the ROI index overlay. Each square color patch is the measured color, and the thick surrounding border is the reference color for that ROI. The color accuracy measurement is displayed as Delta_E, the Euclidean distance between measured and reference colors in CIE 1976 L*a*b* color space. More accurate colors have a smaller Delta_E.


Input Arguments

collapse all

Color values in each color patch, specified as a table with n rows, where n is the number of color ROIs. To obtain a table of color values, use the measureColor function.

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: displayColorPatch(colorValues,displayROIIndex=false) turns off the display of the ROI indices

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: displayColorPatch(colorValues,"displayROIIndex",false) turns off the display of the ROI indices

Display ROI index labels, specified as a numeric or logical 1 (true) or 0 (false). When displayROIIndex is true, then displayColorPatch overlays color ROI index labels on the displayed color patches.

Display color error ("delta E") values, specified as a numeric or logical 1 (true) or 0 (false). When displayDeltaE is true, displayColorPatch overlays the color error values on the displayed color patches.

Parent of the displayed image object, specified as an Axes object.


  • The reference L*a*b* values of the colors measured from a colorChecker object are for the "After November 2014" version of the ColorChecker® chart. The white point of the reference values is the CIE standard illuminant D50.

Version History

Introduced in R2017b