Section: User Commands (1)
Updated: 19 March 1995Index
Return to Main Contents
pnmhisteq - histogram equalise a portable anymap
increases the contrast of a portable graymap or pixmap through the
A histogram of the luminance of pixels in the map is computed, from
which a transfer function is calculated which spreads out intensity levels
around histogram peaks and compresses them at troughs. This has the
effect of using the available levels of intensity more efficiently and
thereby increases the detail visible in the image.
is the number of pixels of luminosity
in the image and
is the total number of pixels, luminosity
is replaced by:
> N[i] / T
If you're processing a related set of images, for example frames of an
animation, it's generally best to apply the same intensity map to
every frame, since otherwise you'll get distracting frame-to-frame
changes in the brightness of objects.
allows you to save, as a portable graymap, the luminosity map computed
from an image (usually a composite of the images you intend
to process created with
Then, you can subsequently process each of the individual images using
the luminosity map saved in the file, supplied with the
When processing a pixmap, only gray pixels (those with identical red,
green, and blue values) are included in the histogram and modified
in the output image. This is a special purpose option intended
for images where the actual data are gray scale, with
colour annotations you don't want modified. Weather
satellite images that show continent outlines in colour are best
processed using this option. The option has no effect when the input
is a graymap.
- -rmap mapfile
Process the image using the luminosity map specified by the portable
The graymap, usually created by an earlier run of
option, contains a single row with number of columns equal to
(greatest intensity) of the image. Each pixel in the image is
transformed by looking up its luminosity in the corresponding
column in the map file and changing it to the value
given by that column.
- -wmap mapfile
Creates a portable graymap,
containing the luminosity map computed from the histogram of the
input image. This map file can be read on subsequent runs of
option, allowing a group of images to be processed with
an identical map.
Prints the histogram and luminosity map on standard error.
All flags can be abbreviated to their shortest unique prefix.
Histogram equalisation is effective for increasing the visible detail
in scientific imagery and in some continuous-tone pictures. It is
often too drastic, however, for scanned halftone images, where it
does an excellent job of making halftone artifacts apparent. You
might want to experiment with
for more subtle contrast enhancement.
The luminosity map file supplied by the
option must have the same
as the input image. This is always the case when the
map file was created by the
If this restriction causes a problem, simply adjust the
of the map with
to agree with the input image.
If the input is a PBM file (on which histogram equalisation is an
identity operation), the only effect of passing the file through
will be the passage of time.
Russ, John C. The Image Processing Handbook.
Boca Raton: CRC Press, 1992. Pages 105-110.
Copyright (C) 1995 by John Walker (firstname.lastname@example.org).
WWW home page: http://www.fourmilab.ch/
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
without any conditions or restrictions. This software is provided ``as
is'' without express or implied warranty.
- SEE ALSO