Page 208 - Computational Colour Science Using MATLAB
P. 208

COMPIGOG (BOX 22)                         195

             11.19   compgog.m (Box 19)



                  % function [rgb] = compgog(gogs,dacs)
                  % computes the linearized RGB values
                  % from the normalized RGB values
                  % for a given set of gog values
                  % gog is a 2 by 1 matrix that contains the gamma and gain
                  % dacs is an n by 1 matrix that contains the RGB values
                  % rgb is an n by 1 matrix of linearized RGB values



             11.20   rgb2xyz.m (Box 20)



                  % function [XYZ] = rgb2xyz(dacs, gogs, A)
                  % converts RGB DACS from a monitor to CIE XYZ
                  % dacs is a 3 by 1 matrix containing the RGB DACS (0-255)
                  % gogs is a 2 by 1 matrix containing the gamma and gain
                  % A is a 3 by 3 matrix to transform RGB to XYZ


             11.21   xyz2rgb.m (Box 21)



                  % function [dacs] = xyz2rgb(XYZ, gogvals, A)
                  % converts XYZ to RGB DACS for a monitor
                  % XYZ is a 3 by 1 matrix containing the XYZ values
                  % gogvals is a 3 by 2 matrix containing the gamma and gain
                  % for each of the three channels
                  % A is a 3 by 3 matrix to transform RGB to XYZ



             11.22   compigog (Box 22)



                  % function [dacs] = compgog(gogs,rgb)
                  % computes the normalized RGB values
                  % from the linearized RGB values
                  % for a given set of gog values
                  % gog is a 2 by 1 matrix that contains the gamma and gain
                  % dacs is an n by 1 matrix that contains the RGB values
                  % rgb is an n by 1 matrix of linearized RGB values
   203   204   205   206   207   208   209   210   211   212   213