Least Slope Squared (LSS) Method
Note that the standard LLS method minimizes , that is, it finds the solution that is nearest to the origin, or the reflectance curve that oscillates most tightly about the wavelength axis. For purposes of computing reflectance curves, I can’t think of a compelling reason why this should be a useful objective.
It dawned on me that it might be better to try a different objective function. The reflectance curves of most natural colored objects don’t tend to oscillate up and down very much. I came up with the idea to minimize the square of the slope of the reflectance curve, summed over the entire curve. In the continuous case, this would be equivalent to
The square is used because it equally penalizes upward and downward movement of . This objective will favor flatter reflectance curves and avoid curves that have a lot of up and down movement. (Edit: I later learned that this objective function has been previously investigated by C van Trigt in 1990 in a series of papers called “Smoothest Reflectance Functions.”)
Other researchers have developed methods for reconstructing reflectance curves from tristimulus values. In order to reduce the oscillations, they typically introduce basis functions that oscillate very little, such as segments of low-frequency sinusoids, or they “frequency limit” or “band limit” the solution by constraining portions of the Fourier transform of the reflectance curve. To my mind, these approaches seem to ignore that fact that realistic reflectance curves can sometimes exhibit sudden steep changes in reflectance at certain frequencies, which would have relatively large high-frequency Fourier components. These methods would not be able to create such reflectance curves.
My proposed method would be able to create steep changes in reflectance, but only as a last resort when flatter-sloped curves are not able to match the target tristimulus values. The other advantage of the minimum slope squared approach is that it can be expressed as a quadratic objective function subject to linear constraints, which is solvable by standard least-square strategies.
Consider this optimization formulation:
where is the number of discrete wavelength bands (36 in this study). This optimization can be solved by solving the system of linear equations arising from the Lagrangian stationary conditions
where is a 3636 tridiagonal matrix
Since and do not depend on , the matrix can be inverted ahead of time, instead of each time an sRGB value is processed. Defining
where is the upper-right 363 portion of the matrix. Alternatively, the matrix inversion leading to can be done explicitly through the formula:
Note that this long formula is much less efficient than simply extracting the upper-right 363 portion of the matrix. The 36×3 matrix is shown here.
Since computing is a simple matter of matrix multiplication, the LSS method is just as computationally efficient as the LLS method, and tends to give much better reflectance curves, as I’ll demonstrate later.
Here is a Matlab program for the LSS (Least Slope Squared) method. It also works in the open source free alternative to Matlab, called Octave.
The presentation is spread over several web pages. Click the Next Page or Previous Page links to move sequentially. To access a page directly, use these links:
2. Computing an sRGB triplet from a Reflectance Curve
3. Linear Least Squares (LLS) Method
4. Least Slope Squared (LSS) Method (this page)
5. Least Log Slope Squared (LLSS) Method
6. Iterative Least Log Slope Squared (ILLSS) Method
7. Iterative Least Slope Squared (ILSS) Method
8. Comparison of Methods
9. Conclusions (pre-6/4/19)
10. Update 6/4/19: Least Hyperbolic Tangent Slope Squared (LHTSS) Method