Page 191 - Computational Colour Science Using MATLAB
P. 191
178 MULTISPECTRAL IMAGING
Table 10.1 Reconstruction errors for linear models using six basis functions
Method Median DE Maximum DE
Without subtracting the mean 0.89 13.24
After subtracting the mean 0.81 12.58
language such as C than Equation (10.16) which requires the computation of a
pseudoinverse.
The following code has been used to implement linear models using six basis
functions for the case where the mean is subtracted from a set of 404 reflectance
spectra and for the case where the mean is not subtracted. The reconstructed
spectra have been computed and the CIELAB DE values have been calculated
between the target and reconstructed spectra (Table 10.1). It is evident from
Table 10.1 that lower reconstruction errors result when the mean is subtracted
from the spectra before using the svds command but that the difference between
the two methods is quite small. Note, however, that for other data sets it may be
possible to find the opposite effect, namely that the basis functions computed
without subtracting the mean from the data generate the lower DE values:
clear
load spectra.txt
% spectra is a 404 by 31 matrix of reflectance values
mspec = mean(spectra);
dspec = spectra;
for i=1:404
dspec(i,:) = spectra(i,:)-mspec;
end
[u,s,v]=svds(spectra,6);
[u,s,v1]=svds(dspec,6);
spectra=spectra’;
dspec = dspec’;
% compute the coefficients in basis space
a = pinv(v)*spectra;
a1 = pinv(v1)*dspec;
% reconstruct the spectra from the basis functions
pspectra = v*a;
pdspec = v1*a1;