OPTPROP is a general toolbox for various color conversions and calculations. It is general in that in addition to handling various standard illuminants, observers and RGB color spaces, it can also handle custom specifications. It is a toolbox, in that it is not just a collection of routines. Instead, most routines have a common interface and can be combined seamlessly to form higher order routines.
The most novel feature of OPTPROP is its flexible argument passing mechanism, e.g. a conversion from XYZ to Lab can be carried out in any of the following ways:
X,Y,Z can have any dimensions as long as they are equal and XYZ can also have any dimensions as long as SIZE(XYZ,NDIMS(XYZ))==3. The non-colorimetric dimensions are retained and propagated to Lab and L,a,b respectively.
In addition to pure data, many conversion routines needs arguments like illuminant and observer. These arguments can be entered in each call, but can also be left out. In this case, the routines get these additional arguments from a set of default values that can be set on a session basis or as defaults for all subsequent sessions.
OPTPROP knows of many standard optical specifications and definitions, such as:
- illuminants: including
.....A, C, D50, D55, D65, D75, F1 through F12
- arbitrary blackbody and D illuminants
- observers, CIE 1931 2° and CIE 1964 10°
- RGB color spaces, such as sRGB, Adobe, Prophoto
- chromatic adaptation transforms, such as
.....scaled, vonKries and Bradford
When OPTPROP needs constants tabulated by ASTM, such as color weighting functions, it will use the pristine tabulated values whenever there is a table that fits the specified wavelength range for that illumination. If no suitable table exists, OPTPROP will interpolate the wanted table from the basic underlying tables and definitions. This makes it possible to use even non-standard illuminations such as e.g. D57.
All toplevel routines of OPTPROP are documented in an accompanying 110-page pdf manual.
The OPTPROP toolbox was written by Jerker Wågberg, More Research and DPC - Digital printing Center, as a part of the project "Interaction between ink and paper", a project sponsored by the Knowledge Foundation, Sweden.
Jerker Wagberg (2020). optprop - a color properties toolbox (https://www.mathworks.com/matlabcentral/fileexchange/13788-optprop-a-color-properties-toolbox), MATLAB Central File Exchange. Retrieved .
I use it regularly and like it.
It is desired to have RGB coordinates in the range [0,255]. But when converting from the spectra to RGB coordinates using roo2RGB the CLIP option is not working, even if it was passed explicitly in the argument as [RGB] = roo2rgb(rSPD,'sRGB', WL, 'Clip', 'off'), it returns always in the range [0 1].
The de2000.m code seems to have an error if the hue angle is less than zero. As a workaround there is a Matlab program here, http://www.ece.rochester.edu/~gsharma/ciede2000/ , and you can check with values in the paper in that directory.
FYI if you are curious about the coefficients in i_roo2xyz, the reference is Stearns and Stearns (1988): An example of a method for correcting radiance data, Color Res. and App., 13, 257-259.
Lots of useful code for color analysis and a nice tutorial to go along with it.
This is a great package. If anyone has done extensions for self-luminous media (more Luv stuff), I'd be interested, but it's pretty wonderful just the way it is.
I found a sad mistake in function "i_lch2lab". With arrays as inputs there got error.
This code works much better than previous:
is there a simple code to transform an RGB file into wavelengths and illuminations> the goal would be to do a spectral analysis of an image.
Fairly complete. A few spot checks gave values that I verified, though I did not exhaustively test these tools. I might have expected to see conversions to status A density. I was also wondering if I might see some tools for gamut mapping.
A few functions (viewgamut is one) expected input in forms that confused me. This is not a serious complaint, since with this extensive a variety of tools one would expect to spend at least some time learning to use them.
Overall - well done.
roo2xyz now works with chunking even non-ASTM length spectra.
Forgot to include the manual. Sorry.
Messed up the description in the previous post, despite all my good intentions...
Cleaned out some mlint complaints.