contrast
Returns a gray colormap that enhances the contrast of an image.
Category: Graphics > Formatting and Annotation
Syntax
cmap = contrast(X)
Returns a gray map sized like the current colormap.
cmap = contrast(X, m)
Returns a map with m gray levels.
Description
The map spreads the gray levels according to the distribution of the values in X, so that rare but important values are not squeezed into a narrow band of gray. Apply the result with colormap.
Input arguments
X- Image or numeric array of data values.
m- Number of colors.
Output arguments
cmapm-by-3 gray colormap with equal RGB columns.
Example
A gray map for a matrix
c = contrast(magic(4), 8);
disp(size(c))
disp(isequal(c(:,1), c(:,2)))
Output
8 3
1