更改MATLAB中的颜色空间

huangapple go评论59阅读模式
英文:

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: Link to Image

英文:

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.

答案1

得分: 2

我相信你应该使用applycform()函数来应用这个"cform"对象。

makecform的文档显示了以下示例:

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

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);

huangapple
  • 本文由 发表于 2023年2月6日 13:44:55
  • 转载请务必保留本文链接:https://go.coder-hub.com/75357715.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定