summary refs log tree commit diff
path: root/pamtohdiff.html
blob: e903a08f28a15dbb0b28891b0acf15ae39c452de (plain) (blame)
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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.3//EN">
<html><head><title>Pamtohdiff User Manual</title></head>
<body>
<h1>pamtohdiff</h1>
Updated: 15 April 2002
<br>
<a href="#index">Table Of Contents</a>

<h2>NAME</h2>

pamtohdiff - convert PAM image to horizontal difference image

<h2 id="synopsis">SYNOPSIS</h2>

<b>pamtohdiff</b>
[<i>pamfile</i>]
[<b>-verbose</b>]

<h2 id="description">DESCRIPTION</h2>

<p>This program is part of <a href="index.html">Netpbm</a>.

<p><b>pamtohdiff</b> takes a PAM (or PNM) image as input and produces a
horizontal difference image version of it as output.  A horizontal
difference image is one where the samples in each row indicate the
difference between the sample value in the corresponding sample of the
input image and the sample directly above it (in the previous row) in
the input image.  The horizontal difference image has the property
that if a row of the original image is identical to the row above it
over a long extent, the corresponding row in the horizontal difference
image will contain all zeroes.  That makes it compress better than the
original image.

<p>Because the horizontal difference samples can be positive or
negative, but PAM samples are unsigned integers, the samples in the
horizontal difference image PAM are defined to be the difference
modulus the range of the input (maxval + 1).  This doesn't lose any
information, as it might seem, because: of the two differences that
could result in the same <b>pamtohdiff</b> output value (e.g. if
maxval is 99, +20 and -80 would both result in "20" in the output),
only one is possible in context and the other would result, when
reconstructing the original image, in a value less than 0 or greater
than maxval.

<p>Before the modulus operation, the values <b>pamtohdiff</b>
computes are also biased by half the maxval.  This is to make the
results easier to inspect visually.  Because of the bias, you can
display the <b>pamtohdiff</b> output as if it were a PNM image.  As
long as none of your differences are more than half the maxval, large
negative differences show up as dark spots, smaller negative
differences are lighter, zero differences are medium intensity, and
positive differences are light.  If you want this to work even for
images that have differences that exceed half the maxval, just use
<b>ppmdim 50</b> on the original image.  To avoid losing information,
though, do a <b>pamdepth</b> to double the maxval first.

<p>Note that because of the transfer function just described, a 
difference of zero, which is most common, is represented by a PAM sample
value in the output of one half the maxval.

<p>The output PAM has a tuple type of "hdiff".

<p>You can use <b>hdifftopam</b> to recover the original image from a
horizontal difference image PAM.


<h2 id="options">OPTIONS</h2>

<p>In addition to the options common to all programs based on libnetpbm
(most notably <b>-quiet</b>, see <a href="index.html#commonoptions">
Common Options</a>), <b>pamtohdiff</b> recognizes the following
command line option:

<dl compact>
<dt><b>-verbose</b>
<dd>Currently no effect.  This may change in future versions.

<!-- Minimum unique abbreviation of options is acceptable.  You may use
double hyphens instead of single hyphens. -->

</dl>

<h2 id="seealso">SEE ALSO</h2>

<b><a href="hdifftopam.html">hdifftopam</a></b>,
<b><a href="pamdepth.html">pamdepth</a></b>

<h2 id="author">AUTHOR</h2>

Bryan Henderson

<hr>
<h2 id="index">Table Of Contents</h2>
<ul>
<li><a href="#synopsis">SYNOPSIS</a>
<li><a href="#description">DESCRIPTION</a>
<li><a href="#options">OPTIONS</a>
<li><a href="#seealso">SEE ALSO</a>
<li><a href="#author">AUTHOR</a>
</ul>
</body>
</html>