File Exchange

image thumbnail

LCH <-> RGB Conversion Tools

version 1.3.0.0 (2.52 MB) by DGM
Convert between sRGB and cylindrical (LCH) versions of CIELAB, CIELUV, and SRLAB2

2 Downloads

Updated 24 Jul 2016

View License

These tools allow flexible conversion of images between sRGB and CIELCHab, CIELCHuv, and cylindrical SRLAB2. 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:
http://www.mathworks.com/matlabcentral/fileexchange/53786-image-manipulation-toolbox
.
More documentation can be found here:
http://myplace.frontier.com/~chooks9592/manual/html/rgb2lch.html
http://myplace.frontier.com/~chooks9592/manual/html/maxchroma.html
.
The direct LUV method for MAXCHROMA is a fairly simple adaptation of the C and Lua implementations by Alexei Boronine et al:
http://www.husl-colors.org/#math
.
Information on SRLAB2 can be found at http://www.magnetkern.de/srlab2.html

Comments and Ratings (0)

Updates

1.3.0.0

added range enforcement to lch2rgb methods
bugfix in maxchroma YPbPr case

1.2.0.0

removed IPT dependency

1.1.0.0

reduced package size

MATLAB Release Compatibility
Created with R2009b
Compatible with any release
Platform Compatibility
Windows macOS Linux