The set of colors that can be represented using a particular color space is called the gamut. Some L*a*b* color values may be out of gamut when converted to RGB. You know that a converted RGB color is out of gamut when any of its component values is less than 0 or greater than 1.
lab = [80 -130 85]; lab2rgb(lab)
ans = -0.6210 0.9537 -0.1926
The negative values demonstrate that the L*a*b* color [80 -130 85] is not in the gamut of the sRGB color space, which is the default RGB color space used by lab2rgb. A different RGB color space, Adobe RGB (1998), has a larger gamut than sRGB. Use the 'ColorSpace' parameter to convert a L*a*b* color to the Adobe color space.
ans = 0.1234 0.9522 0.1073
Because all the output values are between 0.0 and 1.0 (inclusive), you can conclude that the L*a*b* color [80 -130 85] is inside the Adobe RGB (1998) gamut.
Get the MATLAB code
Published with MATLAB® R2015a
Comments are closed.