我正在尝试从HSV图像[1x3]中提取HS和V通道以将其转换为线性空间,不知何故我无法提取它,或者至少在最后我绘制a,b,c时最后我得到一个立方体,我期待一个锥形。
%hsvToLinearSpace
% Converts a color from Matlab's HSV cube to a linear space (i.e. a cone)
%
%Inputs:
% colorsHsv - [1x3] color in Matlab's HSV space
%
%Outputs:
% colorLinear - [1x3] color in a linear space where Euclidean distances can
% be applied.
function colorLinear=hsvToLinearSpace(colorHsv)
%---Modify this code---%
colorLinear(1) = colorHsv(1);
colorLinear(2) = colorHsv(2);
colorLinear(3) = colorHsv(3);
a=colorHsv(2)*colorHsv(3)*cos(2*pi*colorHsv(1));
b=colorHsv(2)*colorHsv(3)*sin(2*pi*colorHsv(1));
c=colorHsv(3);
%----------------------%
end