Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PanoramaOptions.h
Go to the documentation of this file.
1 // -*- c-basic-offset: 4 -*-
24 #ifndef _PANODATA_PANORAMAMEMENTO_H
25 #define _PANODATA_PANORAMAMEMENTO_H
26 
27 #include <hugin_config.h>
28 #include <hugin_shared.h>
29 
30 #include <string>
31 #include <vector>
32 
33 #include <vigra/diff2d.hxx>
34 
35 extern "C" {
36 
37  #ifdef __INTEL__
38  #define __INTELMEMO__
39  #undef __INTEL__
40  #endif
41 
42  // Define __NO_SYSTEM__ in order to turn off including of windows.h in pano13/panorama.h
43  #define __NO_SYSTEM__
44  #include <pano13/panorama.h>
45 
46  #ifdef __INTELMEMO__
47  #define __INTEL__
48  #undef __INTELMEMO__
49  #endif
50 
51  // remove stupid #defines from the evil windows.h
52 
53 #ifdef DIFFERENCE
54 #undef DIFFERENCE
55 #endif
56 #ifdef min
57 #undef min
58 #endif
59 #ifdef max
60 #undef max
61 #endif
62 #ifdef MIN
63 #undef MIN
64 #endif
65 #ifdef MAX
66 #undef MAX
67 #endif
68 
69 }
70 
72 
73 namespace HuginBase {
74 
80 {
81 
82  public:
86  RECTILINEAR = 0,
87  CYLINDRICAL = 1,
88  EQUIRECTANGULAR = 2,
89  FULL_FRAME_FISHEYE = 3,
90  STEREOGRAPHIC = 4,
91  MERCATOR = 5,
92  TRANSVERSE_MERCATOR = 6,
93  SINUSOIDAL = 7,
94  LAMBERT = 8,
95  LAMBERT_AZIMUTHAL = 9,
96  ALBERS_EQUAL_AREA_CONIC = 10,
97  MILLER_CYLINDRICAL = 11,
98  PANINI = 12,
99  ARCHITECTURAL = 13,
100  ORTHOGRAPHIC = 14,
101  EQUISOLID = 15,
102  EQUI_PANINI = 16,
103  BIPLANE = 17,
104  TRIPLANE = 18,
105  GENERAL_PANINI = 19,
106  THOBY_PROJECTION = 20,
107  HAMMER_AITOFF = 21,
108  };
109 
114  MEDIUM_SPEEDUP // for projects with morphing.
115  };
116 
119  enum FileFormat {
120  JPEG = 0,
142  FILEFORMAT_NULL
143  };
144 
146  enum OutputMode {
147  OUTPUT_LDR=0,
148  OUTPUT_HDR
149  };
150 
152  HDRMERGE_AVERAGE=0,
153  HDRMERGE_DEGHOST=1
154  };
155 
158  NO_BLEND=0,
159  PTBLENDER_BLEND=1,
160  ENBLEND_BLEND=2,
161  SMARTBLEND_BLEND=3,
162  PTMASKER_BLEND=4,
163  INTERNAL_BLEND=5
164  };
165 
167  enum Remapper {
168  NONA=0,
169  PTMENDER
170  };
171 
174  NO_EDGE_FILL = 0,
175  EDGE_FILL_SOLID = 1
176  };
177 
178  public:
180  {
181  reset();
182  };
183 
184  virtual ~PanoramaOptions() {};
185 
186  virtual void reset()
187  {
188  m_projectionFormat = EQUIRECTANGULAR;
189  m_hfov = 360;
190  m_size = vigra::Size2D(3000, 1500);
191  m_roi = vigra::Rect2D(m_size);
192  tiff_saveROI = true;
193  tiffCompression = "LZW";
194  quality = 100;
195  colorReferenceImage = 0;
196  optimizeReferenceImage = 0;
197  interpolator = vigra_ext::INTERP_CUBIC;
198  // featherWidth = 10;
199  outputFormat = TIFF_m;
200  blendMode = ENBLEND_BLEND;
201  hdrMergeMode = HDRMERGE_AVERAGE;
202  remapper = NONA;
203  remapUsingGPU = false;
204  saveCoordImgs = false;
205  huberSigma = 2;
206  photometricHuberSigma = 2/255.0;
207  outputMode = OUTPUT_LDR;
208 
209  outputLDRBlended = true;
210  outputLDRLayers = false;
211  outputLDRExposureRemapped = false;
212  outputLDRExposureLayers = false;
213  outputLDRExposureLayersFused = false;
214  outputLDRStacks = false;
215  outputLDRExposureBlended = false;
216  outputHDRBlended = false;
217  outputHDRLayers = false;
218  outputHDRStacks = false;
219 
220  outputLayersCompression = "LZW";
221  outputImageType = "tif";
222  outputImageTypeCompression = "LZW";
223  outputImageTypeHDR= "exr";
224  outputImageTypeHDRCompression = "LZW";
225 
226  enblendOptions = "";
227  enfuseOptions = "";
228  hdrmergeOptions = "";
229  verdandiOptions = "";
230 
231  outputEMoRParams.resize(5,0.0f);
232  outputExposureValue = 0.0;
233  outputRangeCompression = 0.0;
234  outputPixelType = "";
235 
236  panoProjectionFeaturesQuery(m_projectionFormat, &m_projFeatures);
237  resetProjectionParameters();
238 
239  outputStacksMinOverlap = 0.7;
240  outputLayersExposureDiff = 0.5;
241 
242  edgeFillMode = NO_EDGE_FILL;
243  keepEdgeFillInput = false;
244  }
245 
246  public:
248  void printScriptLine(std::ostream & o,bool forPTOptimizer=false) const;
249 
251  static const std::string & getFormatName(FileFormat f);
252 
257  static FileFormat getFormatFromName(const std::string & name);
258 
260  const std::string & getOutputExtension() const;
261 
262  public:
266  void setWidth(unsigned int w, bool keepView = true);
267 
272  void setHeight(unsigned int h);
273 
274  /* get panorama width */
275  unsigned int getWidth() const
276  { return m_size.x; }
277 
279  unsigned int getHeight() const
280  {return m_size.y;}
281 
283  vigra::Size2D getSize() const
284  { return m_size; }
285 
287  const vigra::Rect2D & getROI() const
288  { return m_roi; }
289 
291  void setROI(const vigra::Rect2D & val)
292  { m_roi = val & vigra::Rect2D(m_size); }
293 
297  void setProjection(ProjectionFormat f);
298 
300  void resetProjectionParameters();
301 
304  { return m_projectionFormat; };
305 
307  const std::vector<double> & getProjectionParameters() const
308  { return m_projectionParams; }
309 
311  void setProjectionParameters(const std::vector<double> & params);
312 
314  bool fovCalcSupported(ProjectionFormat f) const;
315 
320  void setHFOV(double h, bool keepView=true);
321 
323  double getHFOV() const
324  { return m_hfov; }
325 
327  void setVFOV(double v);
328 
330  double getVFOV() const;
331 
333  double getMaxHFOV() const
334  { return m_projFeatures.maxHFOV; }
335 
337  double getMaxVFOV() const
338  { return m_projFeatures.maxVFOV; }
339 
340  public:
341  //TODO: Write accessor methods; make instance variables private unless absolutely neccesary for backward-compatibility.
342 
344 
345  // jpeg options
346  int quality;
347 
348  // TIFF options
349  std::string tiffCompression;
351 
352  unsigned int colorReferenceImage;
353 
354  // misc options
356 
358  // unsigned int featherWidth;
359 
364 
366 
367  double huberSigma;
368 
370 
371  // modes related to high dynamic range output
373 
384 
386  std::string outputImageType;
388  std::string outputImageTypeHDR;
390 
391  std::string enblendOptions;
392  std::string enfuseOptions;
393  std::string hdrmergeOptions;
394  std::string verdandiOptions;
395 
396  // select the exposure of the output images in LDR mode.
398  std::vector<float> outputEMoRParams;
400 
401  // choose pixel type for output images.
402  std::string outputPixelType;
403 
404  // parameters for generating output layers and stacks
407 
408  // edge fill mode
411 
412  pano_projection_features m_projFeatures;
413 
414  private:
415  static const std::string fileformatNames[];
416  static const std::string fileformatExt[];
417  double m_hfov;
418  double m_vfov;
419  // unsigned int m_width;
420  // unsigned int m_height;
422 
423  std::vector<double> m_projectionParams;
424  vigra::Size2D m_size;
425  vigra::Rect2D m_roi;
426 };
427 
428 
429 } // namespace
430 #endif // _H
PanoramaOptions::ProjectionFormat getProjection() const
pano_projection_features m_projFeatures
bool outputLDRLayers
save remapped layers (LDR)
PTStitcherAcceleration
PTStitcher acceleration.
std::string outputImageTypeHDRCompression
bool outputHDRLayers
save remapped layers (HDR)
unsigned int getHeight() const
get panorama height
std::vector< float > outputEMoRParams
double getMaxHFOV() const
get maximum possible hfov with current projection
std::string outputImageTypeCompression
bool outputLDRExposureBlended
&lt; save exposure fused stacks (no exposure adjustment)
std::vector< double > m_projectionParams
const vigra::Rect2D & getROI() const
bool outputLDRBlended
save blended panorama (LDR)
vigra_ext::Interpolator interpolator
double getMaxVFOV() const
get maximum possible vfov with current projection
bool outputHDRBlended
save blended panorama (HDR)
IMPEX double h[25][1024]
Definition: emor.cpp:169
void setROI(const vigra::Rect2D &val)
#define IMPEX
Definition: hugin_shared.h:39
The pano tools interpolators ported to vigra.
bool outputLDRExposureLayers
save blended exposure layers, do not perform fusion (no exposure adjustment)
unsigned int getWidth() const
bool outputLDRExposureRemapped
save remapped layers (no exposure adjustment)
const std::vector< double > & getProjectionParameters() const
Get the optional projection parameters.
bool outputLDRExposureLayersFused
save blended exposure layers which are then fused (no exposure adjustment)
ProjectionFormat m_projectionFormat
ProjectionFormat
Projection of final panorama.
Interpolator
enum with all interpolation methods
Definition: Interpolators.h:78
Panorama image options.
bool outputHDRStacks
save image stacks (HDR)
vigra::Size2D getSize() const
get size of output image
BlendingMechanism blendMode