1Pamtohdiff User Manual(0) Pamtohdiff User Manual(0)
2
3
4
6 pamtohdiff - convert PAM image to horizontal difference image
7
8
10 pamtohdiff [pamfile] [-verbose]
11
12 Minimum unique abbreviation of option is acceptable. You may use dou‐
13 ble hyphens instead of single hyphens to denote options. You may use
14 white space in place of the equals sign to separate an option name from
15 its value.
16
17
19 This program is part of Netpbm(1).
20
21 pamtohdiff takes a PAM (or PNM) image as input and produced a horizon‐
22 tal difference image version of it as output. A horizontal difference
23 image is one where the samples in each row indicate the difference
24 between the sample value in the corresponding sample of the input image
25 and the sample directly above it (in the previous row) in the input
26 image. The horizontal difference image has the property that if a row
27 of the original image is identical to the row above it over a long
28 extent, the corresponding row in the horizontal difference image will
29 contain all zeroes. That makes it compress better than the original
30 image.
31
32 Because the horizontal difference samples can be positive or negative,
33 but PAM samples are unsigned integers, the samples in the horizontal
34 difference image PAM are defined to be the difference modulus the range
35 of the input (maxval + 1). This doesn't lose any information, as it
36 might seem, because: of the two differences that could result in the
37 same pamtohdiff output value (e.g. if maxval is 99, +20 and -80 would
38 both result in "20" in the output), only one is possible in context and
39 the other would result, when reconstructing the original image, in a
40 value less than 0 or greater than maxval.
41
42 Before the modulus operation, the values pamtohdiff computes are also
43 biased by half the maxval. This is to make the results easier to
44 inspect visually. Because of the bias, you can display the pamtohdiff
45 output as if it were a PNM image. As long as none of your differences
46 are more than half the maxval, large negative differences show up as
47 dark spots, smaller negative differences are lighter, zero differences
48 are medium intensity, and positive differences are light. If you want
49 this to work even for images that have differences that exceed half the
50 maxval, just use ppmdim 50 on the original image. To avoid losing
51 information, though, do a pamdepth to double the maxval first.
52
53 Note that because of the transfer function just described, a difference
54 of zero, which is most common, is represented by a PAM sample value in
55 the output of one half the maxval.
56
57 The output PAM has a tuple type of "hdiff".
58
59 You can use hdifftopam to recover the original image from a horizontal
60 difference image PAM.
61
62
63
65 hdifftopam(1), pamdepth(1),
66
67
69 Bryan Henderson
70
71
72
73netpbm documentation 15 April 2002 Pamtohdiff User Manual(0)