matlabimage-processingrgbcolor-space

Changing colorspace in MATLAB


I'm trying to convert RGB color space to lαβ in MATLAB. I tried running the script, I'm getting a rather different type of error.

>> C = makecform('srgb2lab')
C = 
  struct with fields:
            c_func: @applycformsequence
     ColorSpace_in: 'rgb'
    ColorSpace_out: 'lab'
          encoding: 'double'
             cdata: [1×1 struct]
>> C(HCC1)
Array indices must be positive integers or logical values.

HCC1 is a tiff image loaded from my local PC. To add I'm using the online version of MATLAB.

EDIT: https://entuedu-my.sharepoint.com/:i:/g/personal/bchua024_e_ntu_edu_sg/Ee74d3QJH0FGk5OivZDobx0B9qrwOaNqVx8xnCJW20uxPQ?e=SCaouY

here's the link to the image I'm trying to convert.


Solution

  • I believe you are expected to apply this "cform" object using applycform()

    Documentation for makecform shows this example:

    rgb = imread('peppers.png');
    cform = makecform('srgb2lab');
    lab = applycform(rgb,cform);