Navigation

Operators and Keywords

Function List:

C++ API

: cmap = contrast (x)
: cmap = contrast (x, n)

Return a gray colormap that maximizes the contrast in an image.

The returned colormap will have n rows. If n is not defined then the size of the current colormap is used.

See also: colormap, brighten.

Demonstration 1

The following code

 clf;
 img = reshape (1:100, 10, 10);
 imagesc (img);
 colormap (gray (64));
 title ("Image with default 64 gray levels");
 pos = get (gcf, "position");
 pos(1) += pos(3) + 25;
 figure ("position", pos);
 colormap (contrast (img, 10));
 imagesc (img);
 title ("Image with contrast enhanced");

Produces the following figures

Figure 1 Figure 2

Package: octave