You are here : matlabImage Processingimapprox

imapprox() - Image Processing

[Y,newmap] = imapprox(X,map,n) approximates
the colors in the indexed image X and associated
colormap map by using minimum variance quantization. imapprox returns
the indexed image Y with colormap newmap,
which has at most n colors.[Y,newmap] = imapprox(X,map,tol) approximates
the colors in X and map through
uniform quantization. newmap contains at most (floor(1/tol)+1)^3 colors. tol must
be between 0 and 1.0. Y = imapprox(X,map,newmap) approximates
the colors in map by using colormap mapping to
find the colors in newmap that best match the colors
in map.Y = imapprox(...,dither_option) enables
or disables dithering. dither_option is a string
that can have one of these values. ValueDescription
{'dither'}(default)Dithers, if necessary, to achieve better color resolution
at the expense of spatial resolution.
'nodither'Maps each color in the original image to the closest
color in the new map. No dithering is performed.


[Y,newmap] = imapprox(X,map,n)[Y,newmap] = imapprox(X,map,tol)Y = imapprox(X,map,newmap)Y = imapprox(...,dither_option)


load mandrill
size(map)         % See that the color map has 220 entries

ans =
   220     3

axis off          % Remove axis ticks and numbers
axis image        % Set aspect ratio to obtain square pixels

Output / Return Value


Alternatives / See Also