It can take a lot of computational work sometimes to convert between color spaces. I was recently looking at the computational steps needed to convert between sRGB and a particular CMYK space known as US Web-coated SWOP, often just called CMYK SWOP.
The Image Processing Toolbox ships with ICC profiles corresponding to each of these spaces. If you give these profiles to makecform and applycform in order to convert sRGB color values to CMYK SWOP values, applycform will perform the following steps:
- Linearize the sRGB values using the red, green, and blue tone reproduction curves.
- Convert linearized RGB values to the sRGB profile connection space (XYZ) by multiplying by a matrix based on the red, green, and blue colorant tags.
- Adjust the black point to compensate for the difference between the ICC version 2 profile (sRGB) and the ICC version 4 profile (CMYK SWOP). (This adjustment is a scale and an offset.)
- Convert from the sRGB profile connection space (XYZ) to the CMYK SWOP profile connection space (Lab).
- Scale by (257/256) to adjust ICC version 2 16-bit Lab encoding to ICC version 4 encoding.
- Apply one-dimensional pre-shaper curves.
- Apply pre-matrix.
- Apply one-dimensional input tables.
- Perform three-dimensional tetrahedral interpolation using the multidimensional grid tables.
- Apply one-dimensional output tables.
Whew! That's a lot to track.
Note added 29-Oct-2013: Please visit the discovery page on Color Profiles for more information on color processing with MATLAB.
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.