1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182
|
<HTML>
<HEAD>
<TITLE>grdhisteq</TITLE>
</HEAD>
<BODY>
<H1>grdhisteq</H1>
<HR>
<PRE>
<!-- Manpage converted by man2html 3.0.1 -->
grdhisteq - Histogram equalization for grd files
</PRE>
<H2>SYNOPSIS</H2><PRE>
<B>grdhisteq</B> <I>in</I><B>_</B><I>grdfile</I> [ <B>-G</B><I>out</I><B>_</B><I>grdfile</I> ] [ <B>-C</B><I>n</I><B>_</B><I>cells</I> ] [ <B>-D</B>
] [ <B>-N</B>[<I>norm</I>] ] [ <B>-Q</B> ] [ <B>-V</B> ]
</PRE>
<H2>DESCRIPTION</H2><PRE>
<B>grdhisteq</B> allows the user to find the data values which
divide a given grdfile into patches of equal area. One
common use of <B>grdhisteq</B> is in a kind of histogram equal
ization of an image. In this application, the user might
have a grdfile of flat topography with a mountain in the
middle. Ordinary gray shading of this file (using grdim
age/grdview) with a linear mapping from topography to
graytone will result in most of the image being very dark
gray, with the mountain being almost white. One could use
<B>grdhisteq</B> to write to stdout an ASCII list of those data
values which divide the range of the data into <I>n</I><B>_</B><I>cells</I>
segments, each of which has an equal area in the image.
Using <B>awk</B> or <B><A HREF="makecpt.html">makecpt</A></B> one can take this output and build a
cpt file; using the cptfile with grdimage will result in
an image with all levels of gray occurring equally. Alter
natively, see <B><A HREF="grd2cpt.html">grd2cpt</A></B>.
The second common use of <B>grdhisteq</B> is in writing a
grdfile with statistics based on some kind of cumulative
distribution function. In this application, the output has
relative highs and lows in the same (x,y) locations as the
input file, but the values are changed to reflect their
place in some cumulative distribution. One example would
be to find the lowest 10% of the data: Take a grdfile, run
<B>grdhisteq</B> and make a grdfile using <I>n</I><B>_</B><I>cells</I> = 10, and then
contour the result to trace the 1 contour. This will
enclose the lowest 10% of the data, regardless of their
original values. Another example is in equalizing the out
put of grdgradient. For shading purposes it is desired
that the data have a smooth distribution, such as a gaus
sian. If you run <B>grdhisteq</B> on output from grdgradient and
make a grdfile output with the Gaussian option, you will
have a grdfile whose values are distributed according to a
gaussian distribution with zero mean and unit variance.
The locations of these values will correspond to the loca
tions of the input; that is, the most negative output
value will be in the (x,y) location of the most negative
input value, and so on.
No space between the option flag and the associ
ated arguments. Use upper case for the option flags and
lower case for modifiers.
<I>in</I><B>_</B><I>grdfile</I>
2-D binary grd file to be equalized.
<B>-C</B> Sets how many cells (or divisions) of data range to
make.
<B>-D</B> Dump level information to standard output.
<B>-G</B> Name of output 2-D grd file. Used with <B>-N</B> only.
<B>-N</B> Gaussian output. Use with <B>-G</B> to make an output grd
file with standard normal scores. Append <I>norm</I> to
force the scores to fall in the <-1,+1> range
[Default is standard normal scores].
<B>-Q</B> Use quadratic intensity scaling. [Default is lin
ear].
<B>-V</B> Selects verbose mode, which will send progress
reports to stderr [Default runs "silently"].
</PRE>
<H2>EXAMPLES</H2><PRE>
To find the height intervals that devide the file
heights.grd into 16 divisions of equal area, try
grdhisteq heights.grd <B>-C</B>16 <B>-D</B> > levels.d
To make the poorly distributed intensities in the file
raw_intens.grd suitable for use with <B><A HREF="grdimage.html">grdimage</A></B> or <B><A HREF="grdview.html">grdview</A></B>,
try
grdhisteq raw_intens.grd <B>-G</B>smooth_intens.grd <B>-N</B> <B>-V</B>
</PRE>
<H2>RESTRICTIONS</H2><PRE>
If you use <B>grdhisteq</B> to make a gaussian output for gradi
ent shading in <B><A HREF="grdimage.html">grdimage</A></B> or <B><A HREF="grdview.html">grdview</A></B>, you should be aware of
the following: the output will be in the range [-x, x],
where x is based on the number of data in the input grd
file (nx * ny) and the cumulative gaussian distribution
function F(x). That is, let N = nx * ny. Then x will be
adjusted so that F(x) = (N - 1 + 0.5)/N. Since about 68%
of the values from a standard normal distribution fall
within +/- 1, this will be true of the output grdfile.
But if N is very large, it is possible for x to be greater
than 4. Therefore, with the <B><A HREF="grdimage.html">grdimage</A></B> program clipping gra
dients to the range [-1, 1], you will get correct shading
of 68% of your data, while 16% of them will be clipped to
-1 and 16% of them clipped to +1. If this makes too much
of the image too light or too dark, you should take the
output of <B>grdhisteq</B> and rescale it using <B><A HREF="grdmath.html">grdmath</A></B> and mul
tiplying by something less than 1.0, to shrink the range
of the values, thus bringing more than 68% of the image
into the range [-1, 1]. Alternatively, supply a normaliza
tion factor with <B>-N</B>.
<I><A HREF="gmtdefaults.html">gmtdefaults</A></I>(l), <I>gmt</I>(l), <I><A HREF="grd2cpt.html">grd2cpt</A></I>(l), <I><A HREF="grdgradient.html">grdgradient</A></I>(l), <I>grdim</I>
<I>age</I>(l), <I><A HREF="grdmath.html">grdmath</A></I>(l), <I><A HREF="grdview.html">grdview</A></I>(l), <I><A HREF="makecpt.html">makecpt</A></I>(l)
</PRE>
<HR>
<ADDRESS>
Man(1) output converted with
<a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a>
</ADDRESS>
</BODY>
</HTML>
<body bgcolor="#ffffff">
|