# displayColorPatch

Display measured and reference color as color patches

## Syntax

``displayColorPatch(colorTable)``
``displayColorPatch(colorTable,Name,Value)``

## Description

example

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

example

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

## Examples

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); displayChart(chart,"displayRegistrationPoints",false)```

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 ($\Delta \mathrm{E}$).

`displayColorPatch(colorTable)`

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, ... displayGrayROIs=false,displayRegistrationPoints=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`.

`displayColorPatch(colorTable,displayROIIndex=false)`

## Input Arguments

collapse all

Color values in each color patch, specified as an m-by-8 color table, where m is the number of patches. The eight columns represent these variables:

VariableDescription
`ROI`Index of the sampled ROI. The value of `ROI` is an integer in the range [1, 16]. The indices match the ROI numbers displayed by `displayChart`.
`Measured_R`

Mean value of red channel pixels in the ROI. `Measured_R` is a scalar of the same data type as `chart.Image`, which can be of type `single`, `double`, `uint8`, or `uint16`.

`Measured_G`

Mean value of green channel pixels in the ROI. `Measured_G` is a scalar of the same data type as `chart.Image`.

`Measured_B`

Mean value of blue channel pixels in the ROI. `Measured_B` is a scalar of the same data type as `chart.Image`.

`Reference_L`

Reference L* value of the ROI. `Reference_L` is a scalar of type `double`.

`Reference_a`

Reference a* value of the ROI. `Reference_a` is a scalar of type `double`.

`Reference_b`

Reference b* value of the ROI. `Reference_b` is a scalar of type `double`.

`Delta_E`

Euclidean color distance between the measured and reference color values in the L*a*b* color space, as outlined in CIE 1976. `Delta_E` is a scalar of type `double`.

### 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(colorTable,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(colorTable,"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 patch ROI index labels on the displayed color patches. The indices match the ROI numbers displayed by `displayChart`.

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.

Axes handle of the displayed image object, specified as an axes handle. `Parent` specifies the parent of the image object created by `displayColorPatch`.

## Version History

Introduced in R2017b