首先我们从常规Jet colormap开始:
%# sample image mapped to Jet colormap
I = repmat(1:100, 100, 1);
C = jet(100);
figure
subplot(211), imagesc(I), colormap(C)
subplot(212), rgbplot(C)
Run Code Online (Sandbox Code Playgroud)
首先,我们改变颜色.然后我们尝试恢复原始的颜色分组(我们通过根据色调和值在HSV颜色空间中进行排序来实现):
%# shuffle colors
C = C(randperm(100), :);
%# rearrage according to HSV colorspace
C = rgb2hsv(C);
C = sortrows(C, [-1 -3 2]); %# sort first by Hue, then by value
C = hsv2rgb(C);
figure
subplot(211), imagesc(I), colormap(C)
subplot(212), rgbplot(C)
Run Code Online (Sandbox Code Playgroud)
