File Coverage

lib/Panotools/Script/Line/Panorama.pm
Criterion Covered Total %
statement 57 57 100.0
branch 23 46 50.0
condition 1 3 33.3
subroutine 8 8 100.0
pod 0 2 0.0
total 89 116 76.7


line stmt bran cond sub pod time code
1             package Panotools::Script::Line::Panorama;
2              
3 11     11   812 use strict;
  11         25  
  11         358  
4 11     11   78 use warnings;
  11         19  
  11         303  
5 11     11   418 use Panotools::Script::Line;
  11         17  
  11         381  
6              
7             =head1 NAME
8              
9             Panotools::Script::Line::Panorama - Panotools panorama parameters
10              
11             =head1 SYNOPSIS
12              
13             Panorama parameters are described by a 'p' line
14              
15             =head1 DESCRIPTION
16              
17             w1000 width in pixels
18             h600 height in pixels
19             f0 projection format,
20             0 - rectilinear (for printing and viewing)
21             1 - Cylindrical (for Printing and QTVR)
22             2 - Equirectangular ( for Spherical panos), default
23             3 - full-frame fisheye
24             4 - stereographic
25             5 - mercator
26             6 - transverse mercator
27             7 - sinusoidal
28             8 - Lambert Equal Area Cylindrical
29             9 - Lambert Azimuthal
30             10 - Albers Equal Area Conical
31             11 - Miller Cylindrical
32             12 - Panini
33             13 - Architectural
34             14 - Orthographic
35             15 - Equisolid
36             16 - Equirectangular Panini
37             17 - Biplane
38             18 - Triplane
39             19 - Panini_General
40             20 - Thoby
41             21 - Hammer
42              
43             v360 horizontal field of view of panorama (default 360)
44             nPICT Panorama file format, one of:
45             PNG png-format, 8 & 16 bit supported
46             TIFF tiff-format, all tiff types supported (8,16,32 bit int, float, double)
47             TIFF_m tiff-format, multi-file, one image per file
48             alpha layer with non-feathered clip mask at image border
49             TIFF_multilayer tiff-format, multi-image-file, all files in one image
50             alpha layer with non-feathered clip mask at image border
51             This filetype is supported by The GIMP
52             JPEG Panoramic image in jpeg-format.
53             some more supported file formats (mostly only 8 bit support)
54             PNM, PGM, BMP, SUN, VIFF
55              
56             Special options for TIFF output:
57             n"TIFF c:NONE"
58             c - select TIFF compression, possible options: NONE, LZW, DEFLATE
59              
60             Special options for TIFF_m and TIFF_multilayer output:
61             n"TIFF c:NONE r:CROP"
62             c - TIFF compression, possible options NONE, LZW, DEFLATE
63             r - output only used image area (cropped output). The crop offsets
64             are stored in the POSITIONX and POSITONY tiff tags
65             p1 - save coordinate images (useful for further programs, like vignetting correction)
66              
67             Special options for JPEG output:
68             n"JPEG q95"
69             q - jpeg quality
70              
71             u10 width of feather for stitching all images. default:10
72             k1 attempt color & brightness correction using image number as anchor
73             b1 attempt brightness correction with no color change using image number as anchor
74             d1 attempt color correction with no brightness change using image number as anchor
75             Do not use more than one of k, d, b.This is new method of correcting
76              
77             E1 exposure value for final panorama
78             R1 stitching mode: 0: normal LDR mode, 1: HDR mode
79             T"UINT8" bitdepth of output images, possible values are
80             UINT8 - 8 bit unsigned
81             UINT16 - 16 bit unsigned
82             FLOAT - 32 bit floating point
83             By default the bit depth of the input images is used.
84             S100,600,100,800 Selection(left,right,top,bottom), Only pixels inside the rectangle
85             will be rendered. Images that do not contain pixels in this area
86             are not rendered/created.
87             P"0 60" Projection parameters. e.g. Albers Equal Area Conical requires extra parameters.
88              
89             =cut
90              
91 11     11   71 use vars qw /@ISA/;
  11         32  
  11         5455  
92             @ISA = qw /Panotools::Script::Line/;
93              
94             sub _defaults
95             {
96 17     17   32 my $self = shift;
97 17         59 $self->{w} = 1000;
98 17         29 $self->{h} = 500;
99 17         32 $self->{v} = 360.0;
100 17         30 $self->{n} = '"JPEG q100"';
101 17         32 $self->{E} = 0;
102 17         32 $self->{f} = 2;
103 17         35 $self->{R} = 0;
104             }
105              
106 28     28   60 sub _valid { '^([bdfhknuvwERTSP])(.*)' }
107              
108             sub Identifier
109             {
110 12     12 0 21 my $self = shift;
111 12         88 return "p";
112             }
113              
114             sub Report
115             {
116 1     1 0 2 my $self = shift;
117 1         2 my @report;
118              
119 1         2 my $format = 'UNKNOWN';
120 1 50       5 $format = "Rectilinear" if $self->{f} == 0;
121 1 50       5 $format = "Cylindrical" if $self->{f} == 1;
122 1 50       3 $format = "Equirectangular" if $self->{f} == 2;
123 1 50       3 $format = "Fisheye" if $self->{f} == 3;
124 1 50       3 $format = "Stereographic" if $self->{f} == 4;
125 1 50       2 $format = "Mercator" if $self->{f} == 5;
126 1 50       2 $format = "Transverse mercator" if $self->{f} == 6;
127 1 50       2 $format = "Sinusoidal" if $self->{f} == 7;
128 1 50       3 $format = "Lambert Equal Area Cylindrical" if $self->{f} == 8;
129 1 50       2 $format = "Lambert Azimuthal" if $self->{f} == 9;
130 1 50       2 $format = "Albers Equal Area Conical" if $self->{f} == 10;
131 1 50       2 $format = "Miller Cylindrical" if $self->{f} == 11;
132 1 50       3 $format = "Panini" if $self->{f} == 12;
133 1 50       2 $format = "Architectural" if $self->{f} == 13;
134 1 50       2 $format = "Orthographic" if $self->{f} == 14;
135 1 50       2 $format = "Equisolid" if $self->{f} == 15;
136 1 50       2 $format = "Equirectangular Panini" if $self->{f} == 16;
137 1 50       4 $format = "Biplane" if $self->{f} == 17;
138 1 50       3 $format = "Triplane" if $self->{f} == 18;
139              
140 1         1 my $mode = "LDR";
141 1 50 33     18 $mode = "HDR" if defined $self->{R} and $self->{R} == 1;
142              
143 1         5 push @report, ['Dimensions', $self->{w} .'x'. $self->{h}];
144 1         9 push @report, ['Megapixels', int ($self->{w} * $self->{h} / 1024 / 1024 * 10) / 10];
145 1         2 push @report, ['Format', $format];
146 1         9 push @report, ['Horizontal Field of View', $self->{v}];
147 1         5 push @report, ['File type', $self->{n}];
148 1         3 push @report, ['Exposure Value', $self->{E}];
149 1 50       3 push @report, ['Stitching mode', $mode] if defined $mode;
150 1 50       4 push @report, ['Bit depth', $self->{T}] if defined $self->{T};
151 1 50       3 push @report, ['Selection area', $self->{S}] if defined $self->{S};
152 1         5 [@report];
153             }
154              
155             1;