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             verdandiOptions = "";
00237 
00238             outputEMoRParams.resize(5,0.0);
00239             outputExposureValue = 0.0;
00240             outputPixelType = "";
00241 
00242             panoProjectionFeaturesQuery(m_projectionFormat, &m_projFeatures);
00243             resetProjectionParameters();
00244 
00245             outputStacksMinOverlap = 0.7;
00246             outputLayersExposureDiff = 0.5;
00247         }
00248 
00249     public:
00251         void printScriptLine(std::ostream & o,bool forPTOptimizer=false) const;
00252 
00254         static const std::string & getFormatName(FileFormat f);
00255 
00260         static FileFormat getFormatFromName(const std::string & name);
00261 
00263         const std::string & getOutputExtension() const;
00264 
00265     public:
00269         void setWidth(unsigned int w, bool keepView = true);
00270 
00275         void setHeight(unsigned int h);
00276 
00277         /* get panorama width */
00278         unsigned int getWidth() const
00279             { return m_size.x; }
00280 
00282         unsigned int getHeight() const
00283             {return m_size.y;}
00284 
00286         vigra::Size2D getSize() const
00287             { return m_size; }
00288 
00290         const vigra::Rect2D & getROI() const
00291             { return m_roi; }
00292 
00294         void setROI(const vigra::Rect2D & val)
00295             { m_roi = val & vigra::Rect2D(m_size); }
00296 
00300         void setProjection(ProjectionFormat f);
00301 
00303         void resetProjectionParameters();
00304 
00306         PanoramaOptions::ProjectionFormat getProjection() const
00307             { return m_projectionFormat; };
00308 
00310         const std::vector<double> & getProjectionParameters() const
00311             { return m_projectionParams; }
00312 
00314         void setProjectionParameters(const std::vector<double> & params);
00315 
00317         bool fovCalcSupported(ProjectionFormat f) const;
00318 
00323         void setHFOV(double h, bool keepView=true);
00324 
00326         double getHFOV() const
00327             { return m_hfov; }
00328         
00330         void setVFOV(double v);
00331         
00333         double getVFOV() const;
00334 
00336         double getMaxHFOV() const
00337             { return m_projFeatures.maxHFOV; }
00338 
00340         double getMaxVFOV() const
00341             { return m_projFeatures.maxVFOV; }
00342 
00343     public:
00344         //TODO: Write accessor methods; make instance variables private unless absolutely neccesary for backward-compatibility.
00345         
00346         std::string outfile;
00347         FileFormat outputFormat;
00348 
00349         // jpeg options
00350         int quality;
00351 
00352         // TIFF options
00353         std::string tiffCompression;
00354         bool tiff_saveROI;
00355 
00356         ColorCorrection colorCorrection;
00357         unsigned int colorReferenceImage;
00358 
00359         // misc options
00360         double gamma;
00361         vigra_ext::Interpolator interpolator;
00362 
00363         unsigned int optimizeReferenceImage;
00364         // unsigned int featherWidth;
00365 
00366         PTStitcherAcceleration remapAcceleration;
00367         BlendingMechanism blendMode;
00368         HDRMergeType hdrMergeMode;
00369         Remapper remapper;
00370         bool remapUsingGPU;
00371 
00372         bool saveCoordImgs;
00373 
00374         double huberSigma;
00375 
00376         double photometricHuberSigma;
00377 
00378         // modes related to high dynamic range output
00379         OutputMode outputMode;
00380 
00381         bool outputLDRBlended;         
00382         bool outputLDRLayers;          
00383         bool outputLDRExposureRemapped;
00384         bool outputLDRExposureLayers;  
00385         bool outputLDRExposureLayersFused; 
00386         bool outputLDRStacks;          
00387         bool outputLDRExposureBlended; 
00388         bool outputHDRBlended;         
00389         bool outputHDRLayers;          
00390         bool outputHDRStacks;          
00391 
00392         std::string outputLayersCompression;
00393         std::string outputImageType;
00394         std::string outputImageTypeCompression;
00395         std::string outputImageTypeHDR;
00396         std::string outputImageTypeHDRCompression;
00397 
00398         std::string enblendOptions;
00399         std::string enfuseOptions;
00400         std::string hdrmergeOptions;
00401         std::string verdandiOptions;
00402 
00403         // select the exposure of the output images in LDR mode.
00404         double outputExposureValue;
00405         std::vector<float> outputEMoRParams;
00406 
00407         // choose pixel type for output images.
00408         std::string outputPixelType;
00409 
00410         // parameters for generating output layers and stacks
00411         double outputStacksMinOverlap;
00412         double outputLayersExposureDiff;
00413 
00414         pano_projection_features m_projFeatures;
00415 
00416     private:
00417         static const std::string fileformatNames[];
00418         static const std::string fileformatExt[];
00419         double m_hfov;
00420         double m_vfov;
00421     //    unsigned int m_width;
00422     //    unsigned int m_height;
00423         ProjectionFormat m_projectionFormat;
00424 
00425         std::vector<double> m_projectionParams;
00426         vigra::Size2D m_size;
00427         vigra::Rect2D m_roi;
00428 };
00429 
00430 
00431 } // namespace
00432 #endif // _H

Generated on 29 Apr 2016 for Hugintrunk by  doxygen 1.4.7