[9f824a]: / src / hugin_base / panodata / PanoramaOptions.h  Maximize  Restore  History

Download this file

411 lines (335 with data), 10.9 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
// -*- c-basic-offset: 4 -*-
/** @file PanoramaMemento.h
*
* @author Pablo d'Angelo <pablo.dangelo@web.de>
*
* $Id$
*
* This is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this software; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef _PANODATA_PANORAMAMEMENTO_H
#define _PANODATA_PANORAMAMEMENTO_H
#include <hugin_config.h>
#include <string>
#include <vector>
//#include <map>
//#include <algorithm>
//#include <set>
//#include <math.h>
#include <vigra/diff2d.hxx>
#if 1
#ifdef HasPANO13
#include <vigra/windows.h>
extern "C" {
#ifdef __INTEL__
#define __INTELMEMO__
#undef __INTEL__
#endif
#include <pano13/panorama.h>
#ifdef __INTELMEMO__
#define __INTEL__
#undef __INTELMEMO__
#endif
// remove stupid #defines from the evil windows.h
#ifdef DIFFERENCE
#undef DIFFERENCE
#endif
#ifdef min
#undef min
#endif
#ifdef max
#undef max
#endif
#ifdef MIN
#undef MIN
#endif
#ifdef MAX
#undef MAX
#endif
}
#endif
#endif
//
//#include "PT/PanoImage.h"
#include <vigra_ext/Interpolators.h>
#include <panodata/DestPanoImage.h>
namespace HuginBase {
/** Panorama image options
*
* this holds the settings for the final panorama
*/
class PanoramaOptions
{
public:
/** Projection of final panorama
*/
enum ProjectionFormat {
RECTILINEAR = 0,
CYLINDRICAL = 1,
EQUIRECTANGULAR = 2,
FULL_FRAME_FISHEYE = 3,
STEREOGRAPHIC = 4,
MERCATOR = 5,
TRANSVERSE_MERCATOR = 6,
SINUSOIDAL = 7,
LAMBERT = 8,
LAMBERT_AZIMUTHAL = 9,
ALBERS_EQUAL_AREA_CONIC = 10,
MILLER_CYLINDRICAL = 11
};
/** PTStitcher acceleration */
enum PTStitcherAcceleration {
NO_SPEEDUP,
MAX_SPEEDUP,
MEDIUM_SPEEDUP // for projects with morphing.
};
/** Fileformat
*/
enum FileFormat {
JPEG = 0,
PNG,
TIFF,
TIFF_m,
TIFF_mask,
TIFF_multilayer,
TIFF_multilayer_mask,
PICT,
PSD,
PSD_m,
PSD_mask,
PAN,
IVR,
IVR_java,
VRML,
QTVR,
HDR,
HDR_m,
EXR,
EXR_m,
FILEFORMAT_NULL
};
/** output mode */
enum OutputMode {
OUTPUT_LDR=0,
OUTPUT_HDR
};
enum HDRMergeType {
HDRMERGE_AVERAGE=0,
HDRMERGE_DEGHOST=1
};
/** blenders */
enum BlendingMechanism {
NO_BLEND=0,
PTBLENDER_BLEND=1,
ENBLEND_BLEND=2,
SMARTBLEND_BLEND=3,
PTMASKER_BLEND=4
};
///
enum Remapper {
NONA=0,
PTMENDER
};
/** type of color correction
*/
enum ColorCorrection {
NONE = 0,
BRIGHTNESS_COLOR,
BRIGHTNESS,
COLOR
};
public:
PanoramaOptions()
{
reset();
};
virtual ~PanoramaOptions() {};
virtual void reset()
{
m_projectionFormat = EQUIRECTANGULAR;
#ifdef HasPANO13
panoProjectionFeaturesQuery(m_projectionFormat, &m_projFeatures);
#endif
m_hfov = 360;
m_size = vigra::Size2D(3000, 1500);
m_roi = vigra::Rect2D(m_size);
outfile = "panorama";
quality = 100;
tiff_saveROI = true;
tiffCompression = "PACKBITS";
colorCorrection = NONE;
colorReferenceImage = 0;
optimizeReferenceImage = 0;
gamma = 1.0;
interpolator = vigra_ext::INTERP_CUBIC;
featherWidth = 10;
outputFormat = TIFF_m;
remapAcceleration = MAX_SPEEDUP;
blendMode = ENBLEND_BLEND;
hdrMergeMode = HDRMERGE_AVERAGE;
remapper = NONA;
saveCoordImgs = false;
huberSigma = 2;
photometricHuberSigma = 2/255.0;
photometricSymmetricError = false;
outputMode = OUTPUT_LDR;
outputLDRBlended = true;
outputLDRLayers = false;
outputLDRExposureRemapped = false;
outputLDRExposureLayers = false;
outputLDRExposureBlended = false;
outputHDRBlended = false;
outputHDRLayers = false;
outputHDRStacks = false;
outputLayersCompression = "PACKBITS";
outputImageType = "tif";
outputImageTypeCompression = "PACKBITS";
outputImageTypeHDR= "exr";
outputImageTypeHDRCompression = "";
outputEMoRParams.resize(5,0.0);
outputExposureValue = 0.0;
outputPixelType = "";
}
public:
///
void printScriptLine(std::ostream & o,bool forPTOptimizer=false) const;
/// return string name of output file format
static const std::string & getFormatName(FileFormat f);
/** returns the FileFormat corrosponding to name.
*
* if name is not recognized, FileFormat::TIFF is returned
*/
static FileFormat getFormatFromName(const std::string & name);
/** return the extension used by the current output format */
const std::string & getOutputExtension() const;
public:
/** set panorama width
* keep the HFOV, if keepView=true
*/
void setWidth(unsigned int w, bool keepView = true);
/** set panorama height
*
* This changes the panorama vfov
*/
void setHeight(unsigned int h);
/* get panorama width */
unsigned int getWidth() const
{ return m_size.x; }
/** get panorama height */
unsigned int getHeight() const
{return m_size.y;}
/// get size of output image
vigra::Size2D getSize() const
{ return m_size; }
///
const vigra::Rect2D & getROI() const
{ return m_roi; }
///
void setROI(const vigra::Rect2D & val)
{ m_roi = val & vigra::Rect2D(m_size); }
/** set the Projection format and adjust the hfov/vfov
* if nessecary
*/
void setProjection(ProjectionFormat f);
///
PanoramaOptions::ProjectionFormat getProjection() const
{ return m_projectionFormat; };
/** Get the optional projection parameters */
const std::vector<double> & getProjectionParameters() const
{ return m_projectionParams; }
/** set the optional parameters (they need to be of the correct size) */
void setProjectionParameters(const std::vector<double> & params);
/** true, if FOV calcuations are supported for projection \p f */
bool fovCalcSupported(ProjectionFormat f) const;
/** set the horizontal field of view.
* also updates the image height (keep pano
* field of view similar.)
*/
void setHFOV(double h, bool keepView=true);
///
double getHFOV() const
{ return m_hfov; }
///
void setVFOV(double v);
///
double getVFOV() const;
/** get maximum possible hfov with current projection */
double getMaxHFOV() const;
/** get maximum possible vfov with current projection */
double getMaxVFOV() const;
///
DestPanoImage getDestImage() const;
public:
// they are public, because they need to be set through
// get/setOptions in Panorama.
std::string outfile;
FileFormat outputFormat;
// jpeg options
int quality;
// TIFF options
std::string tiffCompression;
bool tiff_saveROI;
ColorCorrection colorCorrection;
unsigned int colorReferenceImage;
// misc options
double gamma;
vigra_ext::Interpolator interpolator;
unsigned int optimizeReferenceImage;
unsigned int featherWidth;
PTStitcherAcceleration remapAcceleration;
BlendingMechanism blendMode;
HDRMergeType hdrMergeMode;
Remapper remapper;
bool saveCoordImgs;
double huberSigma;
double photometricHuberSigma;
double photometricSymmetricError;
// modes related to high dynamic range output
OutputMode outputMode;
bool outputLDRBlended; ///< save blended panorama (LDR)
bool outputLDRLayers; ///< save remapped layers (LDR)
bool outputLDRExposureRemapped;///< save remapped layers (no exposure adjustment)
bool outputLDRExposureLayers; ///< save blended exposure layers (no exposure adjustment)
bool outputLDRExposureBlended; ///< save blended exposure layers (no exposure adjustment)
bool outputHDRBlended; ///< save blended panorama (HDR)
bool outputHDRLayers; ///< save remapped layers (HDR)
bool outputHDRStacks; ///< save image stacks (HDR)
std::string outputLayersCompression;
std::string outputImageType;
std::string outputImageTypeCompression;
std::string outputImageTypeHDR;
std::string outputImageTypeHDRCompression;
// select the exposure of the output images in LDR mode.
double outputExposureValue;
std::vector<float> outputEMoRParams;
// choose pixel type for output images.
std::string outputPixelType;
#ifdef HasPANO13
pano_projection_features m_projFeatures;
#endif
private:
static const std::string fileformatNames[];
static const std::string fileformatExt[];
double m_hfov;
// unsigned int m_width;
// unsigned int m_height;
ProjectionFormat m_projectionFormat;
std::vector<double> m_projectionParams;
vigra::Size2D m_size;
vigra::Rect2D m_roi;
};
} // namespace
#endif // _H