% -*- texinfo -*- % @deftypefn {Function File} {[@var{Y}, @var{newmap}] = } cmunique (@var{X},@var{map}) % @deftypefnx {Function File} {[@var{Y}, @var{newmap}] = } cmunique (@var{RGB}) % @deftypefnx {Function File} {[@var{Y}, @var{newmap}] = } cmunique (@var{I}) % Finds colormap with unique colors and corresponding image. % % @code{[Y,newmap]=cmunique(X,map)} returns an indexed image @var{y} % along with its associated colormap @var{newmap} equivalent (which % produce the same image) to supplied @var{X} and its colormap % @var{map}; but eliminating any repeated rows in colormap colors and % adjusting indices in the image matrix as needed. % % @code{[Y,newmap]=cmunique(RGB)} returns an indexed image @var{y} % along with its associated colormap @var{newmap} computed from a % true-color image @var{RGB} (a m-by-n-by-3 array), where @var{newmap} % is the smallest colormap possible (alhough it could be as long as % number of pixels in image). % % @code{[Y,newmap]=cmunique(I)} returns an indexed image @var{y} % along with its associated colormap @var{newmap} computed from a % intensity image @var{I}, where @var{newmap} is the smallest % colormap possible (alhough it could be as long as number of pixels % in image). % % @strong{Notes:} % % @var{newmap} is always a @var{m}-by-3 matrix, even if input image is % a intensity grey-scale image @var{I} (all three RGB planes are % assigned the same value). % % @var{newmap} is always of class double. If we use a RGB or intensity % image of class uint8 or uint16, the colors in the colormap will be of % class double in the range [0,1] (they are divided by intmax('uint8') % and intmax('uint16') respectively. % % @end deftypefn