File: uvToxy.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 (32 lines) | stat: -rw-r--r-- 1,058 bytes parent folder | download | duplicates (7)
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
27
28
29
30
31
32
function xy = uvToxy(uv,compute1960)
% xy = uvToxy(uv,[compute1960])
%
% Convert CIE u'v' chromaticity to CIE xy chromaticity.
%
% These are u',v' chromaticity coordinates in notation
% used by CIE.  See CIE Colorimetry 2004 publication, or Wyszecki
% and Stiles, 2cd, page 165.
%
% Note that there is an obsolete u,v chromaticity diagram that is similar
% but uses 6 in the numerator for u rather than the 9 that is used for u'.
% See CIE Coloimetry 2004, Appendix A, or Judd and Wyszecki, p. 296. If
% you want this (maybe to compute correlated color temperatures), you can
% pass this as 1.  It is 0 by default.
%
% See also uvYToXYZ, XYZTouvY, xyTouv
%
% 7/15/03  dhb, bx  Wrote it.
% 3/17/04  dhb      Fixed typos.  This must not have been tested previously.
% 5/06/11  dhb      Improve comment, optional 1960 computations

%% Handle optional arg
if (nargin < 2 || isempty(compute1960))
    compute1960 = 0;
end

%% Do it, using uvYToXYZ as engine
uvY = [uv ; ones(1,size(uv,2))];
XYZ = uvYToXYZ(uvY,compute1960);
xyY = XYZToxyY(XYZ);
xy = xyY(1:2,:);