File: XYZToRGBMatrix.m

package info (click to toggle)
psychtoolbox-3 3.0.19.14.dfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 86,796 kB
  • sloc: ansic: 176,245; cpp: 20,103; objc: 5,393; sh: 2,753; python: 1,397; php: 384; makefile: 193; java: 113
file content (26 lines) | stat: -rw-r--r-- 1,006 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function M = XYZToRGBMatrix(xr, yr, xg, yg, xb, yb, xw, yw)
% M = XYZToRGBMatrix(xr, yr, xg, yg, xb, yb, xw, yw)
%
% Build a 3x3 color space conversion (CSC) matrix for converting X,Y,Z
% linear color value vectors into a RGB color space, by a matrix-vector
% multiplication, ie. rgb = M * xyz;
%
% The destination color space for the rgb (R,G,B) vector is defined by its
% color gamut, which in turn is specified by the 2D CIE-1931 chromaticity
% coordinates of the white-point (xw, yw) and the color primaries red,
% green and blue (xr, yr), (xg, yg) and (xb, yb).
%
% See also the function RGBToXYZMatrix() for building the inverse matrix
% for mapping from a RGB space to the XYZ color space.
%
% This code just calls RGBToXYZMatrix(xr, yr, xg, yg, xb, yb, xw, yw) and
% then computes the inverse matrix. See the more detailed help text for
% RGBToXYZMatrix() for more infos and background.
%

% History:
%
% 30-Sep-2020   mk  Written.

    M = inv(RGBToXYZMatrix(xr, yr, xg, yg, xb, yb, xw, yw));
end