Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

我们为许可用户提供了部分翻译好的中文文档。您只需登录便可查阅这些文档

cmpermute

Rearrange colors in colormap

Syntax

[Y,newmap] = cmpermute(X,map)
[Y,newmap] = cmpermute(X,map,index)

Description

[Y,newmap] = cmpermute(X,map) randomly reorders the colors in map to produce a new colormap, newmap. The cmpermute function also modifies the values in X to maintain correspondence between the indices and the colormap, and returns the result in Y. The image Y and associated colormap, newmap, produce the same image as X and map.

[Y,newmap] = cmpermute(X,map,index) uses an ordering matrix (such as the second output of sort) to define the order of colors in the new colormap.

Class Support

The input image X can be of class uint8 or double. Y is returned as an array of the same class as X.

Examples

collapse all

Load the clown data set to get image X and its associated colormap, map. Display the image.

load clown
figure
image(X)
colormap(map)

Randomly reorder the colormap to get the new colormap, newmap. Display image X with the new colormap.

[Y, newmap] = cmpermute(X,map);
colormap(newmap)

See Also

|


Was this topic helpful?