plotChromaticity
Plot color reproduction on chromaticity diagram
Description
plotChromaticity(
plots on a
chromaticity diagram the measured and reference colors,
colorValues
)colorValues
, for color patch regions of interest (ROIs) in
a test chart.
plotChromaticity
plots an empty chromaticity diagram.
plotChromaticity(___,
adjusts aspects of the display using name-value arguments.Name=Value
)
Examples
Display Chromaticity Diagram from Color Accuracy Measurements
This example shows how to display the chromaticity 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);
Plot the measured and reference colors in the CIE 1976 L*a*b* color space on a chromaticity diagram. Red circles indicate the reference color and green circles indicate the measured color of each color patch. The chromaticity diagram does not portray the brightness of color.
figure plotChromaticity(colorTable)
Display Chromaticity Diagram from ColorChecker Chart
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)
Measure the color in each color patch ROI.
colorTable = measureColor(chart);
Plot the measured and reference colors on a chromaticity diagram.
figure plotChromaticity(colorTable)
Plot sRGB Primaries and White Point on Chromaticity Diagram
Convert sRGB primary colors to the XYZ color space.
xyz_primaries = rgb2xyz([1 0 0; 0 1 0; 0 0 1]);
Normalize the x and y values of the primary colors.
xyzMag = sum(xyz_primaries,2); x_primary = xyz_primaries(:,1)./xyzMag; y_primary = xyz_primaries(:,2)./xyzMag;
Calculate and normalize the D65 white point.
wp = whitepoint('D65');
Normalize the x and y values of the white point.
wpMag = sum(wp,2); x_whitepoint = wp(:,1)./wpMag; y_whitepoint = wp(:,2)./wpMag;
Create an empty 2-D chromaticity diagram.
plotChromaticity
Add the (x,y) coordinates of the primaries and white point to the chromaticity diagram.
hold on scatter(x_whitepoint,y_whitepoint,36,'black') scatter(x_primary,y_primary,36,'black') plot([x_primary; x_primary],[y_primary; y_primary],'k') hold off
Display 3-D Color Solid in u'v'L Color Space
Display a 3-D color solid of the u'v'L color space on an empty chromaticity diagram. Include all u'v'L colors by specifying the brightness threshold as 0
.
plotChromaticity("ColorSpace","uv","View",3,"BrightnessThreshold",0)
Input Arguments
colorValues
— Color values
table
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: plotChromaticity(colorValues,displayROIIndex=false)
turns off the display of the ROI indices on the chromaticity diagram.
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
Example: plotChromaticity(colorValues,"displayROIIndex",false)
turns off the display of the ROI indices on the chromaticity diagram.
BrightnessThreshold
— Brightness threshold
0.15
(default) | number in the range [0, 1]
Brightness threshold, specified as a number in the range [0, 1]. The
plotChromaticity
function does not display
color values with a Y or L
value (depending on the color space) less than the brightness
threshold.
ColorSpace
— Color space
"xy"
(default) | "uv"
Color space, specified as "xy"
to plot in the xyY
color space or "uv"
to plot in the u'v'L color
space.
Data Types: char
| string
displayROIIndex
— Display ROI index labels
true
or
1
(default) | false
or 0
Display ROI index labels, specified as a numeric or
logical 1
(true
) or 0
(false
). When displayROIIndex
is
true
, then the
plotChromaticity
function overlays color patch
ROI index labels on the chromaticity diagram.
Parent
— Parent axes
Axes
object
Parent axes of the chromaticity diagram, specified as an
Axes
object.
View
— Dimensionality of chromaticity diagram
2
(default) | 3
Dimensionality of chromaticity diagram, specified as
2
for a 2-D projection or 3
for a 3-D color solid.
Tips
The reference L*a*b* values of the
colorValues
measured from acolorChecker
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
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)