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

Generated on 8 Feb 2016 for Hugintrunk by  doxygen 1.4.7