Revision: 821
http://panotools.svn.sourceforge.net/panotools/?rev=821&view=rev
Author: brunopostle
Date: 2008-02-18 16:22:24 -0800 (Mon, 18 Feb 2008)
Log Message:
-----------
Replace convert/nona with single step PTmender remapping and downscaling.
Remove --nomagick option since ImageMagick no longer used.
Add --align option to run autooptimiser on result.
Modified Paths:
--------------
trunk/Panotools-Script/bin/match-n-shift
Modified: trunk/Panotools-Script/bin/match-n-shift
===================================================================
--- trunk/Panotools-Script/bin/match-n-shift 2008-02-17 18:18:52 UTC (rev 820)
+++ trunk/Panotools-Script/bin/match-n-shift 2008-02-19 00:22:24 UTC (rev 821)
@@ -14,11 +14,11 @@
my $pix_max = 800;
my $points = 10;
my $noransac = 0;
-my $nomagick = 0;
my $refine = 0;
my $projection = 0;
my $deg_fov = 50;
my $crop_s = undef;
+my $align = 0;
my $clean = 0;
my $help = 0;
@@ -26,11 +26,11 @@
's|size=i' => \$pix_max,
'p|points=i' => \$points,
'n|noransac' => \$noransac,
- 'm|nomagick' => \$nomagick,
'r|refine' => \$refine,
'f|projection=i' => \$projection,
'v|fov=s' => \$deg_fov,
'k|selection=s' => \$crop_s,
+ 'a|align' => \$align,
'c|clean' => \$clean,
'h|help' => \$help);
@@ -55,23 +55,12 @@
for my $path_input (@paths_input)
{
- # create a smaller version of the original photo
- my $path_input_small = File::Spec->catfile ($tempdir, "small_$index.tif");
- # if no ImageMagick, then use full size image, slooooow
- if ($nomagick)
- {
- $path_input_small = File::Spec->rel2abs ($path_input);
- }
- else
- {
- system ('convert', '-depth', 8, '-geometry', $pix_max.'x'.$pix_max,
- $path_input, $path_input_small);
- print STDOUT "Created $path_input_small\n";
- }
+ $path_input = File::Spec->rel2abs ($path_input);
# create small stereographic version
- my ($pix_width, $pix_height) = imgsize ($path_input_small);
- my $path_pto_temp = File::Spec->catfile ($tempdir, "$index.pto");
+ my ($pix_width_input, $pix_height_input) = imgsize ($path_input);
+ my $pix_width_small = $pix_max;
+ my $pix_height_small = int ($pix_height_input * $pix_width_small / $pix_width_input);
# don't use stereographic if projection isn't azimuthal
my $projection_panorama = 4;
@@ -80,15 +69,20 @@
my $pto = new Panotools::Script;
$pto->Panorama->Set (v => $deg_fov, E => 0, f => $projection_panorama, u => 0,
- w => $pix_width, h => $pix_height, n => '"TIFF"');
+ w => $pix_width_small, h => $pix_height_small, n => '"TIFF"');
$pto->Image->[0] = new Panotools::Script::Line::Image;
- $pto->Image->[0]->Set (w => $pix_width, h => $pix_height, v => $deg_fov,
- f => $projection, Eev => 0, r => 0, p => 0, y => 0, n => "\"$path_input_small\"");
+ $pto->Image->[0]->Set (w => $pix_width_input, h => $pix_height_input, v => $deg_fov,
+ f => $projection, Eev => 0, r => 0, p => 0, y => 0, n => "\"$path_input\"");
+ # make script PTmender compatible
+ $pto->Mode->Set (i => 17);
+ delete $pto->Panorama->{E};
+ delete $pto->Image->[0]->{Eev};
+ my $path_pto_temp = File::Spec->catfile ($tempdir, "$index.pto");
$pto->Write ($path_pto_temp);
my $path_output_small = File::Spec->catfile ($tempdir, "sgraph_$index.tif");
- system ('nona', '-p', 'UINT8', '-o', $path_output_small, $path_pto_temp);
+ system ('PTmender', '-o', $path_output_small, $path_pto_temp);
print STDOUT "Created $path_output_small\n";
$index++;
push @paths_output, $path_output_small;
@@ -188,7 +182,16 @@
$index++;
}
-$oto->Write ($path_oto);
+if ($align)
+{
+ my $tempfile = File::Spec->catfile ($tempdir, 'align.oto');
+ $oto->Write ($tempfile);
+ system ('autooptimiser', '-a', '-l', '-s', '-o', $path_oto, $tempfile);
+}
+else
+{
+ $oto->Write ($path_oto);
+}
# voodoo
sub from_sgraphic
@@ -272,8 +275,6 @@
-p | --points number Number of generated control points between,
each pair, default: 10
-n | --noransac No ransac detection, useful for fisheye images
- -m | --nomagick Don't downscale with 'convert' before remapping,
- use if your system doesn't have ImageMagick.
-r | --refine Refine the found control points using the
original images, delete unrefinable.
-f | --projection Panotools style input projection number. Use
@@ -281,6 +282,7 @@
3 for full-frame fisheye images.
-v | --fov Horizontal field of view in degrees
-k | --selection Crop selection boundary, eg -459,2459,-57,2861
+ -a | --align Attempt to align images.
-c | --clean Delete all temporary files afterwards.
-h | --help Outputs help documentation.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|