1Pnmpsnr User Manual(0)                                  Pnmpsnr User Manual(0)
2
3
4

NAME

6       pnmpsnr - compute the difference between two images (the PSNR)
7
8

SYNOPSIS

10       pnmpsnr
11
12       [pnmfile1]
13
14       [pnmfile2]
15
16       [-rgb] [-machine] [-max=n] [-target=n] [-target1=n] [-target2=n] [-tar‐
17       get3=n]
18
19       Minimum unique abbreviations of options are acceptable.   You  may  use
20       double hyphens instead of single hyphen to denote options.  You may use
21       white space in place of the equals sign to separate an option name from
22       its value.
23
24
25

DESCRIPTION

27       This program is part of Netpbm(1).
28
29       pnmpsnr  reads two PBM, PGM, or PPM files, or PAM equivalents, as input
30       and computes the magnitude of difference between the two  images  as  a
31       peak  signal-to-noise  ratio  (PSNR)  This  metric is typically used in
32       image compression papers to rate the distortion  between  original  and
33       decoded image.
34
35       pnmpsnr  either  prints these values or compares them to thresholds you
36       specify.
37
38
39       The PSNR of a given component is the ratio of the maximum  mean  square
40       difference  of component values that could exist between the two images
41       (a measure of the information content in an image) to the  actual  mean
42       square  difference  for  the  two subject images.  It is expressed as a
43       decibel value.
44
45       The mean square difference of a component for two images  is  the  mean
46       square difference of the component value, comparing each pixel with the
47       pixel in the same position of the other image.   For  the  purposes  of
48       this computation, components are normalized to the scale [0..1].
49
50       The maximum mean square difference is identically 1.
51
52       So the higher the PSNR, the closer the images are.  A luminance PSNR of
53       20 means the mean square difference of the luminances of the pixels  is
54       100 times less than the maximum possible difference, i.e. 0.01.
55
56       Note  that the word "peak" is a misnomer; there is no maximum involved;
57       the metric is a mean.  But "peak signal to noise  ratio"  is  for  some
58       reason the common term for this measurement.
59
60       If  the  inputs  are PBM or PGM, pnmpsnr computes the PSNR of the lumi‐
61       nance only.  Otherwise, it computes three separate  PSNRs:  either  the
62       luminance,  and chrominance (Cb and Cr) components of the colors or the
63       red, green, and blue components.
64
65       By default, the program prints the PSNRs to Standard Output  in  human-
66       friendly form.
67
68       With the -machine option, the program prints the PSNRs, but in machine-
69       friendly form.
70
71       With a -target[x] option, the program just prints 'match' or 'nomatch',
72       depending on whether the PSNRs exceed targets you specify.
73
74
75       pnmpsnr  reports  the PSNR either in human-friendly form or in machine-
76       friendly form (see -machine).
77
78
79

OPTIONS

81       In addition to the options common to all programs  based  on  libnetpbm
82       (most notably -quiet, see
83        Common  Options  ⟨index.html#commonoptions⟩  ), pnmpsnr recognizes the
84       following command line options:
85
86
87
88       -rgb   This option causes pnmpsnr to compare the red, green,  and  blue
89              components  of  the  color rather than the luminance and chromi‐
90              nance components.  It has no effect on a monotone image.
91
92              This option was new in Netpbm 10.71 (June 2015).
93
94
95       -machine
96              This option causes pnmpsnr  to  report  the  PSNRs  in  machine-
97              friendly  form,  so  another program can easily use the informa‐
98              tion.
99
100              The output is a single line.  It  contains  one  floating  point
101              decimal  number  for  each  color component, with a single space
102              between every two.  (This means there are either  1  or  3  num‐
103              bers).   For  the  YCbCr  color space (no -rgb), they are in the
104              order Y, Cb, Cr.  For the RGB color space (-rgb), they are in R,
105              G, B order.  For a monotone image, there is one number.
106
107              Where  the  component does not differ between the images, so the
108              PSNR is infinite, the number is inf
109
110              But note that the number  displayed  is  also  modified  by  the
111              effect  of  -max.   In particular, with -max, you will never see
112              inf.
113
114              This option has no effect when you also specify -target[n].
115
116              This option was new in Netpbm 10.74 (March 2016).
117
118
119       -max=n This is meaningful only with -machine.
120
121              It specifies the maximum number pnmpsnr will print  as  a  PSNR.
122              If  the  PSNR  is greater than n, pnmpsnr just prints n.  n is a
123              decimal floating point number.  An infinite PSNR  is  considered
124              greater than any number.
125
126              This  is mainly useful to deal with infinite PSNRs.  It is often
127              much more convenient to have a program process only numbers than
128              to make it deal with infinity, and often a very large number has
129              the same effect on a program as infinity.
130
131              Note that the output is logarithmic, which means  you  will  not
132              see  really large but finite numbers.  If you specify -max=1000,
133              the only way you will see 1000 in the output is if the  PSNR  is
134              really  infinite.   Two  images with as many pixels as there are
135              electrons in the universe, differing in only one pixel, and only
136              in  the smallest amount representable in the Netpbm format, have
137              a PSNR less than 1000.
138
139              This option was new in Netpbm 10.74 (March 2016).
140
141
142       -target=n
143
144              This option causes pnmpsnr to run in comparison  mode  -  rather
145              than print the PSNRs, it just tells you whether the PSNRs exceed
146              n (a floating point number), i.e. whether  the  compared  images
147              are  the  same  within a given margin of error.  If all the com‐
148              puted PSNRs (luminance for a PBM or PGM; luminance  and  chromi‐
149              nance  or  red,  green,  and blue for PPM) exceed n, the program
150              prints  'match'  to  Standard  Output.   Otherwise,  it   prints
151              'nomatch'.
152
153              If  you also specify any of -target1, -target2, or -target3, and
154              the images are color, pnmpsnr ignores -target.
155
156              This is mainly useful for use in a program.  If  you're  running
157              pnmpsnr manually, you could just run pnmpsnr without -target and
158              compare the PSNRs to your targets yourself.
159
160              This option was new in Netpbm 10.82 (March 2018).
161
162
163       -target{1,2,3}=n
164              Like -target, these options cause pnmpsnr to run  in  comparison
165              mode.   But  they  provide  separate  targets for the individual
166              color component PSNRs.  -target1, target-2, and -target3 are for
167              either  the  Y, Cb, and Cr components, respectively, or the red,
168              green, and blue components, respectively, depending upon whether
169              you specified -rgb.
170
171              If  you  don't  specify  the corresponding -targetn option for a
172              component, pnmpsnr ignores the PSNR of that component in  decid‐
173              ing whether the images match.
174
175              If  the  image  is  a  PBM or PGM, these options have no effect,
176              except that it stilll selects comparison mode, so if  you  don't
177              also  specify  -target, and the image is PBM or PGM, the program
178              fails.
179
180              Note that the options are defined so that you could code a pnmp‐
181              snr  command  in a program that works on both color and monotone
182              images, specifying individual PSNR targets for use on the  color
183              images and the single target for use on the monotone images.
184
185              These options were new in Netpbm 10.82 (March 2018).
186
187
188
189
190

SEE ALSO

192       pnm(1)
193

DOCUMENT SOURCE

195       This  manual  page was generated by the Netpbm tool 'makeman' from HTML
196       source.  The master documentation is at
197
198              http://netpbm.sourceforge.net/doc/pnmpsnr.html
199
200netpbm documentation            06 January 2018         Pnmpsnr User Manual(0)
Impressum