Reorder colors in a colormap.
When called with only two arguments, cmpermute
randomly rearranges
the colormap map and returns a new colormap newmap. It also
returns the indexed image Y which is the equivalent of the original
input image X when displayed using newmap.
When called with an optional third argument the order of colors in the new colormap is defined by index.
Caution: index
should not have repeated elements or the
function will fail.
The following code
[Y, newmap] = cmpermute ([1:4], hot (4), 4:-1:1) ## colormap will be arranged in reverse order (so will image)
Produces the following output
Y = 4 3 2 1 newmap = 1.00000 1.00000 1.00000 1.00000 1.00000 0.50000 1.00000 1.00000 0.00000 1.00000 0.00000 0.00000
Package: octave