summaryrefslogtreecommitdiffstats
path: root/upstream/opensuse-leap-15-6/man1/pnmpsnr.1
blob: ae36de1322384a3419024caad1ccaad6b2757796 (plain)
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
\
.\" This man page was generated by the Netpbm tool 'makeman' from HTML source.
.\" Do not hand-hack it!  If you have bug fixes or improvements, please find
.\" the corresponding HTML page on the Netpbm website, generate a patch
.\" against that, and send it to the Netpbm maintainer.
.TH "Pnmpsnr User Manual" 0 "23 January 2016" "netpbm documentation"

.SH NAME

pnmpsnr - compute the difference between two images (the PSNR)

.UN synopsis
.SH SYNOPSIS

\fBpnmpsnr\fP

[\fIpnmfile1\fP]

[\fIpnmfile2\fP]

[\fB-rgb\fP]
[\fB-machine\fP]
[\fB-max=\fP\fIn\fP]
.PP
Minimum unique abbreviations of options are acceptable.  You may use
double hyphens instead of single hyphen to denote options.  You may use
white space in place of the equals sign to separate an option name
from its value.


.UN description
.SH DESCRIPTION
.PP
This program is part of
.BR "Netpbm" (1)\c
\&.
.PP
\fBpnmpsnr\fP reads two PBM, PGM, or PPM files, or PAM equivalents, as
input and prints the magnitude of difference between the two images as a peak
signal-to-noise ratio (PSNR) This metric is typically used in image
compression papers to rate the distortion between original and decoded image.
.PP
If the inputs are PBM or PGM, \fBpnmpsnr\fP prints the PSNR of the
luminance only.  Otherwise, it prints the separate PSNRs of the
luminance, and chrominance (Cb and Cr) components of the colors.
.PP
The PSNR of a given component is the ratio of the maximum mean square
difference of component values that could exist between the two images (a
measure of the information content in an image) to the actual mean square
difference for the two subject images.  It is expressed as a decibel value.
.PP
The mean square difference of a component for two images is the
mean square difference of the component value, comparing each pixel
with the pixel in the same position of the other image.  For the
purposes of this computation, components are normalized to the scale
[0..1].
.PP
The maximum mean square difference is identically 1.
.PP
So the higher the PSNR, the closer the images are.  A luminance
PSNR of 20 means the mean square difference of the luminances of the
pixels is 100 times less than the maximum possible difference,
i.e. 0.01.
.PP
Note that the word "peak" is a misnomer; there is no maximum involved; the
metric is a mean.  But "peak signal to noise ratio" is for some reason the
common term for this measurement.
.PP
\fBpnmpsnr\fP reports the PSNR either in human-friendly form or in
machine-friendly form (see \fB-machine\fP).


.UN options
.SH OPTIONS


.TP
\fB-rgb\fP
This option causes \fBpnmpsnr\fP to compare the red, green, and blue
components of the color rather than the luminance and chrominance components.
It has no effect on a grayscale image.
.sp
This option was new in Netpbm 10.71 (June 2015).

.TP
\fB-machine\fP
This option causes \fBpnmpsnr\fP to report the PSNRs in machine-friendly
form, so another program can easily use the information.
.sp
The output is a single line.  It contains one floating point decimal number
for each color component, with a single space between every two.  (This means
there are either 1 or 3 numbers).  For the YCbCr color space (no \fB-rgb\fP),
they are in the order Y, Cb, Cr.  For the RGB color space (\fB-rgb\fP), they
are in R, G, B order.  For a grayscale image, there is one number.
.sp
Where the component does not differ between the images, so the PSNR is
infinite, the number is \fBinf\fP
.sp
But note that the number displayed is also modified by the effect of
\fB-max\fP.  In particular, with \fB-max\fP, you will never see
\fBinf\fP.
.sp
This option was new in Netpbm 10.74 (March 2016).

.TP
\fB-max=\fP\fIn\fP
This is meaningful only with \fB-machine\fP.
.sp
It specifies the maximum number \fBpnmpsnr\fP will print as a PSNR.
If the PSNR is greater than \fIn\fP, \fBpnmpsnr\fP just prints \fIn\fP.
\fIn\fP is a decimal floating point number.  An infinite PSNR is considered
greater than any number.
.sp
This is mainly useful to deal with infinite PSNRs.  It is often much more
convenient to have a program process only numbers than to make it deal with
infinity, and often a very large number has the same effect on a program as
infinity.
.sp
Note that the output is logarithmic, which means you will not see really
large but finite numbers.  If you specify \fB-max=1000\fP, the only way you
will see 1000 in the output is if the PSNR is really infinite.  Two images
with as many pixels as there are electrons in the universe, differing in only
one pixel, and only in the smallest amount representable in the Netpbm format,
have a PSNR less than 1000.
.sp
This option was new in Netpbm 10.74 (March 2016).




.UN seealso
.SH SEE ALSO
.BR "pnm" (5)\c
\&
.SH DOCUMENT SOURCE
This manual page was generated by the Netpbm tool 'makeman' from HTML
source.  The master documentation is at
.IP
.B http://netpbm.sourceforge.net/doc/pnmpsnr.html
.PP