This package includes bidirectional tools for converting between sRGB and the following color models:
HSY (chroma-normalized polar YPbPr)
HuSL (chroma-normalized LCHab and LCHuv)
HSYp (rotationally-symmetric subset of HSY)
HuSLp (rotationally-symmetric subset of HuSL)
LCH (polar variants of LAB, LUV, and SRLAB)
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 polar YPbPr and biconic subsets of these spaces)
▒▒ HSI and HSL:
These really need no introduction. The included tools are basic and provide conventional functionality.
▒▒ HuSL and HSY:
HuSL and HSY are merely conceptually similar adaptations of different families of color models. "Human-Friendly HSL" (HuSL) is a chroma-normalized variant of CIELCH designed to keep operations within the sRGB gamut. This is convenient for intuitive selection of colors, or for color adjustment with the intention of returning to RGB space. While the original HuSL developer has changed the model name from HuSL to HSLuv, these tools still use the original naming conventions.
As L and H are varied in LCH, the maximum allowable chroma changes dramatically and nonintuitively. Increasing L or rotating H for a highly saturated color will often move the color point outside the RGB gamut and cause undesired results.
While HuSL has convenience or particular advantages over LCH, it's slower and has a highly distorted chroma space. This makes it less useful for direct color comparison or specification. HuSLp variants are normalized and bounded to the maximal biconic subset of the projected RGB space. This means HuSLp avoids distortion of the chroma space when normalizing, preserving the uniformity of the parent space. Unfortunately, this also means it can only render colors near the neutral axis (pastels). HuSLp is mostly useful for relative specification of uniform colors.
The original HuSL implementations are all based on CIELCHuv. This version offers the option to use either CIELCHab or CIELCHuv. By default, lookup tables are used for speed, though a direct calculation method can be optionally specified.
▒▒ LCH tools:
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.
Information on SRLAB2 can be found at http://www.magnetkern.de/srlab2.html
The direct LUV method for HuSL is a fairly simple adaptation of the C and Lua implementations by Alexei Boronine et al:
These files are part of my Matlab Image Manipulation Toolbox:
DGM (2021). Colorspace Conversion Tools (https://www.mathworks.com/matlabcentral/fileexchange/53354-colorspace-conversion-tools), MATLAB Central File Exchange. Retrieved .
Juan: I see from your recent submission that you went ahead and forged your own solution. Sorry for my lack of prompt helpfulness.
Juan: P.S. Maybe it's bad form, but I capitalize function names for emphasis in the documentation; otherwise, if that's how you were using em, case-sensitivity will result in errors. 2009b tries to auto-match case-insensitively and produces warnings, but i have no idea what newer versions do.
La versión que tengo de matlab es R2015a y no me funciona, lo estoy así eso así: en una función de mando la imagen HSI la cual estaba en RGB, la idea era tomar una imagen RGB y pasarla a HSI, y mirar los canales por aparte, eso lo hice con la ayuda de un código que está publicado por alguien acá mismo en la comunidad, ahora lo que necesito es pasar la imagen resultante nuevamente ósea la imagen HSI a RGB, pero me sale el error " undefined function or variable 'HSI2RGB', lo estoy adié si así : RGB= HSI2RGB(hsi);
Hay alguna manera de hacerlo por código?
Muchas gracias por su importante ayuda.
Inspired by: Colorspace Transformations
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!