MATLAB: How to convert to the XYZ color space from a non-standard RGB color profile using the Image Processing Toolbox 4.1 (R13SP1)

colorspaceicciccreadImage Processing Toolboxpcs

Can I convert from a custom RGB color space to the XYZ color space using the MAKECFORM function? I would like to do something similar to:
A = makecform('srgb2xyz')
except, instead of using the sRGB color space, I would like to use a custom RGB color profile.

Best Answer

To convert from a non-standard RGB color profile to the device-independent XYZ profile connection space, use the following code:
InputProfile = iccread('myRGB.icc');
C = makecform('mattrc',InputProfile.MatTRC, 'direction', 'forward');
Note that this will only work if the ICC profile includes a MatTRC value.