1Panotools::Script(3)  User Contributed Perl Documentation Panotools::Script(3)
2
3
4

NAME

6       Panotools::Script - Panorama Tools scripting
7

SYNOPSIS

9       Read, write and manipulate hugin script files.
10

DESCRIPTION

12       Library and utilities for manipulating project files created by the
13       hugin photo stitching software.
14
15       This file format is shared with various other tools, in particular this
16       module is also capable of working with Panorama Tools script files.
17

USAGE

19         my $p = new Panotools::Script;
20
21         $p->Read ('/path/to/script.txt');
22
23         $p->Write ('/path/to/script.txt');
24
25       File paths in a Panorama Tools script file are generally relative to
26       the directory containing the script.  Modify this or otherwise prefix
27       the filenames by supplying an optional second argument:
28
29         $p->Write ('/path/to/script.txt', '../path/to/prefix/tofiles');
30
31       Clone a script object
32
33        $clone = $p->Clone;
34
35       Access various sections of the scriptfile:
36
37        $p->Mode;          # a L<Panotools::Script::Line::Mode> object
38        $p->Panorama;      # a L<Panotools::Script::Line::Panorama> object
39        $p->Variable;      # a L<Panotools::Script::Line::Variable> object
40
41        $p->Image;         # an array of L<Panotools::Script::Line::Image> objects
42        $p->Output;        # an array of L<Panotools::Script::Line::Output> objects
43        $p->Control;       # an array of L<Panotools::Script::Line::Control> objects
44        $p->ControlMorph;  # an array of L<Panotools::Script::Line::ControlMorph> objects
45
46       Rotate transform all the images in a project, angles in degrees:
47
48         $p->Transform ($roll, $pitch, $yaw);
49
50       'o' output lines are generated by PTOptimizer and contain stitching
51       parameters for each input image.  'i' image lines provide parameters
52       for optimisation as well as stitching.
53
54       Update the 'image' lines based on 'output' lines and vice-versa like
55       so:
56
57         $p->Output2Image;
58         $p->Image2Output;
59
60       Remove duplicate control points from the project, returns a list of
61       deleted points:
62
63         my $deleted = $p->Duplicates;
64
65       Remove all points with an error distance greater than a threshold
66       measured in pixels, returns a list of deleted points:
67
68         my $pruned = $p->Prune (12.345);
69
70       Extract a new object consisting of just the requested images, related
71       control points and optimisation settings:
72
73         my $subset = $p->Subset (1, 2, 34, 56);
74
75       Images can be requested in any order, but they will be returned in the
76       same order as the 'parent' project.
77
78       Merge a project with another:
79
80         $p->Merge ($newstuff);
81
82       This adds extra images from $newstuff, skipping duplicates.  All
83       control points except exact duplicates are imported regardless.
84
85       Get a summary of control point error distances in pixel units scaled to
86       the output panorama:
87
88         my ($total, $min, $max, $average, $sigma) = $p->Stats;
89
90       Centre input images into the final panorama:
91
92          $p->Centre ('y');
93          $p->Centre ('p');
94          $p->Centre ('r');
95
96       Split the project into exposure stacks based in roll, pitch & yaw, or
97       into exposure layers based on EV values:
98
99         $stacks = $pto->Stacks;
100         $layers = $pto->ExposureLayers;
101
102       Returns a list of image number lists.
103
104       e.g. extract the first stack as a new project:
105
106         $pto_stack = $pto->Subset (@{$pto->Stacks->[0]});
107
108       Split a project into exposure layers, returns a list of lists of image
109       ids:
110
111          my $layers = $pto->ExposureLayers (1.0);
112
113       Deafults to 0.5EV difference threshold.
114
115       Get a list of unconnected groups, i.e. a list of image id lists:
116
117         $groups = $pto->ConnectedGroups;
118
119         warn 'just one group' if scalar @{$groups} == 1;
120
121       Count the connections between any two images:
122
123         $points = $pto->Connections (3, 5);
124
125       Given a project with unlinked lens parameters, link them together with
126       the same lens number if all distortion, and photometric parameters
127       match:
128
129          $pto->UnifyLenses;
130
131       Given a project with stacks indicated by 'j' parameters, hard-link the
132       positions (only recognised by Hugin with layout mode code).
133
134          $pto->LinkStacks;
135
136       Return the angular distance in degrees between two images:
137
138         $deg = $pto->AngularDistance (3, 5);
139
140       Look at all photos and calculate an optimal pixel width for this
141       panorama, optionally supply a scaling factor:
142
143          $width = $pto->OptimalWidth (0.7);
144
145       This number is rounded up to the nearest multiple of 16 pixels.
146
147       Hugin ships with a tool called pano_trafo for querying the forward and
148       reverse transform for pixel coordinates in a PTO project.
149
150       Initialise this as a service, spawns two pano_trafo processes which are
151       only killed when the perl process finishes:
152
153         $pto->InitTrafo ('/path/to/project.pto');
154
155       This is very unlikely to work on non-unixy systems.
156
157       Query the forward transform like so:
158
159         ($X, $Y) = $pto->Trafo ($image_no, $x, $y);
160
161       Query the reverse transform like so:
162
163         ($x, $y) = $pto->TrafoReverse ($image_no, $X, $Y);
164
166       Copyright (c) 2001 Bruno Postle <bruno@postle.net>. All Rights
167       Reserved.
168
169       This program is free software; you can redistribute it and/or modify it
170       under the terms of the GNU General Public License as published by the
171       Free Software Foundation; either version 2 of the License, or (at your
172       option) any later version.
173
174       This software is distributed in the hope that it will be useful, but
175       WITHOUT ANY WARRANTY; without even the implied warranty of
176       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
177       General Public License for more details.
178
179       You should have received a copy of the GNU General Public License along
180       with this software; if not, write to the Free Software Foundation,
181       Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
182
183
184
185perl v5.30.0                      2019-07-26              Panotools::Script(3)
Impressum