version 1, including all changes.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
pnmhisteq |
|
|
2 |
!!!pnmhisteq |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
OPTIONS |
|
|
7 |
BUGS |
|
|
8 |
SEE ALSO |
|
|
9 |
AUTHOR |
|
|
10 |
---- |
|
|
11 |
!!NAME |
|
|
12 |
|
|
|
13 |
|
|
|
14 |
pnmhisteq - histogram equalise a portable anymap |
|
|
15 |
!!SYNOPSIS |
|
|
16 |
|
|
|
17 |
|
|
|
18 |
__pnmhisteq__ [[__-gray__] [[__-rmap__ |
|
|
19 |
''pgmfile''] [[__-wmap__ ''pgmfile''] |
|
|
20 |
[[__-verbose__] [[''pnmfile''] |
|
|
21 |
!!DESCRIPTION |
|
|
22 |
|
|
|
23 |
|
|
|
24 |
__pnmhisteq__ increases the contrast of a portable |
|
|
25 |
graymap or pixmap through the technique of ''histogram |
|
|
26 |
equalisation''[[1]. A histogram of the luminance of pixels |
|
|
27 |
in the map is computed, from which a transfer function is |
|
|
28 |
calculated which spreads out intensity levels around |
|
|
29 |
histogram peaks and compresses them at troughs. This has the |
|
|
30 |
effect of using the available levels of intensity more |
|
|
31 |
efficiently and thereby increases the detail visible in the |
|
|
32 |
image. |
|
|
33 |
|
|
|
34 |
|
|
|
35 |
Mathematically, if ''N[[i]'' is the number of pixels of |
|
|
36 |
luminosity ''i'' in the image and ''T'' is the total |
|
|
37 |
number of pixels, luminosity ''j'' is replaced |
|
|
38 |
by: |
|
|
39 |
|
|
|
40 |
|
|
|
41 |
j --- \ |
|
|
42 |
|
|
|
43 |
|
|
|
44 |
If you're processing a related set of images, for example |
|
|
45 |
frames of an animation, it's generally best to apply the |
|
|
46 |
same intensity map to every frame, since otherwise you'll |
|
|
47 |
get distracting frame-to-frame changes in the brightness of |
|
|
48 |
objects. __pnmhisteq__'s __-wmap__ option allows you |
|
|
49 |
to save, as a portable graymap, the luminosity map computed |
|
|
50 |
from an image (usually a composite of the images you intend |
|
|
51 |
to process created with __pnmcat__). Then, you can |
|
|
52 |
subsequently process each of the individual images using the |
|
|
53 |
luminosity map saved in the file, supplied with the |
|
|
54 |
__-rmap__ option. |
|
|
55 |
!!OPTIONS |
|
|
56 |
|
|
|
57 |
|
|
|
58 |
__-gray__ |
|
|
59 |
|
|
|
60 |
|
|
|
61 |
When processing a pixmap, only gray pixels (those with |
|
|
62 |
identical red, green, and blue values) are included in the |
|
|
63 |
histogram and modified in the output image. This is a |
|
|
64 |
special purpose option intended for images where the actual |
|
|
65 |
data are gray scale, with colour annotations you don't want |
|
|
66 |
modified. Weather satellite images that show continent |
|
|
67 |
outlines in colour are best processed using this option. The |
|
|
68 |
option has no effect when the input is a |
|
|
69 |
graymap. |
|
|
70 |
|
|
|
71 |
|
|
|
72 |
__-rmap__ ''mapfile'' |
|
|
73 |
|
|
|
74 |
|
|
|
75 |
Process the image using the luminosity map specified by the |
|
|
76 |
portable graymap ''mapfile.'' The graymap, usually |
|
|
77 |
created by an earlier run of __pnmhisteq__ with the |
|
|
78 |
__-wmap__ option, contains a single row with number of |
|
|
79 |
columns equal to the ''maxval'' (greatest intensity) of |
|
|
80 |
the image. Each pixel in the image is transformed by looking |
|
|
81 |
up its luminosity in the corresponding column in the map |
|
|
82 |
file and changing it to the value given by that |
|
|
83 |
column. |
|
|
84 |
|
|
|
85 |
|
|
|
86 |
__-wmap__ ''mapfile'' |
|
|
87 |
|
|
|
88 |
|
|
|
89 |
Creates a portable graymap, ''mapfile,'' containing the |
|
|
90 |
luminosity map computed from the histogram of the input |
|
|
91 |
image. This map file can be read on subsequent runs of |
|
|
92 |
__pnmhisteq__ with the __-rmap__ option, allowing a |
|
|
93 |
group of images to be processed with an identical |
|
|
94 |
map. |
|
|
95 |
|
|
|
96 |
|
|
|
97 |
__-verbose__ |
|
|
98 |
|
|
|
99 |
|
|
|
100 |
Prints the histogram and luminosity map on standard |
|
|
101 |
error. |
|
|
102 |
|
|
|
103 |
|
|
|
104 |
All flags can be abbreviated to their shortest unique |
|
|
105 |
prefix. |
|
|
106 |
!!BUGS |
|
|
107 |
|
|
|
108 |
|
|
|
109 |
Histogram equalisation is effective for increasing the |
|
|
110 |
visible detail in scientific imagery and in some |
|
|
111 |
continuous-tone pictures. It is often too drastic, however, |
|
|
112 |
for scanned halftone images, where it does an excellent job |
|
|
113 |
of making halftone artifacts apparent. You might want to |
|
|
114 |
experiment with __pgnnorm__, __ppmnorm__, and |
|
|
115 |
__pnmgamma__ for more subtle contrast |
|
|
116 |
enhancement. |
|
|
117 |
|
|
|
118 |
|
|
|
119 |
The luminosity map file supplied by the __-rmap__ option |
|
|
120 |
must have the same ''maxval'' as the input image. This is |
|
|
121 |
always the case when the map file was created by the |
|
|
122 |
__-wmap__ option of __pnmhisteq__. If this restriction |
|
|
123 |
causes a problem, simply adjust the ''maxval'' of the map |
|
|
124 |
with __pnmdepth__ to agree with the input |
|
|
125 |
image. |
|
|
126 |
|
|
|
127 |
|
|
|
128 |
If the input is a PBM file (on which histogram equalisation |
|
|
129 |
is an identity operation), the only effect of passing the |
|
|
130 |
file through __pnmhisteq__ will be the passage of |
|
|
131 |
time. |
|
|
132 |
!!SEE ALSO |
|
|
133 |
|
|
|
134 |
|
|
|
135 |
pgmnorm(1), pnm(5), pnmcat(1), |
|
|
136 |
pnmdepth(1), pnmgamma(1), |
|
|
137 |
pnmnorm(1) |
|
|
138 |
|
|
|
139 |
|
|
|
140 |
[[1] |
|
|
141 |
|
|
|
142 |
|
|
|
143 |
Russ, John C. The Image Processing Handbook. Boca Raton: CRC |
|
|
144 |
Press, 1992. Pages 105-110. |
|
|
145 |
!!AUTHOR |
|
|
146 |
Copyright (C) 1995 by John Walker |
|
|
147 |
(kelvin@fourmilab.ch). |
|
|
148 |
WWW home page: http://www.fourmilab.ch/ |
|
|
149 |
Permission to use, copy, modify, and distribute this |
|
|
150 |
software and its documentation for any purpose and without |
|
|
151 |
fee is hereby granted, without any conditions or |
|
|
152 |
restrictions. This software is provided ``as is'' without |
|
|
153 |
express or implied warranty. |
|
|
154 |
---- |