Revision: 1172
http://panotools.svn.sourceforge.net/panotools/?rev=1172&view=rev
Author: brunopostle
Date: 2009-12-03 21:00:15 +0000 (Thu, 03 Dec 2009)
Log Message:
-----------
Rotation() method to calculate roll from EXIF data
Modified Paths:
--------------
trunk/Panotools-Script/lib/Panotools/Photos.pm
Modified: trunk/Panotools-Script/lib/Panotools/Photos.pm
===================================================================
--- trunk/Panotools-Script/lib/Panotools/Photos.pm 2009-11-28 20:32:56 UTC (rev 1171)
+++ trunk/Panotools-Script/lib/Panotools/Photos.pm 2009-12-03 21:00:15 UTC (rev 1172)
@@ -239,6 +239,32 @@
return $fov;
}
+sub Rotation
+{
+ my $self = shift;
+ my $index = shift || 0;
+ my $rotation = $self->[$index]->{exif}->{'Rotation'} || undef;
+ return 0 unless $rotation;
+ return 0 if $rotation =~ /Mirror/;
+ return 0 if ($self->[$index]->{exif}->{'ImageWidth'}
+ < $self->[$index]->{exif}->{'ImageHeight'});
+ return 90 if $rotation =~ /Rotate 90 CW/;
+ return 180 if $rotation =~ /Rotate 180/;
+ return -90 if $rotation =~ /Rotate 270 CW/;
+ return 0;
+
+# 1 => 'Horizontal (normal)',
+# 3 => 'Rotate 180',
+# 6 => 'Rotate 90 CW',
+# 8 => 'Rotate 270 CW',
+
+# 2 => 'Mirror horizontal',
+# 4 => 'Mirror vertical',
+# 5 => 'Mirror horizontal and rotate 270 CW',
+# 7 => 'Mirror horizontal and rotate 90 CW',
+
+}
+
=pod
Get an EV value for a photo, this will be guessed from partial EXIF data:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|