From: <bru...@us...> - 2009-11-05 23:35:08
|
Revision: 1129 http://panotools.svn.sourceforge.net/panotools/?rev=1129&view=rev Author: brunopostle Date: 2009-11-05 23:34:56 +0000 (Thu, 05 Nov 2009) Log Message: ----------- Some more tests for Panotools::Photos Modified Paths: -------------- trunk/Panotools-Script/lib/Panotools/Photos.pm trunk/Panotools-Script/t/data/cemetery/dscn4905.jpg trunk/Panotools-Script/t/data/cemetery/dscn4906.jpg trunk/Panotools-Script/t/data/cemetery/dscn4907.jpg trunk/Panotools-Script/t/data/cemetery/dscn4908.jpg trunk/Panotools-Script/t/data/cemetery/dscn4909.jpg Added Paths: ----------- trunk/Panotools-Script/t/106.photos.t Modified: trunk/Panotools-Script/lib/Panotools/Photos.pm =================================================================== --- trunk/Panotools-Script/lib/Panotools/Photos.pm 2009-11-04 22:39:59 UTC (rev 1128) +++ trunk/Panotools-Script/lib/Panotools/Photos.pm 2009-11-05 23:34:56 UTC (rev 1129) @@ -154,4 +154,30 @@ return @groups; } +=pod + +Get the Angle of View in degrees of the first photo: + + $photos->FOV; + +..or any other photo (-1 is last): + + $photos->FOV (123); + +Returns undef if the FOV can't be calculated. + +=cut + +sub FOV +{ + my $self = shift; + my $index = 0; + $index = shift if @_; + my $path_photo = $self->{images}->[$index]; + my $exif_info = Image::ExifTool::ImageInfo ($path_photo); + my $fov = $exif_info->{'FOV'}; + $fov =~ s/[^0-9.]*$// if defined $fov; + return $fov; +} + 1; Added: trunk/Panotools-Script/t/106.photos.t =================================================================== --- trunk/Panotools-Script/t/106.photos.t (rev 0) +++ trunk/Panotools-Script/t/106.photos.t 2009-11-05 23:34:56 UTC (rev 1129) @@ -0,0 +1,29 @@ +#!/usr/bin/perl +#Editor vim:syn=perl + +use strict; +use warnings; +use Test::More 'no_plan'; +use lib 'lib'; + +use Panotools::Photos; +ok (1); + +my $photos = new Panotools::Photos ('t/data/cemetery/dscn4905.jpg', 't/data/cemetery/dscn4906.jpg'); +ok (scalar ($photos->Paths) == 2); + +$photos->Paths ('t/data/cemetery/dscn4907.jpg', 't/data/cemetery/dscn4908.jpg', 't/data/cemetery/dscn4909.jpg'); +ok (scalar ($photos->Paths) == 5); + +ok ($photos->Stub eq 't/data/cemetery/dscn4905-dscn4909'); + +ok ($photos->Bracketed == 0); + +ok ($photos->FOV == 54.4); +ok ($photos->FOV (0) == 54.4); +ok ($photos->FOV (-1) == 54.4); + +# this one deosn't have any EXIF info +$photos = new Panotools::Photos ('t/data/equirectangular/equirectangular.jpg'); +ok (defined $photos->FOV == 0); + Modified: trunk/Panotools-Script/t/data/cemetery/dscn4905.jpg =================================================================== (Binary files differ) Modified: trunk/Panotools-Script/t/data/cemetery/dscn4906.jpg =================================================================== (Binary files differ) Modified: trunk/Panotools-Script/t/data/cemetery/dscn4907.jpg =================================================================== (Binary files differ) Modified: trunk/Panotools-Script/t/data/cemetery/dscn4908.jpg =================================================================== (Binary files differ) Modified: trunk/Panotools-Script/t/data/cemetery/dscn4909.jpg =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |