TECHNICAL NOTE Colorimetric matching by minimum-square-error fitting J. A. Quiroga, J. Zoido, J. Alonso, and E. Bemabeu Least-squares approximation can be used in image-based colorimetry once the set of sampling functions is selected. We discuss the accuracy obtained in earlier research, and we compare it with a better calculation method. Key words: Colorimetry, least-squares fitting. Linear models are often used in image-based colorim­ etry. The continuous functions of wavelength are sampled at discrete intervals in the visible range, and this procedure reduces the dimension of the working linear space from infinity to the number of sampled points. In this work space, unknowns are related to measured quantities through a set of linear equations. Consequently linear algebra techniques can then be applied to find solutions to these linear systems.1 For example, suppose we want to find spectral reflectance function ρ(λ) of light reflected from a given surface illuminated with a spectral power distri­ bution E(λ). We have a set of m detectors with spectral sensitivities Si(λ), i = 1, . .., m (this is the same as a unique detector plus m filters). Then we obtain m measured quantities ri, given by where the sum extends over the number of sampled points, N. Equation (1) can be rewritten in matrix form as V being the matrix whose elements are Vij = E(λj)si [λj ). If N ≥ m ≥ 3, an estimate of p can be obtained from the m values ri by means of the generalized The authors are with the Departamento de Optica, Universidad Complutense de Madrid, Facultad de Ciencias Fisicas, Ciudad Universitaria, Madrid 28040, Spain. Received 20 September 1993; revised manuscript received 3 May 1994. 0003-6935/94/266139-03$06.00/0. © 1994 Optical Society of America. inverse This technique guarantees minimum square error (MSE) and minimum norm (least energy) for the solution p.2 If noise is present in sensor outputs ri or if condi­ tions over the matrix V are not suitable [for example, the set of filters is improperly chosen to cover the domain in which the function ρ(λ) differs appreciably from zero], the solution given by Eq. (3) can be strongly oscillating. Then improved linear tech­ niques should be employed (smoothing filters, Wiener estimation methods, etc.).2 In this Note we address a problem appearing in linear techniques. Typically we desire to transform the sensor responses ri to the desired color space, for example, the Commission Internationale de l'Eclairage (CIE) 1931 (XYZ) system. In this case the linear equations can be established between the sensor responses and the tristimulus values (X1, X2, X3) by means of the expression Usually basis function Si(λ) and transformations T are computed to minimize color errors regarding a selected set of input stimuli.1,3 Nevertheless, some­ times the set of scanning filters is imposed, as in commercial color CCD cameras. Under these conditions for finding the linear trans­ formation T we take into account Eq. (2) and the definition of the tristimulus values, Xi = ∑ [Es(λj)xi (λƒ)ρ(λƒ)∆λ], with xi(λ) being the color-matching func­ tions and Es(λ) being a standard illuminant. If we define matrix M as Mij = Es(λj)xi(λj), linear relation (4) can be established in terms of matrices V and Mas 10 September 1994 / Vol. 33, No. 26 / APPLIED OPTICS 6139 These equations permit us to estimate T in terms of the known quantities V and M. The calculation is performed now on the same basis as that for Eq, (2), and we obtain the estimated matrix obtained by means of Eq. (6): The resulting matrix should be given by The transformation, f, obtained in this way is the linear estimation of the mapping of subspace H1 spanned by the rows of matrix M, {Mi}i=1,...,3, into subspace H2 spanned by the rows of matrix V, [Vi]i=1, m. Of course, Eq. (5) makes sense only if H1 is a subset of H2; that is, if where lin{Ai} is the subspace spanned by the vec­ tors Ai. If expression (7) is not fulfilled, the linear relation between subspaces H1 and H2 can only be interpreted on a MSE basis. This discussion leads into the problem that motivated us to write this note. If we consider the inverse application (which we call R) of Hnear space H2 into H1, that is, V = RM, we can find a linear estimation of the corresponding mapping by applying the same technique explained above. The knowledge of this mapping can be useful in those cases in which we want to estimate the system output response corresponding to a given input sample (and therefore to a given set of tristimulus values). In this situation, if we want to recover the mapping T, or an estimation of it, following the work of Simpson and Jansen,4 we can invert (in a generalized sense) which is a new estimation for the equation M = TV. This procedure, though valid, is not the most accurate one. In effect the estimation of the map­ ping T obtained by means of Eq. (9) does not coincide with the MSE estimation of the linear mapping established in Eq. (6). Moreover, the estimation through Eq. (9) is far less accurate than the real MSE estimation, as we demonstrate below. To compare the two different techniques, we per­ formed a simulation that consists in the calculation of both matrices to map H1 into H2. We chose as the object space, H1, the linear space generated by the standard illuminant D65, denoted by Es(λ), and the three spectal responses Si(λ) = Ci(λ)RCCD)(λ),i = 1, 2, 3, where Ci(λ) corresponds with three filters, taken from a set of four filters, the BG12 from Scott and Wratten filters 11, 44, and CC50Y from Kodak, and where RCCD(Λ) is the spectral response of a CCD camera (SONY CMA-D5CE). The resulting scanning func­ tions are shown in Fig. 1. We evaluated the mean colorimetric error over a 2673-sample set of reflectances, which cover almost all the chromaticity diagram. We computed these reflectances so that, under the D65 illuminant, their Fig. 1. Set of scanning filters for the simulation. 6140 APPLIED OPTICS / Vol. 33, No. 2 6 / 1 0 September 1994 Table 1. Mean C\E(L, u, v) Error for the Different Sets of Scanning Filters" "The filters are shown in Fig. 1. Set A corresponds to filters 1, 2, and 3; set B corresponds to filters 1, 2, and 4; set C corresponds to filters 2, 3, and 4; set D corresponds to filters 1, 3, and 4. Estimation T is calculated by Eq. (6), and estimation T is calculated by Eq. (9). color stimuli are metamers of the Munsell chip set. For each color (with known tristimulus vector X) the corresponding estimation X was calculated. Next, we transformed the color vectors to a uniform color space, in our case the CIE 1976 L*, u*, v* system was used. For each color the colorimetric error was computed by means of the CIE color difference for­ mula, ∆E = [(L* - L*)2 + (u* - û*f + (v - v*)2]½ (Ref. 5), and finally the mean error was computed over the ensemble of colors. Table 1 shows the mean error over the ensemble for the two estimation techniques. As we have used three filters out of a set of four, we have four cases (A, B, C, and D) corresponding to all the possible combina­ tions. The error for the inverted matrix can be (case A) up to three times greater than the error for the direct MSE technique. In conclusion, it can be established that the general­ ized inversion of a MSE estimation for a linear mapping between two color spaces produces results less accurate than direct MSE estimation. This statement should be taken into account whenever an approximate linear mapping between two linear spaces is desired. Of course, the distinction between the two methods aforementioned does not matter when an exact linear mapping does exist. References 1. D. H. Marimont and B. A. Wandell, "Linear models of surface and illuminant spectra," J. Opt. Soc. Am. A 9, 1905-1913 (1993). 2. W. K. Pratt, Digital Image Processing (Wiley, New York, 1991), Chaps. 12 and 13. 3. K. Engelhardt and P. Seitz, "Optimum color filters for CCD digital cameras," Appl. Opt. 32, 3015-3023 (1993). 4. M. L. Simpson and J. F. Jansen, "Imaging colorimetry: a new approach," Appl. Opt. 30, 4666-4671 (1991). 5. G. Wyszecki and W. S. Stiles, Color Science: Concepts and Methods, Quantitative Data and Formulae, 2nd ed. (Wiley, New York, 1982), Chap. 3, p. 166. 10 September 1994 / Vol. 33, No. 26 / APPLIED OPTICS 6141