PanoramaOptions.h

Go to the documentation of this file.
00001 // -*- c-basic-offset: 4 -*-
00024 #ifndef _PANODATA_PANORAMAMEMENTO_H
00025 #define _PANODATA_PANORAMAMEMENTO_H
00026 
00027 #include <hugin_config.h>
00028 
00029 #include <string>
00030 #include <vector>
00031 //#include <map>
00032 //#include <algorithm>
00033 //#include <set>
00034 //#include <math.h>
00035 #include <vigra/diff2d.hxx>
00036 
00037 #include <vigra/windows.h>
00038 
00039 extern "C" {
00040 
00041     #ifdef __INTEL__
00042     #define __INTELMEMO__
00043     #undef __INTEL__
00044     #endif
00045 
00046     #include <pano13/panorama.h>
00047 
00048     #ifdef __INTELMEMO__
00049     #define __INTEL__
00050     #undef __INTELMEMO__
00051     #endif
00052 
00053     // remove stupid #defines from the evil windows.h
00054 
00055 #ifdef DIFFERENCE
00056 #undef DIFFERENCE
00057 #endif
00058 #ifdef min
00059 #undef min
00060 #endif
00061 #ifdef max
00062 #undef max
00063 #endif
00064 #ifdef MIN
00065 #undef MIN
00066 #endif
00067 #ifdef MAX
00068 #undef MAX
00069 #endif
00070 
00071     }
00072 
00073 //
00074 //#include "PT/PanoImage.h"
00075 
00076 #include <hugin_shared.h>
00077 #include <vigra_ext/Interpolators.h>
00078 
00079 namespace HuginBase {
00080 
00085 class IMPEX PanoramaOptions
00086 {
00087         
00088     public:
00091         enum ProjectionFormat {
00092             RECTILINEAR = 0,
00093             CYLINDRICAL = 1,
00094             EQUIRECTANGULAR = 2,
00095             FULL_FRAME_FISHEYE = 3,
00096             STEREOGRAPHIC = 4,
00097             MERCATOR = 5,
00098             TRANSVERSE_MERCATOR = 6,
00099             SINUSOIDAL = 7,
00100             LAMBERT = 8,
00101             LAMBERT_AZIMUTHAL = 9,
00102             ALBERS_EQUAL_AREA_CONIC = 10,
00103             MILLER_CYLINDRICAL = 11,
00104             PANINI = 12,
00105             ARCHITECTURAL = 13,
00106             ORTHOGRAPHIC = 14,
00107             EQUISOLID = 15,
00108             EQUI_PANINI = 16,
00109             BIPLANE = 17,
00110             TRIPLANE = 18,
00111             GENERAL_PANINI = 19,
00112             THOBY_PROJECTION = 20,
00113             HAMMER_AITOFF = 21,
00114         };
00115 
00117         enum PTStitcherAcceleration {
00118             NO_SPEEDUP,
00119             MAX_SPEEDUP,
00120             MEDIUM_SPEEDUP  // for projects with morphing.
00121         };
00122 
00125         enum FileFormat {
00126             JPEG = 0,
00127             PNG,
00128             TIFF,
00129             TIFF_m,
00130             TIFF_mask,
00131             TIFF_multilayer,
00132             TIFF_multilayer_mask,
00133             PICT,
00134             PSD,
00135             PSD_m,
00136             PSD_mask,
00137             PAN,
00138             IVR,
00139             IVR_java,
00140             VRML,
00141             QTVR,
00142             HDR,
00143             HDR_m,
00144             EXR,
00145             EXR_m,
00146             FILEFORMAT_NULL
00147         };
00148 
00150         enum OutputMode {
00151             OUTPUT_LDR=0,
00152             OUTPUT_HDR
00153         };
00154 
00155         enum HDRMergeType {
00156             HDRMERGE_AVERAGE=0,
00157             HDRMERGE_DEGHOST=1
00158         };
00159 
00161         enum BlendingMechanism {
00162             NO_BLEND=0,
00163             PTBLENDER_BLEND=1,
00164             ENBLEND_BLEND=2,
00165             SMARTBLEND_BLEND=3,
00166             PTMASKER_BLEND=4
00167         };
00168 
00170         enum Remapper {
00171             NONA=0,
00172             PTMENDER
00173         };
00174 
00177         enum ColorCorrection {
00178             NONE = 0,
00179             BRIGHTNESS_COLOR,
00180             BRIGHTNESS,
00181             COLOR
00182         };
00183 
00184     public:
00185         PanoramaOptions()
00186         {
00187             reset();
00188         };
00189 
00190         virtual ~PanoramaOptions() {};
00191 
00192         virtual void reset()
00193         {
00194             m_projectionFormat = EQUIRECTANGULAR;
00195             m_hfov = 360;
00196             m_size = vigra::Size2D(3000, 1500);
00197             m_roi = vigra::Rect2D(m_size);
00198             outfile = "panorama";
00199             tiff_saveROI = true;
00200             tiffCompression = "LZW";
00201             quality = 100;
00202             colorCorrection = NONE;
00203             colorReferenceImage = 0;
00204             optimizeReferenceImage = 0;
00205             gamma = 1.0;
00206             interpolator = vigra_ext::INTERP_CUBIC;
00207             // featherWidth = 10;
00208             outputFormat = TIFF_m;
00209             remapAcceleration = MAX_SPEEDUP;
00210             blendMode = ENBLEND_BLEND;
00211             hdrMergeMode = HDRMERGE_AVERAGE;
00212             remapper = NONA;
00213             remapUsingGPU = false;
00214             saveCoordImgs = false;
00215             huberSigma = 2;
00216             photometricHuberSigma = 2/255.0;
00217             photometricSymmetricError = false;
00218             outputMode = OUTPUT_LDR;
00219 
00220             outputLDRBlended = true;
00221             outputLDRLayers = false;
00222             outputLDRExposureRemapped = false;
00223             outputLDRExposureLayers = false;
00224             outputLDRExposureLayersFused = false;
00225             outputLDRStacks = false;
00226             outputLDRExposureBlended = false;
00227             outputHDRBlended = false;
00228             outputHDRLayers = false;
00229             outputHDRStacks = false;
00230 
00231             outputLayersCompression = "LZW";
00232             outputImageType = "tif";
00233             outputImageTypeCompression = "LZW";
00234             outputImageTypeHDR= "exr";
00235             outputImageTypeHDRCompression = "LZW";
00236 
00237             enblendOptions = "";
00238             enfuseOptions  = "";
00239             hdrmergeOptions = "";
00240 
00241             outputEMoRParams.resize(5,0.0);
00242             outputExposureValue = 0.0;
00243             outputPixelType = "";
00244 
00245             panoProjectionFeaturesQuery(m_projectionFormat, &m_projFeatures);
00246             resetProjectionParameters();
00247 
00248             outputStacksMinOverlap = 0.7;
00249             outputLayersExposureDiff = 0.5;
00250         }
00251 
00252     public:
00254         void printScriptLine(std::ostream & o,bool forPTOptimizer=false) const;
00255 
00257         static const std::string & getFormatName(FileFormat f);
00258 
00263         static FileFormat getFormatFromName(const std::string & name);
00264 
00266         const std::string & getOutputExtension() const;
00267 
00268     public:
00272         void setWidth(unsigned int w, bool keepView = true);
00273 
00278         void setHeight(unsigned int h);
00279 
00280         /* get panorama width */
00281         unsigned int getWidth() const
00282             { return m_size.x; }
00283 
00285         unsigned int getHeight() const
00286             {return m_size.y;}
00287 
00289         vigra::Size2D getSize() const
00290             { return m_size; }
00291 
00293         const vigra::Rect2D & getROI() const
00294             { return m_roi; }
00295 
00297         void setROI(const vigra::Rect2D & val)
00298             { m_roi = val & vigra::Rect2D(m_size); }
00299 
00303         void setProjection(ProjectionFormat f);
00304 
00306         void resetProjectionParameters();
00307 
00309         PanoramaOptions::ProjectionFormat getProjection() const
00310             { return m_projectionFormat; };
00311 
00313         const std::vector<double> & getProjectionParameters() const
00314             { return m_projectionParams; }
00315 
00317         void setProjectionParameters(const std::vector<double> & params);
00318 
00320         bool fovCalcSupported(ProjectionFormat f) const;
00321 
00326         void setHFOV(double h, bool keepView=true);
00327 
00329         double getHFOV() const
00330             { return m_hfov; }
00331         
00333         void setVFOV(double v);
00334         
00336         double getVFOV() const;
00337 
00339         double getMaxHFOV() const
00340             { return m_projFeatures.maxHFOV; }
00341 
00343         double getMaxVFOV() const
00344             { return m_projFeatures.maxVFOV; }
00345 
00346     public:
00347         //TODO: Write accessor methods; make instance variables private unless absolutely neccesary for backward-compatibility.
00348         
00349         std::string outfile;
00350         FileFormat outputFormat;
00351 
00352         // jpeg options
00353         int quality;
00354 
00355         // TIFF options
00356         std::string tiffCompression;
00357         bool tiff_saveROI;
00358 
00359         ColorCorrection colorCorrection;
00360         unsigned int colorReferenceImage;
00361 
00362         // misc options
00363         double gamma;
00364         vigra_ext::Interpolator interpolator;
00365 
00366         unsigned int optimizeReferenceImage;
00367         // unsigned int featherWidth;
00368 
00369         PTStitcherAcceleration remapAcceleration;
00370         BlendingMechanism blendMode;
00371         HDRMergeType hdrMergeMode;
00372         Remapper remapper;
00373         bool remapUsingGPU;
00374 
00375         bool saveCoordImgs;
00376 
00377         double huberSigma;
00378 
00379         double photometricHuberSigma;
00380         double photometricSymmetricError;
00381 
00382         // modes related to high dynamic range output
00383         OutputMode outputMode;
00384 
00385         bool outputLDRBlended;         
00386         bool outputLDRLayers;          
00387         bool outputLDRExposureRemapped;
00388         bool outputLDRExposureLayers;  
00389         bool outputLDRExposureLayersFused; 
00390         bool outputLDRStacks;          
00391         bool outputLDRExposureBlended; 
00392         bool outputHDRBlended;         
00393         bool outputHDRLayers;          
00394         bool outputHDRStacks;          
00395 
00396         std::string outputLayersCompression;
00397         std::string outputImageType;
00398         std::string outputImageTypeCompression;
00399         std::string outputImageTypeHDR;
00400         std::string outputImageTypeHDRCompression;
00401 
00402         std::string enblendOptions;
00403         std::string enfuseOptions;
00404         std::string hdrmergeOptions;
00405 
00406         // select the exposure of the output images in LDR mode.
00407         double outputExposureValue;
00408         std::vector<float> outputEMoRParams;
00409 
00410         // choose pixel type for output images.
00411         std::string outputPixelType;
00412 
00413         // parameters for generating output layers and stacks
00414         double outputStacksMinOverlap;
00415         double outputLayersExposureDiff;
00416 
00417         pano_projection_features m_projFeatures;
00418 
00419     private:
00420         static const std::string fileformatNames[];
00421         static const std::string fileformatExt[];
00422         double m_hfov;
00423         double m_vfov;
00424     //    unsigned int m_width;
00425     //    unsigned int m_height;
00426         ProjectionFormat m_projectionFormat;
00427 
00428         std::vector<double> m_projectionParams;
00429         vigra::Size2D m_size;
00430         vigra::Rect2D m_roi;
00431 };
00432 
00433 
00434 } // namespace
00435 #endif // _H

Generated on Thu Apr 24 01:25:38 2014 for Hugintrunk by  doxygen 1.3.9.1