.\" This man page was generated by the Netpbm tool 'makeman' from HTML source. pamhomography - Online Linux Manual PageSection : 1
Updated : 03 January 2021
Source : 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>
NAMEpamhomography - map one arbitrary quadrilateral image region to another .UN SYNOPSIS

SYNOPSISpamhomography
  [
-from=coords]
  [
-to=coords]
  [
-mapfile=map_file]
  [
-view=coords]
  [
-fill=color]
  [
pam_file]
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 =. .UN DESCRIPTION

DESCRIPTIONThis program is part of Netpbm ​. pamhomography transforms a quadrilateral-not necessarily rectangular-region of an image, producing a new image. You can do any affine image transformation ​: translation, reflection, scaling, rotation, and shearing/skewing. However, pamhomography additionally can do bilinear 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

OPTIONSIn addition to the options common to all programs based on libnetpbm (most notably -quiet, see Common Options ), pamhomography recognizes the following command line options: -from=coords  This defines the source quadrilateral. coords is a list of four
  integer-valued (
x, y) coordinates. If you do not
  specify
-from, the source quadrilateral is taken to be the four
  corners of the input image in clockwise order, starting from the upper
  left.
-to=coords  This defines the target quadrilateral. coords is a list of four integer-valued (x, y) coordinates. If you do not specify -to, the target quadrilateral is taken to be the four corners of the input image in clockwise order, starting from the upper left. -mapfile=map_file  This names a text file that describes the mapping from the source to the target quadrilateral. The file map_file must contain either eight integer-valued (x, y) coordinates, being the four source coordinates followed by the corresponding four target coordinates, or only four (x, y) 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. -view=coords  This defines the target view. coords is a list of two integer-valued (x, y) coordinates: the upper left and lower right boundaries, respectively, of the pixels that will be visible in the output image. If -view is not specified, the target view will fit precisely the target quadrilateral. -fill=color  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
 argument of the pnm_parsecolor() library routine
​. The default is black, and for images with a transparency plane, transparent.
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. If you specify -mapfile along with -from and/or -to, -from and -to override the quadrilaterals specified by map_file. .UN PARAMETERS

PARAMETERSpamhomography's only parameter, pam_file, is the name of the
  file containing the input image. If you don't specify
pam_file, the
  image comes from Standard Input. .UN NOTES

NOTESThe output image uses the same Netpbm format as the input image. Simple transformations are best handled by other Netpbm programs, such as those listed in the 'SEE ALSO' ​ section below. Use pamhomography 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

EXAMPLESThe following examples use the park_row.ppm ​ test image, which is a
 photograph of New York City's Park Row Building
​, scaled to 441×640, converted to a PPM file, and redistributed under the terms of the
 GFDL
​.
The first example showcases the real power of bilinear transformations. Assuming park_row_rect.map has the following contents: .nf (147, 51) (316, 105) (402, 595) (92, 560)
      (0, 0) (440, 0) (440, 639) (0, 639)
.fi
then .nf pamhomography -mapfile park_row_rect.map park_row.ppm > park_row_rect.ppm .fi projects the building's facade from a perspective view to a rectilinear front-on view. Remember that pamhomography ignores the parentheses and commas used in park_row_rect.map; they merely make the file more human-readable. We equivalently could have written .nf 147 51 316 105 402 595 92 560 0 0 440 0 440 639 0 639 .fi or any of myriad other variations. pamhomography can warp the image to a trapezoid to make it look like it's leaning backwards in 3-D: .nf pamhomography -to '50,0 390,0 440,200 0,200' park_row.ppm > park_row_trap.ppm .fi As a very simple example, .nf pamhomography -to '440,0 0,0 0,639 440,639' park_row.ppm > park_row_flip.ppm .fi 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)(440, 0) and (0, 639)(639, 0). Scaling is also straightforward. The following command scales down the image from 441×640 to 341×540: .nf pamhomography -to '0,0 340,0 340,539 0,539' park_row.ppm > park_row_small.ppm .fi Let's add 100 pixels of tan border to the above. We use -view and -fill to accomplish that task: .nf 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 .fi We can add a border without having to scale the image: .nf pamhomography -view '-100,-100 540,739' -fill tan park_row.ppm > park_row_border.ppm .fi The -view option can also be used to extract a rectangle out of an image, discarding the rest of the image: .nf pamhomography -view '130,10 205,80' park_row.ppm > park_row_cut.ppm .fi Specifying the same set of coordinates to -from and -to has the same effect but also allows you to extract non-rectangular quadrilaterals from an image: .nf 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 .fi 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 \((x_1, y_1)\) \((x_2, y_2)\), \((x_3, y_3)\), and \((x_4, y_4)\) clockwise by \(\theta\) degrees around point \((c_x, c_y)\) is \[ \begin{bmatrix} 1 & 0 & c_x \\ 0 & 1 & c_y \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} \cos \theta & -\sin \theta & 0 \\ \sin \theta & \cos \theta & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} 1 & 0 & -c_x \\ 0 & 1 & -c_y \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} x_1 & x_2 & x_3 & x_4 \\ y_1 & y_2 & y_3 & y_4 \\ 1 & 1 & 1 & 1 \end{bmatrix} \quad. \] For example, to rotate park_row.ppm 30° clockwise around (220, 320) you would compute \[ \begin{bmatrix} 1 & 0 & 220 \\ 0 & 1 & 320 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} \cos 30^{\circ} & -\sin 30^{\circ} & 0 \\ \sin 30^{\circ} & \cos 30^{\circ} & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} 1 & 0 & -220 \\ 0 & 1 & -320 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} 0 & 440 & 440 & 0 \\ 0 & 0 & 639 & 639 \\ 1 & 1 & 1 & 1 \end{bmatrix} = \begin{bmatrix} 189.4744 & 570.5256 & 251.0256 & -130.0256 \\ -67.1281 & 152.8719 & 706.2621 & 486.2621 \\ 1.0000 & 1.0000 & 1.0000 & 1.0000 \end{bmatrix} \quad, \] round these coordinates to integers, transpose the matrix, and produce the following map file, park_row_rot30.map: .nf 189 -67
     571 153
     251 706
    -130 486
.fi
(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 pamhomography -mapfile park_row_rot30.map park_row.ppm > park_row_rot30.ppm .fi .UN SEE-ALSO

SEE ALSO• "pamcut(1)• "pamenlarge(1)• "pamflip(1)• "pamperspective(1)• "pamscale(1)• "pamstretch(1)• "pam(1)• "pnmmargin(1)• "pnmpad(1)• "pnmrotate(1)• "pnmshear(1).UN HISTORY

HISTORYpamhomography was new in Netpbm 10.94 (March 2021). .UN AUTHOR

AUTHORCopyright © 2020 Scott Pakin, scott+pbm@pakin.org .UN index

Table of Contents• SYNOPSIS • DESCRIPTION • OPTIONS • PARAMETERS • NOTES • EXAMPLES • SEE ALSO • HISTORY • AUTHOR

DOCUMENT SOURCEThis manual page was generated by the Netpbm tool 'makeman' from HTML source. The master documentation is at http://netpbm.sourceforge.net/doc/pamhomography.html
0
Johanes Gumabo
Data Size   :   40,837 byte
man-pamhomography.1Build   :   2024-12-29, 07:25   :  
Visitor Screen   :   x
Visitor Counter ( page / site )   :   3 / 258,754
Visitor ID   :     :  
Visitor IP   :   3.129.70.153   :  
Visitor Provider   :   AMAZON-02   :  
Provider Position ( lat x lon )   :   39.962500 x -83.006100   :   x
Provider Accuracy Radius ( km )   :   1000   :  
Provider City   :   Columbus   :  
Provider Province   :   Ohio ,   :   ,
Provider Country   :   United States   :  
Provider Continent   :   North America   :  
Visitor Recorder   :   Version   :  
Visitor Recorder   :   Library   :  
Online Linux Manual Page   :   Version   :   Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.29
Online Linux Manual Page   :   Library   :   lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page   :   Library   :   lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base   :   Version   :   Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base   :   Library   :   lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36

Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.

ERROR : Need New Coding :         (rof_escape_sequence|91|pamhomography.1|1/2|\" This man page was generated by the Netpbm tool 'makeman' from HTML source. |.\" This man page was generated by the Netpbm tool 'makeman' from HTML source. )         (parse_manual_page_|252|pamhomography.1|1/2|\"|.\" This man page was generated by the Netpbm tool 'makeman' from HTML source. )         (parse_manual_page_|252|pamhomography.1|18|UN|.UN SYNOPSIS )         (parse_manual_page_|252|pamhomography.1|34|UN|.UN DESCRIPTION )         (parse_manual_page_|252|pamhomography.1|60|UN|.UN OPTIONS )         (parse_manual_page_|252|pamhomography.1|140|UN|.UN PARAMETERS )         (parse_manual_page_|252|pamhomography.1|148|UN|.UN NOTES )         (parse_manual_page_|252|pamhomography.1|166|UN|.UN EXAMPLES )         (parse_manual_page_|252|pamhomography.1|188|nf══──══f(CW|.nf\f(CW (147, 51) (316, 105) (402, 595) (92, 560) )         (rof_fi|19|pamhomography.1|190|1|.fi )         (parse_manual_page_|252|pamhomography.1|194|nf══──══f(CW|.nf\f(CW pamhomography -mapfile park_row_rect.map park_row.ppm > park_row_rect.ppm\fP )         (rof_fi|19|pamhomography.1|195|1|.fi )         (parse_manual_page_|252|pamhomography.1|202|nf══──══f(CW|.nf\f(CW 147 51 316 105 402 595 92 560 0 0 440 0 440 639 0 639\fP )         (rof_fi|19|pamhomography.1|203|1|.fi )         (parse_manual_page_|252|pamhomography.1|210|nf══──══f(CW|.nf\f(CW pamhomography -to '50,0 390,0 440,200 0,200' park_row.ppm > park_row_trap.ppm\fP )         (rof_fi|19|pamhomography.1|211|1|.fi )         (parse_manual_page_|252|pamhomography.1|215|nf══──══f(CW|.nf\f(CW pamhomography -to '440,0 0,0 0,639 440,639' park_row.ppm > park_row_flip.ppm\fP )         (rof_fi|19|pamhomography.1|216|1|.fi )         (parse_manual_page_|252|pamhomography.1|226|nf══──══f(CW|.nf\f(CW pamhomography -to '0,0 340,0 340,539 0,539' park_row.ppm > park_row_small.ppm\fP )         (rof_fi|19|pamhomography.1|227|1|.fi )         (parse_manual_page_|252|pamhomography.1|232|nf══──══f(CW|.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 )         (rof_fi|19|pamhomography.1|233|1|.fi )         (parse_manual_page_|252|pamhomography.1|237|nf══──══f(CW|.nf\f(CW pamhomography -view '-100,-100 540,739' -fill tan park_row.ppm > park_row_border.ppm\fP )         (rof_fi|19|pamhomography.1|238|1|.fi )         (parse_manual_page_|252|pamhomography.1|243|nf══──══f(CW|.nf\f(CW pamhomography -view '130,10 205,80' park_row.ppm > park_row_cut.ppm\fP )         (rof_fi|19|pamhomography.1|244|1|.fi )         (parse_manual_page_|252|pamhomography.1|250|nf══──══f(CW|.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 )         (rof_fi|19|pamhomography.1|251|1|.fi )         (parse_manual_page_|252|pamhomography.1|282|nf══──══f(CW|.nf\f(CW 189 -67 )         (rof_fi|19|pamhomography.1|286|1|.fi )         (parse_manual_page_|252|pamhomography.1|292|nf══──══f(CW|.nf\f(CW pamhomography -mapfile park_row_rot30.map park_row.ppm > park_row_rot30.ppm\fP )         (rof_fi|19|pamhomography.1|293|1|.fi )         (parse_manual_page_|252|pamhomography.1|296|UN|.UN SEE-ALSO )         (parse_manual_page_|252|pamhomography.1|347|UN|.UN HISTORY )         (parse_manual_page_|252|pamhomography.1|353|UN|.UN AUTHOR )         (parse_manual_page_|252|pamhomography.1|360|UN|.UN index )