Page 192 - Computational Colour Science Using MATLAB
P. 192

IMPLEMENTATIONS AND EXAMPLES                      179

                  for i=1:404
                    pdspec(:,i) = pdspec(:,i)+mspec’;
                  end

                  % compute the reconstruction errors
                  de1 = zeros(404,1); de2 = zeros(404,1);
                  for i=1:404
                    xyzt = r2xyz(spectra(:,i),400,700,’d65___64’);
                    xyz1 = r2xyz(pspectra(:,i),400,700,’d65___64’);
                    xyz2 = r2xyz(pdspec(:,i),400,700,’d65___64’);
                    labt = xyz2lab(xyzt,’d65___64’);
                    lab1 = xyz2lab(xyz1,’d65___64’);
                    lab2 = xyz2lab(xyz2,’d65___64’);
                    thisde1 = cielabde(labt,lab1);
                    thisde2 = cielabde(labt,lab2);
                    de1(i) = thisde1;
                    de2(i) = thisde2;
                  end

                  result = [median(de1) max(de1) median(de2) max(de2)]






             10.5.3 Estimation of reflectance spectra from tristimulus values

             Despite the fact that spectral reflectance factors are almost always smooth
             functions of wavelength and are highly constrained it is not possible to
             accurately compute reflectance spectra from tristimulus values. Clearly, since
             metamerism exists, the mapping from T!P, where T is a 36n matrix of
             tristimulus values and P is a 316n matrix of reflectance values, is a one-to-many
             mapping. However, the use of linear models and basis functions allows the
             estimation of a possible reflectance spectrum corresponding to a target triplet of
             tristimulus values.
               We can represent the computation of the tristimulus values t for a given
             reflectance spectrum p by the linear system

                  t ¼ Mp,                                                      ð10.20Þ
             where M is a 3631 matrix whose rows contain the wavelength-by-wavelength
             product of the illuminant with one of the three colour-matching functions. We
             can try to solve Equation (10.20) directly by rearranging to give
                  p ¼ M t,                                                     ð10.21Þ
                        þ
   187   188   189   190   191   192   193   194   195   196   197