image - To map RGB to Parula in Matlab -


there functions such rgb2hsv, rgb2ind, rgb2lab , rgb2xyz in converting rgb colormap 1 - in matlab r2014b colormap parula introduced. however, cannot find solution convert rgb colormap parula i.e. current default colormap of matlab. can set colormap figure, not convert image follows. started think benefits of parula in contrast hsv in 1 part of removing black , neighbor colors in picture, example here.

pseudocommand

im = imread('http://i.stack.imgur.com/cfosp.png');  hsv = rgb2parula(im); % pseudocommand similar hsv: hsv = rgb2hsv(im); imshow(hsv);  

which gives

enter image description here

which 1 reason quantization noise in later stages of image processing , bad morphological removal, indicated in previous thread.

how can map rgb parula in matlab?

user-made parulas

i think need customized parula because function rgb2parula not available. proposal here variant gnuplot colormap. how can convert piece of code matlab?

this not possible, because parula not contain possible rgb values. if think it, every matlab colormap subset of rgb ensemble. in mathematical terms rgb2hsv isomorphism, there cannot such isomorphism between rgb , colormap (even hsv colormap, not take possible hsv values).

then given rgb triplet can try find nearest rgb triplet inside parula colormap. 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,:) nearest color rgb in parula according metric. of course, imperfect solution.


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -