1 // -*- c-basic-offset: 4 -*-
2 /** @file image_variables.h
3  *
4  *  @author James Legg
5  *
6  *  @brief This file specifies what image variables SrcPanoImg should have.
7  *
8  * This file is #included multiple times after defining a macro for
9  * image_variable. The idea is to reduce the amount of tedoius code copy &
10  * pasted for each image variable. The list will be used to generate things the
11  * following:
12  * -# Member variables:
13  *          ImageVariable<[type]> m_[name];
14  * -# Accessor functions:
15  *          [type] get[name]() const;
16  * -# Set functions:
17  *          void set[name](const [type] data);
18  * -# Link functions:
19  *          void link[name](SrcPanoImg)
20  * -# Unlink functions:
21  *          void unlink[name]();
22  * @par
23  * The arguments work as follows:
24  * -# the name of the variable
25  * -# the type of the variable
26  * -# the default value
27  *
28  * @par
29  * There is some non automatic stuff in ImageVariableTranslate.h that will need
30  * changing if this list changes. That file handles the translation to and from
31  * PTO file format style variables.
32  * @see ImageVariableTranslate.h
33  */
34 
35 /*  This is free software; you can redistribute it and/or
36  *  modify it under the terms of the GNU General Public
37  *  License as published by the Free Software Foundation; either
38  *  version 2 of the License, or (at your option) any later version.
39  *
40  *  This software is distributed in the hope that it will be useful,
41  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
42  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
43  *  Lesser General Public License for more details.
44  *
45  *  You should have received a copy of the GNU General Public
46  *  License along with this software. If not, see
47  *  <http://www.gnu.org/licenses/>.
48  *
49  */
50 
51 /* Hmmm... I'ld like commas in template arguments, but < and > aren't real
52  * brackets so the template arguments will be interprated as separate macro
53  * arguments instead.
54  * Solution: Have an object in ImageVariableTranslate.h which handles all the
55  * pto conversion code. We can generate the code in SrcPanoImg.h automatically
56  * as ImageVariableTranslate.h typedefs PTOVariableConverterFor[name] for each
57  * variable.
58  * So we don't have a parameter that specifies the codes to use in a PTO file.
59  */
60 
61 // file variables
62 image_variable( Filename, std::string, "" )
63 image_variable( Size, vigra::Size2D , vigra::Size2D(0,0) )
64 // projection variables
65 image_variable( Projection, HuginBase::BaseSrcPanoImage::Projection, RECTILINEAR )
66 image_variable( HFOV, double, 50.0 )
67 image_variable( CropFactor, double, 0.0 )
68 
69 // colour response variables
70 image_variable( ResponseType, HuginBase::BaseSrcPanoImage::ResponseType, RESPONSE_EMOR )
71 image_variable( EMoRParams, std::vector<float>, std::vector<float>(5, 0.0f) )
72 image_variable( ExposureValue, double, 0.0 )
73 image_variable( Gamma, double, 1.0 )
74 image_variable( WhiteBalanceRed, double, 1.0 )
75 image_variable( WhiteBalanceBlue, double, 1.0 )
76 
77 // orientation in degrees
78 image_variable( Roll, double , 0.0 )
79 image_variable( Pitch, double , 0.0 )
80 image_variable( Yaw, double, 0.0 )
81 
82 image_variable( X, double , 0.0 )
83 image_variable( Y, double , 0.0 )
84 image_variable( Z, double, 0.0 )
85 
86 image_variable( TranslationPlaneYaw, double, 0.0)
87 image_variable( TranslationPlanePitch, double, 0.0)
88 // stack information
89 // Currently only the link information is used, the value means nothing.
90 image_variable( Stack, double, 0.0 )
91 
92 // radial lens distortion
93 image_variable( RadialDistortion, std::vector<double>, std::vector<double>({ 0.0, 0.0, 0.0, 1.0 }))
94 
95 // radial lens distortion (red, blue channel), for TCA correction
96 image_variable( RadialDistortionRed, std::vector<double>, std::vector<double>({ 0.0, 0.0, 0.0, 1.0 }))
97 image_variable( RadialDistortionBlue, std::vector<double>, std::vector<double>({ 0.0, 0.0, 0.0, 1.0 }))
98 
99 // Center shift
100 image_variable( RadialDistortionCenterShift, hugin_utils::FDiff2D, hugin_utils::FDiff2D(0.0, 0.0) )
101 
102 // shear
103 image_variable( Shear, hugin_utils::FDiff2D, hugin_utils::FDiff2D(0, 0)  )
104 
105 // crop description
106 image_variable( CropMode, HuginBase::BaseSrcPanoImage::CropMode, NO_CROP )
107 image_variable( CropRect, vigra::Rect2D, vigra::Rect2D(0, 0, 0, 0) )
108 image_variable( AutoCenterCrop, bool, true )
109 
110 // vignetting correction
111 image_variable( VigCorrMode, int, VIGCORR_RADIAL|VIGCORR_DIV )
112 
113 // coefficients for vignetting correction (even degrees: 0,2,4,6, ...)
114 image_variable( FlatfieldFilename, std::string, "" )
115 image_variable(RadialVigCorrCoeff, std::vector<double>, std::vector<double>({ 1.0, 0.0, 0.0, 0.0 }))
116 image_variable( RadialVigCorrCenterShift, hugin_utils::FDiff2D, hugin_utils::FDiff2D(0.0, 0.0) )
117 
118 // linear pixel transform
119 // (doesn't seem to be used, removing with #if 0)
120 #if 0
121 image_variable( ka, std::vector<double>, ,  )
122 image_variable( kb, std::vector<double>, ,  )
123 #endif
124 
125 // store camera information from exif tags...
126 image_variable( ExifModel, std::string, "" )
127 image_variable( ExifMake, std::string, "" )
128 image_variable( ExifLens, std::string, "" )
129 image_variable( ExifFocalLength, double, 0.0 )
130 image_variable( ExifOrientation, double, 0.0 )
131 image_variable( ExifAperture, double, 0.0 )
132 image_variable( ExifISO, double, 0.0 )
133 image_variable( ExifDistance, double, 0.0 )
134 image_variable( ExifFocalLength35, double, 0.0)
135 image_variable( ExifCropFactor, double, 0.0)
136 image_variable( ExifExposureTime, double, 0.0)
137 image_variable( ExifDate, std::string, "")
138 image_variable( ExifExposureMode, int, 0.0)
139 image_variable( ExifRedBalance, double, 1.0)
140 image_variable( ExifBlueBalance, double, 1.0)
141 image_variable( FileMetadata, HuginBase::FileMetaData, HuginBase::FileMetaData())
142 
143 #if 0
144 //
145 // panotools options, currently not used
146 //
147 // width of feather for stitching.
148 image_variable( FeatherWidth, unsigned int, 10 )
149 // Morph-to-fit using control points.
150 image_variable( Morph, bool, false )
151 #endif
152 
153 // mask handling
154 // Masks is list of loaded or created textures
155 image_variable( Masks, HuginBase::MaskPolygonVector, HuginBase::MaskPolygonVector())
156 // ActiveMasks contains list of all negative masks, which should be applied to
157 // a given image, this is used to propagate positive masks
158 image_variable( ActiveMasks, HuginBase::MaskPolygonVector, HuginBase::MaskPolygonVector())
159 
160 // If the image is selected to be used in the preview and for optimisation.
161 image_variable( Active, bool, true )
162 
163