1Pnmpsnr User Manual(0) Pnmpsnr User Manual(0)
2
3
4
6 pnmpsnr - compute the difference between two images (the PSNR)
7
8
10 pnmpsnr
11
12 [pnmfile1]
13
14 [pnmfile2]
15
16 [-rgb] [-machine] [-max=n]
17
18 Minimum unique abbreviations of options are acceptable. You may use
19 double hyphens instead of single hyphen to denote options. You may use
20 white space in place of the equals sign to separate an option name from
21 its value.
22
23
24
26 This program is part of Netpbm(1).
27
28 pnmpsnr reads two PBM, PGM, or PPM files, or PAM equivalents, as input
29 and prints the magnitude of difference between the two images as a peak
30 signal-to-noise ratio (PSNR) This metric is typically used in image
31 compression papers to rate the distortion between original and decoded
32 image.
33
34 If the inputs are PBM or PGM, pnmpsnr prints the PSNR of the luminance
35 only. Otherwise, it prints the separate PSNRs of the luminance, and
36 chrominance (Cb and Cr) components of the colors.
37
38 The PSNR of a given component is the ratio of the maximum mean square
39 difference of component values that could exist between the two images
40 (a measure of the information content in an image) to the actual mean
41 square difference for the two subject images. It is expressed as a
42 decibel value.
43
44 The mean square difference of a component for two images is the mean
45 square difference of the component value, comparing each pixel with the
46 pixel in the same position of the other image. For the purposes of
47 this computation, components are normalized to the scale [0..1].
48
49 The maximum mean square difference is identically 1.
50
51 So the higher the PSNR, the closer the images are. A luminance PSNR of
52 20 means the mean square difference of the luminances of the pixels is
53 100 times less than the maximum possible difference, i.e. 0.01.
54
55 Note that the word "peak" is a misnomer; there is no maximum involved;
56 the metric is a mean. But "peak signal to noise ratio" is for some
57 reason the common term for this measurement.
58
59 pnmpsnr reports the PSNR either in human-friendly form or in machine-
60 friendly form (see -machine).
61
62
63
65 -rgb This option causes pnmpsnr to compare the red, green, and blue
66 components of the color rather than the luminance and chromi‐
67 nance components. It has no effect on a grayscale image.
68
69 This option was new in Netpbm 10.71 (June 2015).
70
71
72 -machine
73 This option causes pnmpsnr to report the PSNRs in machine-
74 friendly form, so another program can easily use the informa‐
75 tion.
76
77 The output is a single line. It contains one floating point
78 decimal number for each color component, with a single space
79 between every two. (This means there are either 1 or 3 num‐
80 bers). For the YCbCr color space (no -rgb), they are in the
81 order Y, Cb, Cr. For the RGB color space (-rgb), they are in R,
82 G, B order. For a grayscale image, there is one number.
83
84 Where the component does not differ between the images, so the
85 PSNR is infinite, the number is inf
86
87 But note that the number displayed is also modified by the
88 effect of -max. In particular, with -max, you will never see
89 inf.
90
91 This option was new in Netpbm 10.74 (March 2016).
92
93
94 -max=n This is meaningful only with -machine.
95
96 It specifies the maximum number pnmpsnr will print as a PSNR.
97 If the PSNR is greater than n, pnmpsnr just prints n. n is a
98 decimal floating point number. An infinite PSNR is considered
99 greater than any number.
100
101 This is mainly useful to deal with infinite PSNRs. It is often
102 much more convenient to have a program process only numbers than
103 to make it deal with infinity, and often a very large number has
104 the same effect on a program as infinity.
105
106 Note that the output is logarithmic, which means you will not
107 see really large but finite numbers. If you specify -max=1000,
108 the only way you will see 1000 in the output is if the PSNR is
109 really infinite. Two images with as many pixels as there are
110 electrons in the universe, differing in only one pixel, and only
111 in the smallest amount representable in the Netpbm format, have
112 a PSNR less than 1000.
113
114 This option was new in Netpbm 10.74 (March 2016).
115
116
117
118
119
121 pnm(1)
122
124 This manual page was generated by the Netpbm tool 'makeman' from HTML
125 source. The master documentation is at
126
127 http://netpbm.sourceforge.net/doc/pnmpsnr.html
128
129netpbm documentation 23 January 2016 Pnmpsnr User Manual(0)