assing specific colors according to pixels values of a grid2image map

1 view (last 30 days)
Hi to all!
I use grid2image function to create a map of my rasterized data. How can i assign specific values to pixels when they have cartain values? For example I want to have NaN pixels uncolored, pixels with value "1" colored blue, pixels with value "2" colored red etc.
Thank for your help.
Sakis

Answers (1)

Image Analyst
Image Analyst on 21 Jun 2015
I never heard of that function. You'll have to ask the author. The built-in MATLAB function that does that (I think) is TriScatteredInterp().
To do the pseudocoloring you asked for, just set up a colormap and use it:
myColorMap = zeros(256, 3);
myColorMap(2, :) = [0, 0, 1]; % Gray level 1 (which is at row 2) is blue
myColorMap(3, :) = [1, 0, 0]; % Gray level 2 is red
and so on.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!