261 lines
6.4 KiB
HTML
261 lines
6.4 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of pnmhisteq</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>pnmhisteq</H1>
|
|
Section: User Commands (1)<BR>Updated: 19 March 1995<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="ixAAB"></A>
|
|
<A NAME="ixAAC"></A>
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
pnmhisteq - histogram equalise a portable anymap
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
|
|
<B>pnmhisteq</B>
|
|
|
|
<BR>
|
|
|
|
[<B>-gray</B>]
|
|
|
|
[<B>-rmap</B>
|
|
|
|
<I>pgmfile</I>]
|
|
|
|
[<B>-wmap</B>
|
|
|
|
<I>pgmfile</I>]
|
|
|
|
[<B>-verbose</B>]
|
|
|
|
[<I>pnmfile</I>]
|
|
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<B>pnmhisteq</B>
|
|
|
|
increases the contrast of a portable graymap or pixmap through the
|
|
technique of
|
|
<I>histogram equalisation</I>[1].
|
|
|
|
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.
|
|
<P>
|
|
|
|
Mathematically, if
|
|
<I>N[i]</I>
|
|
|
|
is the number of pixels of luminosity
|
|
<I>i</I>
|
|
|
|
in the image and
|
|
<I>T</I>
|
|
|
|
is the total number of pixels, luminosity
|
|
<I>j</I>
|
|
|
|
is replaced by:
|
|
<P>
|
|
|
|
|
|
|
|
<BR> j
|
|
<BR> ---
|
|
<BR> \
|
|
<BR> > N[i] / T
|
|
<BR> /
|
|
<BR> ---
|
|
<BR> i=0
|
|
|
|
|
|
<P>
|
|
|
|
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.
|
|
<B>pnmhisteq</B>'s
|
|
|
|
<B>-wmap</B>
|
|
|
|
option
|
|
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
|
|
<B>pnmcat</B>).
|
|
|
|
Then, you can subsequently process each of the individual images using
|
|
the luminosity map saved in the file, supplied with the
|
|
<B>-rmap</B>
|
|
|
|
option.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>OPTIONS</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="1"><B>-gray</B>
|
|
|
|
<DD>
|
|
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.
|
|
<DT id="2"><B>-rmap</B><I> mapfile</I>
|
|
|
|
<DD>
|
|
Process the image using the luminosity map specified by the portable
|
|
graymap
|
|
<I>mapfile.</I>
|
|
|
|
The graymap, usually created by an earlier run of
|
|
<B>pnmhisteq</B>
|
|
|
|
with the
|
|
<B>-wmap</B>
|
|
|
|
option, contains a single row with number of columns equal to
|
|
the
|
|
<I>maxval</I>
|
|
|
|
(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.
|
|
<DT id="3"><B>-wmap</B><I> mapfile</I>
|
|
|
|
<DD>
|
|
Creates a portable graymap,
|
|
<I>mapfile,</I>
|
|
|
|
containing the luminosity map computed from the histogram of the
|
|
input image. This map file can be read on subsequent runs of
|
|
<B>pnmhisteq</B>
|
|
|
|
with the
|
|
<B>-rmap</B>
|
|
|
|
option, allowing a group of images to be processed with
|
|
an identical map.
|
|
<DT id="4"><B>-verbose</B>
|
|
|
|
<DD>
|
|
Prints the histogram and luminosity map on standard error.
|
|
</DL>
|
|
<P>
|
|
|
|
All flags can be abbreviated to their shortest unique prefix.
|
|
<A NAME="lbAF"> </A>
|
|
<H2>BUGS</H2>
|
|
|
|
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
|
|
<B>pgnnorm</B>,
|
|
|
|
<B>ppmnorm</B>,
|
|
|
|
and
|
|
<B>pnmgamma</B>
|
|
|
|
for more subtle contrast enhancement.
|
|
<P>
|
|
|
|
The luminosity map file supplied by the
|
|
<B>-rmap</B>
|
|
|
|
option must have the same
|
|
<I>maxval</I>
|
|
|
|
as the input image. This is always the case when the
|
|
map file was created by the
|
|
<B>-wmap</B>
|
|
|
|
option of
|
|
<B>pnmhisteq</B>.
|
|
|
|
If this restriction causes a problem, simply adjust the
|
|
<I>maxval</I>
|
|
|
|
of the map with
|
|
<B>pnmdepth</B>
|
|
|
|
to agree with the input image.
|
|
<P>
|
|
|
|
If the input is a PBM file (on which histogram equalisation is an
|
|
identity operation), the only effect of passing the file through
|
|
<B>pnmhisteq</B>
|
|
|
|
will be the passage of time.
|
|
<A NAME="lbAG"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+pgmnorm">pgmnorm</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?5+pnm">pnm</A></B>(5),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+pnmcat">pnmcat</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+pnmdepth">pnmdepth</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+pnmgamma">pnmgamma</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+pnmnorm">pnmnorm</A></B>(1)
|
|
|
|
<DL COMPACT>
|
|
<DT id="5">[1]<DD>
|
|
Russ, John C. The Image Processing Handbook.
|
|
Boca Raton: CRC Press, 1992. Pages 105-110.
|
|
|
|
</DL>
|
|
<A NAME="lbAH"> </A>
|
|
<H2>AUTHOR</H2>
|
|
|
|
<CENTER>
|
|
Copyright (C) 1995 by John Walker (<A HREF="mailto:kelvin@fourmilab.ch">kelvin@fourmilab.ch</A>).<BR>
|
|
WWW home page: <A HREF="http://www.fourmilab.ch/">http://www.fourmilab.ch/</A><BR>
|
|
</CENTER>
|
|
|
|
<P>
|
|
|
|
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.
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="6"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="7"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="8"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="9"><A HREF="#lbAE">OPTIONS</A><DD>
|
|
<DT id="10"><A HREF="#lbAF">BUGS</A><DD>
|
|
<DT id="11"><A HREF="#lbAG">SEE ALSO</A><DD>
|
|
<DT id="12"><A HREF="#lbAH">AUTHOR</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:24 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|