User:RyanLaClair/sandbox



In colorimetry the OSA-UCS (Optical Society of America Uniform Color Space) is a color space first published in 1947 and developed by the Optical Society of America’s Committee on Uniform Color Scales. Previously created color order systems, such as the Munsell color system, failed to represent perceptual uniformity in all directions. The committee decided that, in order to accurately represent uniform color differences in each direction, a new shape of three dimensional cartesian geometry would need to be used.

History and Development
The development of the OSA-UCS took place during many years, from 1947-1977. Not long after the first mathematical color model was developed by the CIE, David MacAdam showed that when selecting a color on the CIE chromaticity diagram, it could not be guaranteed that colors of the same perceived color difference around this color were at the same color distance with respect to the reference color. More simply, the Euclidean distance between any two colors on the chromaticity diagram could not be used as a uniform measure of perceived color difference. Immediately following this discovery work began to create a space that would behave uniformly in all directions of color difference.

Starting with a sample of 59 colored tiles of non-uniform color differences, the OSA asked 72 observers to judge color differences between the different sample tiles. From the data collected, formulas were developed and parameters were defined to create the new uniform color space. They chose the reference 10 degree observer and Illuminant D65 to characterize the uniform space and a neutral gray background of 30% reflectance. In the end, 558 color samples were produced - 424 full step and 54 half step - and distributed by the OSA.

Geometry


The ideal color solid with points all at an equal distance from a center point is a sphere - however a collection of spheres can not be packed to form a larger solid without gaps. The geometry that the OSA finally chose is a rhombohedral lattice based on a cuboctahedron. Each of the 12 vertices of this solid are equal distance from the center, as well as from each of their neighbors. The last step to completing this geometry was in a rescaling of the vertical L axis, in order to achieve integer coordinate locations for color description. The color distance uniformity is maintained, as only the axis dimensions are scaled, and the scaling is accounted for in the color distance formula.

Coordinate Values
The three perpendicular dimensions of the OSA-UCS are the lightness dimension L, the jaune dimension j (a yellow/blue opponent dimension) and the green dimension g (a green/red opponent dimension).

Lightness (L)
The lightness scale of the OSA-UCS color solid varies vertically from about -10 to 8. UCS lightness of 0 corresponds to the 30% reflective neutral background gray selected for their samples, while lighter shades have positive values and darker shades have negative values.

Jaune (j)
The jaune dimension of the OSA-UCS color solid runs horizontally and perpendicular to the L dimension. This is a yellow-blue chromatic dimension, varying from positive values appearing more yellowish to negative values appearing more blueish. A j value of 0 lies along the neutral (L) axis.

Green (g)
The green dimension of the OSA-UCS runs horizontally perpendicular to both the L and j dimensions. This green-red chromatic axis varies from more greenish positive values to more pinkish negative values. Again, a g value of 0 lies along the neutral (L) axis.

Color Groupings


The cuboctahedron structure of the OSA-UCS color solid can be geometrically divided into 9 planes, known as cleavage planes. These 9 cleavage planes are defined as:
 * L - A plane of constant L (lightness) that runs perpendicular to the L axis, where j and g can take on any values.
 * j - A plane of constant j (yellow-blueness) that runs perpendicular to the j axis, where L and g can take on any values.
 * g - A plane of constant g (red-greenness) that runs perpendicular to the g axis, where L and j can take on any values.
 * L+j - A plane of constant L+j that runs parallel to the g axis, at 35° from the L axis and 55° from the j axis.
 * L-j - A plane of constant L-j that runs parallel to the g axis, at 35° from the L axis and 55° from the j axis.
 * L+g - A plane of constant L+g that runs parallel to the j axis, at 35° from the L axis and 55° from the g axis.
 * L-g - A plane of constant L-g that runs parallel to the g axis, at 35° from the L axis and 55° from the g axis.
 * j+g - A plane of constant j+g that runs parallel to the L axis, at 45° from the j and g axes.
 * j-g - A plane of constant j-g that runs parallel to the L axis, at 45° from the j and g axes.

Color Difference
OSA-UCS color difference is defined by the simple Euclidian distance between two colors in the color space, that takes into account the scaling done to the L axis. The formula used to calculate color difference between color 1 and 2 is:


 * $$\Delta UCS = \sqrt{(\sqrt{2}L_2 - \sqrt{2}L_1)^2 + (j_2 - j_1)^2 + (g_2 - g_1)^2} = \sqrt{2 \Delta L^2 + \Delta j^2 + \Delta g^2}$$

Due to the design of the system, the color difference between two neighbors in the OSA-UCS color space is always 2. Small color differences can be accurately calculated using this formula. Larger color differences, however, require a non-linear correction for accuracy.

Color Transformations
Although there is no direct conversion between OSA-UCS and CIEXYZ, analytic conversion methods have been created and tested for accuracy.

CIEXYZ to OSA-UCS
To perform an analytical conversion from OSA-UCS to CIEXYZ, the following steps should be followed. First a factor representing the Helmholtz-Kohlrausch effect must be calculated from the x and y chromaticity coordinates:


 * $$K = 4.4934x^2 + 4.3034y^2 - 4.276xy - 1.3744x - 2.5643y +1.8103$$

Next determine the modified luminous reflectance:


 * $$Y_0 = K*Y$$

Then calculate the lightness and chroma modification factor:


 * $$L = \frac{1}{\sqrt{2}}(5.9(Y_0^{1/3} - \frac{2}{3}) + 0.042(Y_0 - 30)^{1/3}) - 14.3993)$$
 * $$C = 1 + \frac{0.042(Y_0 - 30)^{1/3}}{Y_0^{1/3} - \frac{2}{3}}$$

Convert the XYZ values to RGB using the linear matrix transformation:



\begin{bmatrix}R\\G\\B\end{bmatrix}= \begin{bmatrix} 0.7990&0.4194&-0.1648\\ -0.4493&1.3265&0.0927\\ -0.1149&0.3394&0.7170 \end{bmatrix} \begin{bmatrix}X\\Y\\Z\end{bmatrix} $$

Last, calculate a and b:


 * $$a = -13.7R^{1/3} + 17.7G^{1/3} - 4B^{1/3}$$
 * $$b = 1.7R^{1/3} + 8G^{1/3} - 9.7B^{1/3}$$

and multiply them by C to obtain OSA-UCS g and j:


 * $$g = C*a$$
 * $$j = C*b$$