These tools allow flexible conversion of images between sRGB and CIELCHab, CIELCHuv, cylindrical SRLAB2, and cylindrical YPbPr (YCH). The core functions RGB2LCH and LCH2RGB have several optional modes not found in other conversion tools. These include the following ...
The ability to control data truncation behavior: LCH data may be truncated before or after converting to RGB. Conventional conversion tools truncate after conversion, resulting in out-of-gamut points being compressed toward the saturated corners of the RGB cube. Truncation before conversion minimizes apparent image alteration, and may be achieved via a LUT for speed, or via direct calculation if desired. The user may also opt to not truncate data at all (default).
For the purpose of testing in-gamut state, the gamma-correction routine can be optionally disabled. This speeds calculations when finding the gamut boundaries.
Support for 65k white point (standard for sRGB), and a Bradford-adapted conversion for a 50k white point is also available.
Also included is MAXCHROMA, a tool used for finding the maximum chroma of the sRGB gamut given L & H coordinates in any of the supported spaces (LCHab, LCHuv, SRLAB2 LCH, as well as HSY and biconic models of these spaces)
These files are part of my Matlab Image Manipulation Toolbox:
More documentation can be found here:
The direct LUV method for MAXCHROMA is a fairly simple adaptation of the C and Lua implementations by Alexei Boronine et al:
Information on SRLAB2 can be found at http://www.magnetkern.de/srlab2.html
DGM (2020). LCH <-> RGB Conversion Tools (https://www.mathworks.com/matlabcentral/fileexchange/57138-lch-rgb-conversion-tools), MATLAB Central File Exchange. Retrieved .
updated FEX description
added YPbPr support (YCH)
added range enforcement to lch2rgb methods
removed IPT dependency
reduced package size