cmunique
Eliminate duplicate colors in colormap; convert grayscale or truecolor image to indexed image
Description
[
removes duplicate rows from the colormap Y,newmap] = cmunique(X,map)map to produce a new
colormap, newmap. The function also adjusts the indices in
intensity image 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 but
with the smallest possible colormap.
[
converts the truecolor image Y,newmap] = cmunique(RGB)RGB to the indexed image
Y and its associated colormap, newmap.
The returned colormap is the smallest possible colormap for the image, containing
one entry for each unique color in RGB.
Note
newmap might be very large, because the number of
entries can be as many as the number of pixels in
RGB.
Examples
Input Arguments
Output Arguments
Version History
Introduced before R2006a

