From: <bru...@us...> - 2009-12-22 01:33:36
|
Revision: 1195 http://panotools.svn.sourceforge.net/panotools/?rev=1195&view=rev Author: brunopostle Date: 2009-12-22 00:15:42 +0000 (Tue, 22 Dec 2009) Log Message: ----------- New tool for control point finding multi-row panoramas. Not really tested... Modified Paths: -------------- trunk/Panotools-Script/Changes trunk/Panotools-Script/MANIFEST trunk/Panotools-Script/Makefile.PL trunk/Panotools-Script/dos/make_exe.pl trunk/Panotools-Script/lib/Panotools/Script.pm Added Paths: ----------- trunk/Panotools-Script/bin/gigastart Modified: trunk/Panotools-Script/Changes =================================================================== --- trunk/Panotools-Script/Changes 2009-12-21 00:12:59 UTC (rev 1194) +++ trunk/Panotools-Script/Changes 2009-12-22 00:15:42 UTC (rev 1195) @@ -6,6 +6,7 @@ - new tool: ptobind - Join the ends of linked photos in a Hugin project - new tool: ptofill - add control points to a Hugin project between likely overlapping photos - new tool: pto2mk2 - Create a Makefile for stitching + - new tool: gigastart - assemble multi-row panoramas - rewrite panostart to use ptoanchor - rewrite match-n-shift to use ptoanchor - bugfix: crash in Subset() when project has no image metadata Modified: trunk/Panotools-Script/MANIFEST =================================================================== --- trunk/Panotools-Script/MANIFEST 2009-12-21 00:12:59 UTC (rev 1194) +++ trunk/Panotools-Script/MANIFEST 2009-12-22 00:15:42 UTC (rev 1195) @@ -8,6 +8,7 @@ bin/erect2planet bin/erect2qtvr bin/erect2qtvr-gui +bin/gigastart bin/jpeg2qtvr bin/match-n-shift bin/nona-mask Modified: trunk/Panotools-Script/Makefile.PL =================================================================== --- trunk/Panotools-Script/Makefile.PL 2009-12-21 00:12:59 UTC (rev 1194) +++ trunk/Panotools-Script/Makefile.PL 2009-12-22 00:15:42 UTC (rev 1195) @@ -6,7 +6,7 @@ 'EXE_FILES' => [ 'bin/cubic2erect', 'bin/erect2cubic', 'bin/pafextract', 'bin/pto2mk2', 'bin/jpeg2qtvr', 'bin/erect2qtvr', 'bin/enblend-mask', 'bin/match-n-shift', 'bin/ptoset', 'bin/process-masks', 'bin/erect2planet', 'bin/ptograph', 'bin/ptoget', 'bin/enfuse-mask', - 'bin/ptochain', 'bin/ptobind', 'bin/ptofill', + 'bin/ptochain', 'bin/ptobind', 'bin/ptofill', 'bin/gigastart', 'bin/tif2svg', 'bin/enblend-svg', 'bin/ptoinfo', 'bin/ptopath', 'bin/ptodummy', 'bin/ptoanchor', 'bin/qtvr2erect-gui', 'bin/tif2svg-gui', 'bin/ptoinfo-gui', 'bin/ptosort', 'bin/ptovariable', 'bin/process-masks-gui', 'bin/enblend-svg-gui', 'bin/erect2qtvr-gui', 'bin/ptoclean', Added: trunk/Panotools-Script/bin/gigastart =================================================================== --- trunk/Panotools-Script/bin/gigastart (rev 0) +++ trunk/Panotools-Script/bin/gigastart 2009-12-22 00:15:42 UTC (rev 1195) @@ -0,0 +1,198 @@ +#!/usr/bin/perl + +use strict; +use warnings; +use Getopt::Long; +use Pod::Usage; +use Panotools::Makefile; +use Panotools::Photos; + +my $path_makefile; +my $deg_fov; +my $help = 0; + +my @argv_save = @ARGV; +my $mk = new Panotools::Makefile; + +GetOptions ('o|output=s' => \$path_makefile, + 'v|fov=s' => \$deg_fov, + 'h|help' => \$help); + +pod2usage (-verbose => 2) if $help; +pod2usage (2) unless scalar @ARGV > 1; +$path_makefile = 'Makefile' unless defined $path_makefile; + +my $rule = $mk->Rule ('.PHONY'); +$rule->Prerequisites (qw/all pointless chained bound filled cleaned pto/); + +$rule = $mk->Rule ('all'); +$rule->Prerequisites ('pto'); + +# some variable definitions + +$mk->Variable ('MAKE_EXTRA_ARGS'); +$mk->Variable ('PTO2MK', 'pto2mk'); +$mk->Variable ('MATCHNSHIFT', 'match-n-shift'); +$mk->Variable ('PTOMERGE', 'ptomerge'); +$mk->Variable ('PTOCHAIN', 'ptochain'); +$mk->Variable ('PTOBIND', 'ptobind'); +$mk->Variable ('PTOVARIABLE', 'ptovariable'); +$mk->Variable ('PTOFILL', 'ptofill'); +$mk->Variable ('AUTOOPTIMISER', 'autooptimiser'); +$mk->Variable ('CPCLEAN', 'cpclean'); + +my $all_photos = new Panotools::Photos (@ARGV); + +$mk->Variable ('INPUT_IMAGES', $all_photos->Paths); +$mk->Variable ('PREFIX', $all_photos->Stub); + +# some phony targets, prerequisites will be populated later + +$rule = $mk->Rule ('pointless'); +$rule->Prerequisites ('$(PREFIX).pointless.pto'); +$rule = $mk->Rule ('chained'); +$rule->Prerequisites ('$(PREFIX).chained.pto'); +$rule = $mk->Rule ('bound'); +$rule->Prerequisites ('$(PREFIX).bound.pto'); +$rule = $mk->Rule ('placed'); +$rule->Prerequisites ('$(PREFIX).placed.pto'); +$rule = $mk->Rule ('filled'); +$rule->Prerequisites ('$(PREFIX).filled.pto'); +$rule = $mk->Rule ('cleaned'); +$rule->Prerequisites ('$(PREFIX).cleaned.pto'); +$rule = $mk->Rule ('pto'); +$rule->Prerequisites ('$(PREFIX).pto'); + +$mk->Comment ('Create a pointless project file from a list of photos'); +$rule = $mk->Rule ('$(PREFIX).pointless.pto'); +$rule->Prerequisites ('$(INPUT_IMAGES)'); + +my @command = ('$(MATCHNSHIFT_SHELL)', '--output', '$(PREFIX).pointless.pto', '--noransac'); +push @command, ('--fov', $deg_fov) if defined $deg_fov; +push @command, ('$(INPUT_IMAGES_SHELL)'); +$rule->Command (@command); + +$mk->Comment ('Add points between consecutive photos'); +$rule = $mk->Rule ('$(PREFIX).chained.mk', '$(PREFIX).chained.pto'); +$rule->Prerequisites ('$(INPUT_IMAGES)', '$(PREFIX).pointless.pto'); +$rule->Command ('$(PTOCHAIN_SHELL)', '--makefile', '$(PREFIX).chained.mk', + '--output', '$(PREFIX).chained.pto', '$(PREFIX).pointless.pto'); +$rule->Command ('$(MAKE)', '-e', '-f', '$(PREFIX).chained.mk', '$(PREFIX).chained.pto'); + +$mk->Comment ('Try and connect ends of chains'); +$rule = $mk->Rule ('$(PREFIX).bound.mk', '$(PREFIX).bound.pto'); +$rule->Prerequisites ('$(INPUT_IMAGES)', '$(PREFIX).chained.pto'); +$rule->Command ('$(PTOBIND_SHELL)', '--makefile', '$(PREFIX).bound.mk', + '--output', '$(PREFIX).bound.pto', '$(PREFIX).chained.pto'); +$rule->Command ('$(MAKE)', '-e', '-f', '$(PREFIX).bound.mk', '$(PREFIX).bound.pto'); +$rule->Command ('$(PTOVARIABLE_SHELL)', '--pitch', '--yaw', '$(PREFIX).bound.pto'); + +$mk->Comment ('Optimise approximate positions'); +$rule = $mk->Rule ('$(PREFIX).placed.1.pto', '$(PREFIX).placed.pto'); +$rule->Prerequisites ('$(PREFIX).bound.pto', '$(PREFIX).pointless.pto'); +$rule->Command ('$(AUTOOPTIMISER_SHELL)', '-n', '-l', '-o', '$(PREFIX).placed.1.pto', '$(PREFIX).bound.pto'); +$rule->Command ('$(PTOMERGE_SHELL)', '$(PREFIX).placed.1.pto', '$(PREFIX).pointless.pto', '$(PREFIX).placed.pto'); + +$mk->Comment ('Add points to overlapping pairs'); +$rule = $mk->Rule ('$(PREFIX).filled.mk', '$(PREFIX).filled.pto'); +$rule->Prerequisites ('$(INPUT_IMAGES)', '$(PREFIX).placed.pto'); +$rule->Command ('$(PTOFILL_SHELL)', '--makefile', '$(PREFIX).filled.mk', '-f', '1.0', + '--output', '$(PREFIX).filled.pto', '$(PREFIX).placed.pto'); +$rule->Command ('$(MAKE)', '-e', '-f', '$(PREFIX).filled.mk', '$(PREFIX).filled.pto'); + +$mk->Comment ('Clean unlikely control points'); +$rule = $mk->Rule ('$(PREFIX).cleaned.pto'); +$rule->Prerequisites ('$(PREFIX).filled.pto'); +$rule->Command ('$(CPCLEAN_SHELL)', '-o', '$(PREFIX).cleaned.pto', '$(PREFIX).filled.pto'); + +$mk->Comment ('Optimise final positions'); +$rule = $mk->Rule ('$(PREFIX).pto'); +$rule->Prerequisites ('$(PREFIX).cleaned.pto'); +$rule->Command ('$(AUTOOPTIMISER_SHELL)', '-a', '-l', '-s', '-o', '$(PREFIX).pto', '$(PREFIX).cleaned.pto'); + +$mk->Comment ('Normal seam blended output'); +$rule = $mk->Rule ('$(PREFIX).pto.mk', '$(PREFIX).tif'); +$rule->Prerequisites ('$(PREFIX).pto', '$(INPUT_IMAGES)'); +$rule->Command ('$(PTO2MK_SHELL)', '-o', '$(PREFIX).pto.mk', '-p', '$(PREFIX)', '$(PREFIX).pto'); +$rule->Command ('$(MAKE)', '-e', '-f', '$(PREFIX).pto.mk', '$(PREFIX).tif', '$(MAKE_EXTRA_ARGS_SHELL)'); + +$rule = $mk->Rule; +$rule->Targets ($path_makefile); +$rule->Prerequisites (@ARGV); +$rule->Command ($0, @argv_save); + +$mk->Write ($path_makefile); + +__END__ + +=head1 NAME + +gigastart - assemble multi-row panoramas + +=head1 SYNOPSIS + +gigastart [options] image1 image2 [...] + + Options: + -o | --output name Filename of created Makefile. Otherwise defaults + to 'Makefile' + -v | --fov Horizontal field of view in degrees. Otherwise + will be calculated from EXIF info. + -h | --help Outputs help documentation. + +=head1 DESCRIPTION + +B<gigastart> takes a list of image files and creates a Makefile +containing rules to generate a single panorama from the images. + +It utilises a multi-step strategy: + +1. Consecutive pairs of photos are linked into one or more chains. +2. Photos from the ends of each chain are linked if possible. +3. Photos are placed in a rough grid with approximate positions. +4. overlapping images with no links are linked if possible. +5. Positions are optimised + +This approach has some advantages: + +The number of connections checked is directly proportional to the number of +images, so a 200 photo panorama should take twice as long as a 100 photo +panorama. + +Different shooting strategies are supported: multi-row, zig-zag, +middle-top-bottom row-ordering, different number of photos in each row, +multiple angle-of-view. + +Feature points are only identified once per photo and are reused. + +The process is very suited to parallel processing, simply set the maximum +number of processes by redefining the $MAKE built-in variable, e.g: + + make MAKE='make -j 16' + +Each step and photo pair is written as an intermediate .pto project, so any +problems can be fixed at this level, rerunning make will only repeat work +required to integrate those changes - The entire process does not need to be +rerun. + +A disadvantage is that features are identified by B<generatekeys> and matched +by B<autopano> from the B<autopano-sift-C> package. These features are saved +in a verbose XML file format which adds a significant IO overhead, a future +improvement could be to use a different caching format for these files. + +=head1 LICENSE + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +=head1 SEE ALSO + +L<http://hugin.sourceforge.net/> + +=head1 AUTHOR + +Bruno Postle - December 2009. + +=cut Property changes on: trunk/Panotools-Script/bin/gigastart ___________________________________________________________________ Added: svn:executable + * Modified: trunk/Panotools-Script/dos/make_exe.pl =================================================================== --- trunk/Panotools-Script/dos/make_exe.pl 2009-12-21 00:12:59 UTC (rev 1194) +++ trunk/Panotools-Script/dos/make_exe.pl 2009-12-22 00:15:42 UTC (rev 1195) @@ -14,6 +14,7 @@ erect2mercator erect2planet erect2qtvr +gigastart jpeg2qtvr match-n-shift nona-mask Modified: trunk/Panotools-Script/lib/Panotools/Script.pm =================================================================== --- trunk/Panotools-Script/lib/Panotools/Script.pm 2009-12-21 00:12:59 UTC (rev 1194) +++ trunk/Panotools-Script/lib/Panotools/Script.pm 2009-12-22 00:15:42 UTC (rev 1195) @@ -569,6 +569,11 @@ $self->Duplicates; + for my $option (keys %{$b->Option}) + { + $self->Option->{$option} = $b->Option->{$option} unless defined $self->Option->{$option}; + } + return 1; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |