Update manfix patch

This commit is contained in:
Josef Řídký 2021-01-26 15:44:47 +01:00
parent 8db855745f
commit 03a989cc4b

View File

@ -1500,3 +1500,502 @@ diff -urNp a/userguide/pamstereogram.html b/userguide/pamstereogram.html
</ul>
</body>
</html>
diff -urNp a/userguide/pamhomography.html b/userguide/pamhomography.html
--- a/userguide/pamhomography.html 2021-01-26 15:19:07.403345047 +0100
+++ b/userguide/pamhomography.html 2021-01-26 15:29:36.659652764 +0100
@@ -9,7 +9,7 @@
<body>
-<h1 id="pamhomography">pamhomography</h1>
+<h1>pamhomography</h1>
Updated: 03 January 2021
<br>
@@ -29,7 +29,7 @@ Updated: 03 January 2021
[<b>-mapfile</b>=<i>map_file</i>]
[<b>-view</b>=<i>coords</i>]
[<b>-fill</b>=<i>color</i>]
- [<i>pam_file</i>]
+ [<i>pam_file</i></p>]
<p>You can abbreviate any option to its shortest unique prefix. You can use
two hyphens instead of one to delimit an option. You can separate an option
@@ -42,7 +42,7 @@ from its value with whitespace instead o
of <a href="http://netpbm.sourceforge.net/">Netpbm</a>.</p>
<p><b>pamhomography</b> transforms a quadrilateral&mdash;not necessarily
-rectangular&mdash;region of an image, producing a new image.
+rectangular&mdash;region of an image, producing a new image.</p>
<p>You can do any
<a href="https://en.wikipedia.org/wiki/Affine_transformation#Image_transformation">affine image transformation</a>: translation, reflection, scaling,
@@ -111,9 +111,9 @@ quadrilateral.</p>
<p>This is the color with which the program fills all pixels that lie outside
of the target quadrilateral. Specify the color as described for the
<a href="http://libnetpbm_image.html#colorname">
-argument of the pnm_parsecolor() library routine</a>.
+argument of the pnm_parsecolor() library routine</a>.</p>
-<p>The default is black, and for images with a transparency plane, transparent.
+<p>The default is black, and for images with a transparency plane, transparent.</p>
</dd>
</dl>
@@ -132,7 +132,7 @@ by <i>map_file</i>.</p>
<p><b>pamhomography</b>'s only parameter, <i>pam_file</i>, is the name of the
file containing the input image. If you don't specify <i>pam_file</i>, the
- image comes from Standard Input.
+ image comes from Standard Input.</p>
<h2 id="NOTES">NOTES</h2>
@@ -260,23 +260,23 @@ preceding examples:</p>
<h2 id="SEE-ALSO">SEE ALSO</h2>
<ul>
- <li><a href="http://pamcut.html">pamcut</a>
- <li><a href="http://pamenlarge.html">pamenlarge</a>
- <li><a href="http://pamflip.html">pamflip</a>
- <li><a href="http://pamperspective.html">pamperspective</a>
- <li><a href="http://pamscale.html">pamscale</a>
- <li><a href="http://pamstretch.html">pamstretch</a>
- <li><a href="http://pam.html">pam</a>
- <li><a href="http://pnmmargin.html">pnmmargin</a>
- <li><a href="http://pnmpad.html">pnmpad</a>
- <li><a href="http://pnmrotate.html">pnmrotate</a>
- <li><a href="http://pnmshear.html">pnmshear</a>
+ <li><a href="http://pamcut.html">pamcut</a></li>
+ <li><a href="http://pamenlarge.html">pamenlarge</a></li>
+ <li><a href="http://pamflip.html">pamflip</a></li>
+ <li><a href="http://pamperspective.html">pamperspective</a></li>
+ <li><a href="http://pamscale.html">pamscale</a></li>
+ <li><a href="http://pamstretch.html">pamstretch</a></li>
+ <li><a href="http://pam.html">pam</a></li>
+ <li><a href="http://pnmmargin.html">pnmmargin</a></li>
+ <li><a href="http://pnmpad.html">pnmpad</a></li>
+ <li><a href="http://pnmrotate.html">pnmrotate</a></li>
+ <li><a href="http://pnmshear.html">pnmshear</a></li>
</ul>
<h2 id="SEE-ALSO">SEE ALSO</h2>
-<p><b>pamhomography</b> was new in Netpbm 10.94 (March 2021).
+<p><b>pamhomography</b> was new in Netpbm 10.94 (March 2021).</p>
<h2 id="AUTHOR">AUTHOR</h2>
diff -urNp a/userguide/pamhomography.1 b/userguide/pamhomography.1
--- a/userguide/pamhomography.1 1970-01-01 01:00:00.000000000 +0100
+++ b/userguide/pamhomography.1 2021-01-26 15:23:06.759944223 +0100
@@ -0,0 +1,407 @@
+\
+.\" 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 "pamhomography" 1 "03 January 2021" "netpbm documentation"
+
+
+
+
+<script type="text/javascript" src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
+<script type="text/javascript" id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
+.UN NAME
+.SH NAME
+.PP
+pamhomography - map one arbitrary quadrilateral image region to another
+
+
+.UN SYNOPSIS
+.SH SYNOPSIS
+.PP
+\fBpamhomography\fP
+ [\fB-from\fP=\fIcoords\fP]
+ [\fB-to\fP=\fIcoords\fP]
+ [\fB-mapfile\fP=\fImap_file\fP]
+ [\fB-view\fP=\fIcoords\fP]
+ [\fB-fill\fP=\fIcolor\fP]
+ [\fIpam_file\fP]
+.PP
+You can abbreviate any option to its shortest unique prefix. You can use
+two hyphens instead of one to delimit an option. You can separate an option
+from its value with whitespace instead of \f(CW=\fP.
+
+
+.UN DESCRIPTION
+.SH DESCRIPTION
+.PP
+This program is part
+of
+.UR http://netpbm.sourceforge.net/
+Netpbm
+.UE
+\&.
+.PP
+\fBpamhomography\fP transforms a quadrilateral-not necessarily
+rectangular-region of an image, producing a new image.
+.PP
+You can do any
+.UR https://en.wikipedia.org/wiki/Affine_transformation#Image_transformation
+affine image transformation
+.UE
+\&: translation, reflection, scaling,
+rotation, and shearing/skewing. However, \fBpamhomography\fP additionally can
+do \fIbilinear\fP transforms, which means it can warp any quadrilateral to any
+other quadrilateral, even when this mapping cannot be described using a single
+set of linear equations. This can be useful, for example, for creating
+perspective views of rectangular images or for reverse-mapping a perspective
+view back to a rectangular projection.
+
+
+.UN OPTIONS
+.SH OPTIONS
+.PP
+In addition to the options common to all programs based on libnetpbm (most
+notably \fB-quiet\fP, see
+.UR http://index.html#commonoptions
+Common Options
+.UE
+\&), \fBpamhomography\fP recognizes the following command line
+options:
+
+
+
+<dt id="from-coords">\fB-from\fP=\fIcoords\fP
+.sp
+This defines the source quadrilateral. \fIcoords\fP is a list of four
+ integer-valued (\fIx\fP, \fIy\fP) coordinates. If you do not
+ specify \fB-from\fP, the source quadrilateral is taken to be the four
+ corners of the input image in clockwise order, starting from the upper
+ left.
+
+
+<dt id="to-coords">\fB-to\fP=\fIcoords\fP
+.sp
+This defines the target quadrilateral. \fIcoords\fP is a list of four
+integer-valued (\fIx\fP, \fIy\fP) coordinates. If you do not
+specify \fB-to\fP, the target quadrilateral is taken to be the four corners
+of the input image in clockwise order, starting from the upper left.
+
+
+<dt id="mapfile-map_file">\fB-mapfile\fP=\fImap_file\fP
+.sp
+This names a text file that describes the mapping from the source to the
+target quadrilateral. The file \fImap_file\fP must contain either eight
+integer-valued (\fIx\fP, \fIy\fP) coordinates, being the four source
+coordinates followed by the corresponding four target coordinates, or only
+four (\fIx\fP, \fIy\fP) coordinates, being only the four target
+coordinates. In the latter case, the source quadrilateral is taken to be the
+four corners of the input image in clockwise order, starting from the upper
+left.
+
+
+<dt id="view-coords">\fB-view\fP=\fIcoords\fP
+.sp
+This defines the target view. \fIcoords\fP is a list of two integer-valued
+(\fIx\fP, \fIy\fP) coordinates: the upper left and lower right boundaries,
+respectively, of the pixels that will be visible in the output image. If
+\fB-view\fP is not specified, the target view will fit precisely the target
+quadrilateral.
+
+
+<dt id="fill-color">\fB-fill\fP=\fIcolor\fP
+.sp
+This is the color with which the program fills all pixels that lie outside
+of the target quadrilateral. Specify the color as described for the
+.UR http://libnetpbm_image.html#colorname
+ argument of the pnm_parsecolor() library routine
+.UE
+\&.
+.sp
+The default is black, and for images with a transparency plane, transparent.
+
+
+
+.PP
+Cooordinates should normally be specified in clockwise order. The syntax is
+fairly flexible: all characters other than the plus sign, minus sign, and
+digits are treated as separators. Although coordinates need to be integers,
+they may lie outside the image's boundary.
+.PP
+If you specify \fB-mapfile\fP along with \fB-from\fP and/or \fB-to\fP,
+\fB-from\fP and \fB-to\fP override the quadrilaterals specified
+by \fImap_file\fP.
+
+
+.UN PARAMETERS
+.SH PARAMETERS
+.PP
+\fBpamhomography\fP's only parameter, \fIpam_file\fP, is the name of the
+ file containing the input image. If you don't specify \fIpam_file\fP, the
+ image comes from Standard Input.
+
+
+.UN NOTES
+.SH NOTES
+.PP
+The output image uses the same Netpbm format as the input image.
+.PP
+Simple transformations are best handled by other Netpbm programs, such as
+those listed in the
+.UR #SEE-ALSO
+\&'SEE ALSO'
+.UE
+\& section
+below. Use \fBpamhomography\fP for more sophisticated transformations such as
+perspective adjustments, rotations around an arbitrary point in the image,
+extraction of non-rectangular quadrilaterals, shearings by coordinates rather
+than by angle, and, in general, all transformations that are most easily
+expressed as mapping four points in one image to four points in another
+image.
+
+.UN EXAMPLES
+.SH EXAMPLES
+.PP
+The following examples use the
+.UR park_row.ppm
+park_row.ppm
+.UE
+\& test image, which is a
+.UR https://commons.wikimedia.org/wiki/File:15_Park_Row_3.JPG
+ photograph of New York City's Park Row Building
+.UE
+\&, scaled to
+441&times;640, converted to a PPM file, and redistributed under the terms of
+the
+.UR https://en.wikipedia.org/wiki/GNU_Free_Documentation_License
+ GFDL
+.UE
+\&.
+.PP
+The first example showcases the real power of bilinear transformations.
+Assuming \fIpark_row_rect.map\fP has the following contents:
+
+.nf\f(CW (147, 51) (316, 105) (402, 595) (92, 560)
+ (0, 0) (440, 0) (440, 639) (0, 639)\fP</pre>
+.PP
+then
+
+.nf\f(CW pamhomography -mapfile park_row_rect.map park_row.ppm > park_row_rect.ppm\fP</pre>
+.PP
+projects the building's facade from a perspective view to a rectilinear
+front-on view. Remember that \fBpamhomography\fP ignores the parentheses and
+commas used in \fIpark_row_rect.map\fP; they merely make the file more
+human-readable. We equivalently could have written
+
+.nf\f(CW 147 51 316 105 402 595 92 560 0 0 440 0 440 639 0 639\fP</pre>
+.PP
+or any of myriad other variations.
+.PP
+\fBpamhomography\fP can warp the image to a trapezoid to make it look like
+it's leaning backwards in 3-D:
+
+.nf\f(CW pamhomography -to '50,0 390,0 440,200 0,200' park_row.ppm > park_row_trap.ppm\fP</pre>
+.PP
+As a very simple example,
+
+.nf\f(CW pamhomography -to '440,0 0,0 0,639 440,639' park_row.ppm > park_row_flip.ppm\fP</pre>
+.PP
+flips the image left-to-right. Note that in this case the target
+quadrilateral's coordinates are listed in counterclockwise order because
+that represents the correspondence between points (0, 0) &harr; (440, 0) and
+(0, 639) &harr; (639, 0).
+.PP
+Scaling is also straightforward. The following command scales down the
+image from 441&times;640 to 341&times;540:
+
+.nf\f(CW pamhomography -to '0,0 340,0 340,539 0,539' park_row.ppm > park_row_small.ppm\fP</pre>
+.PP
+Let's add 100 pixels of tan border to the above. We use \fB-view\fP and
+\fB-fill\fP to accomplish that task:
+
+.nf\f(CW pamhomography -to '0,0 340,0 340,539 0,539' -view '-100,-100 440,639' -fill tan park_row.ppm > park_row_small_border.ppm\fP</pre>
+.PP
+We can add a border without having to scale the image:
+
+.nf\f(CW pamhomography -view '-100,-100 540,739' -fill tan park_row.ppm > park_row_border.ppm\fP</pre>
+.PP
+The \fB-view\fP option can also be used to extract a rectangle out of an
+image, discarding the rest of the image:
+
+.nf\f(CW pamhomography -view '130,10 205,80' park_row.ppm > park_row_cut.ppm\fP</pre>
+.PP
+Specifying the same set of coordinates to \fB-from\fP and \fB-to\fP has
+the same effect but also allows you to extract non-rectangular quadrilaterals
+from an image:
+
+.nf\f(CW pamhomography -from '185,300 310,325 320,425 180,405' -to '185,300 310,325 320,425 180,405' park_row.ppm > park_row_cut_2.ppm\fP</pre>
+.PP
+Rotation is doable but takes some effort. The challenge is that you need to
+compute the rotated coordinates yourself. The matrix expression to rotate
+points \e((x_1, y_1)\e) \e((x_2, y_2)\e), \e((x_3, y_3)\e), and \e((x_4, y_4)\e)
+clockwise by \e(\etheta\e) degrees around point \e((c_x, c_y)\e) is
+.PP
+\e[ \ebegin{bmatrix} 1 & 0 & c_x \e\e 0 & 1 & c_y \e\e 0 & 0
+& 1 \eend{bmatrix} \ebegin{bmatrix} \ecos \etheta & -\esin \etheta & 0
+\e\e \esin \etheta & \ecos \etheta & 0 \e\e 0 & 0 & 1 \eend{bmatrix}
+\ebegin{bmatrix} 1 & 0 & -c_x \e\e 0 & 1 & -c_y \e\e 0 & 0
+& 1 \eend{bmatrix} \ebegin{bmatrix} x_1 & x_2 & x_3 & x_4 \e\e y_1
+& y_2 & y_3 & y_4 \e\e 1 & 1 & 1 & 1 \eend{bmatrix}
+\equad. \e]
+.PP
+For example, to rotate \fIpark_row.ppm\fP 30&deg; clockwise around (220,
+320) you would compute
+.PP
+\e[ \ebegin{bmatrix} 1 & 0 & 220 \e\e 0 & 1 & 320 \e\e 0 & 0
+& 1 \eend{bmatrix} \ebegin{bmatrix} \ecos 30^{\ecirc} & -\esin 30^{\ecirc}
+& 0 \e\e \esin 30^{\ecirc} & \ecos 30^{\ecirc} & 0 \e\e 0 & 0 & 1
+\eend{bmatrix} \ebegin{bmatrix} 1 & 0 & -220 \e\e 0 & 1 & -320 \e\e
+0 & 0 & 1 \eend{bmatrix} \ebegin{bmatrix} 0 & 440 & 440 & 0
+\e\e 0 & 0 & 639 & 639 \e\e 1 & 1 & 1 & 1 \eend{bmatrix} =
+\ebegin{bmatrix} 189.4744 & 570.5256 & 251.0256 & -130.0256 \e\e
+-67.1281 & 152.8719 & 706.2621 & 486.2621 \e\e 1.0000 & 1.0000
+& 1.0000 & 1.0000 \eend{bmatrix} \equad, \e]
+.PP
+round these coordinates to integers, transpose the matrix, and produce the
+following map file, \fIpark_row_rot30.map\fP:
+
+.nf\f(CW 189 -67
+ 571 153
+ 251 706
+ -130 486\fP</pre>
+.PP
+(These are the 'to' coordinates; we use the default, full-image
+\&'from' coordinates.) The mapping then works as in all of the
+preceding examples:
+
+.nf\f(CW pamhomography -mapfile park_row_rot30.map park_row.ppm > park_row_rot30.ppm\fP</pre>
+
+
+.UN SEE-ALSO
+.SH SEE ALSO
+
+
+.IP \(bu
+
+.BR "pamcut" (1)\c
+\&
+.IP \(bu
+
+.BR "pamenlarge" (1)\c
+\&
+.IP \(bu
+
+.BR "pamflip" (1)\c
+\&
+.IP \(bu
+
+.BR "pamperspective" (1)\c
+\&
+.IP \(bu
+
+.BR "pamscale" (1)\c
+\&
+.IP \(bu
+
+.BR "pamstretch" (1)\c
+\&
+.IP \(bu
+
+.BR "pam" (1)\c
+\&
+.IP \(bu
+
+.BR "pnmmargin" (1)\c
+\&
+.IP \(bu
+
+.BR "pnmpad" (1)\c
+\&
+.IP \(bu
+
+.BR "pnmrotate" (1)\c
+\&
+.IP \(bu
+
+.BR "pnmshear" (1)\c
+\&
+
+
+
+.UN SEE-ALSO
+.SH SEE ALSO
+.PP
+\fBpamhomography\fP was new in Netpbm 10.94 (March 2021).
+
+
+.UN AUTHOR
+.SH AUTHOR
+.PP
+Copyright \(co 2020 Scott
+Pakin, \fIscott+pbm@pakin.org\fP
+
+
+.UN index
+.SH Table of Contents
+
+
+.IP \(bu
+
+.UR #SYNOPSIS
+SYNOPSIS
+.UE
+\&
+.IP \(bu
+
+.UR #DESCRIPTION
+DESCRIPTION
+.UE
+\&
+.IP \(bu
+
+.UR #OPTIONS
+OPTIONS
+.UE
+\&
+.IP \(bu
+
+.UR #PARAMETERS
+PARAMETERS
+.UE
+\&
+.IP \(bu
+
+.UR #NOTES
+NOTES
+.UE
+\&
+.IP \(bu
+
+.UR #EXAMPLES
+EXAMPLES
+.UE
+\&
+.IP \(bu
+
+.UR #SEE-ALSO
+SEE ALSO
+.UE
+\&
+.IP \(bu
+
+.UR #HISTORY
+HISTORY
+.UE
+\&
+.IP \(bu
+
+.UR #AUTHOR
+AUTHOR
+.UE
+\&
+.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/pamhomography.html
+.PP
\ Chybí znak konce řádku na konci souboru