There are functions such as rgb2hsv, rgb2ind, rgb2lab and rgb2xyz in converting RGB colormap to another one - in Matlab R2014b where the colo
This is not really possible, because Parula
does not contain all the possible RGB values. If you think about it, every Matlab colormap is just a subset of the RGB ensemble. In mathematical terms rgb2hsv
is an isomorphism, but there cannot be such isomorphism between RGB and a colormap (even the hsv
colormap, which does not take all possible HSV values).
Then for a given RGB triplet you can try to find the nearest RGB triplet inside the Parula colormap. Something like:
cm = parula(256);
RGB = rand(1,3);
d2 = (cm(:,1)-RGB(1)).^2 + (cm(:,2)-RGB(2)).^2 + (cm(:,3)-RGB(3)).^2;
[~, mi] = min(d2);
and cm(mi,:)
will be the nearest color to RGB in Parula according to this metric. But of course, this is an imperfect solution.