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 #include <hugin_shared.h>
00074 #include <vigra_ext/Interpolators.h>
00075 
00076 namespace HuginBase {
00077 
00082 class IMPEX PanoramaOptions
00083 {
00084         
00085     public:
00088         enum ProjectionFormat {
00089             RECTILINEAR = 0,
00090             CYLINDRICAL = 1,
00091             EQUIRECTANGULAR = 2,
00092             FULL_FRAME_FISHEYE = 3,
00093             STEREOGRAPHIC = 4,
00094             MERCATOR = 5,
00095             TRANSVERSE_MERCATOR = 6,
00096             SINUSOIDAL = 7,
00097             LAMBERT = 8,
00098             LAMBERT_AZIMUTHAL = 9,
00099             ALBERS_EQUAL_AREA_CONIC = 10,
00100             MILLER_CYLINDRICAL = 11,
00101             PANINI = 12,
00102             ARCHITECTURAL = 13,
00103             ORTHOGRAPHIC = 14,
00104             EQUISOLID = 15,
00105             EQUI_PANINI = 16,
00106             BIPLANE = 17,
00107             TRIPLANE = 18,
00108             GENERAL_PANINI = 19,
00109             THOBY_PROJECTION = 20,
00110             HAMMER_AITOFF = 21,
00111         };
00112 
00114         enum PTStitcherAcceleration {
00115             NO_SPEEDUP,
00116             MAX_SPEEDUP,
00117             MEDIUM_SPEEDUP  // for projects with morphing.
00118         };
00119 
00122         enum FileFormat {
00123             JPEG = 0,
00124             JPEG_m,
00125             PNG,
00126             PNG_m,
00127             TIFF,
00128             TIFF_m,
00129             TIFF_mask,
00130             TIFF_multilayer,
00131             TIFF_multilayer_mask,
00132             PICT,
00133             PSD,
00134             PSD_m,
00135             PSD_mask,
00136             PAN,
00137             IVR,
00138             IVR_java,
00139             VRML,
00140             QTVR,
00141             HDR,
00142             HDR_m,
00143             EXR,
00144             EXR_m,
00145             FILEFORMAT_NULL
00146         };
00147 
00149         enum OutputMode {
00150             OUTPUT_LDR=0,
00151             OUTPUT_HDR
00152         };
00153 
00154         enum HDRMergeType {
00155             HDRMERGE_AVERAGE=0,
00156             HDRMERGE_DEGHOST=1
00157         };
00158 
00160         enum BlendingMechanism {
00161             NO_BLEND=0,
00162             PTBLENDER_BLEND=1,
00163             ENBLEND_BLEND=2,
00164             SMARTBLEND_BLEND=3,
00165             PTMASKER_BLEND=4,
00166             INTERNAL_BLEND=5
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             outputMode = OUTPUT_LDR;
00218 
00219             outputLDRBlended = true;
00220             outputLDRLayers = false;
00221             outputLDRExposureRemapped = false;
00222             outputLDRExposureLayers = false;
00223             outputLDRExposureLayersFused = false;
00224             outputLDRStacks = false;
00225             outputLDRExposureBlended = false;
00226             outputHDRBlended = false;
00227             outputHDRLayers = false;
00228             outputHDRStacks = false;
00229 
00230             outputLayersCompression = "LZW";
00231             outputImageType = "tif";
00232             outputImageTypeCompression = "LZW";
00233             outputImageTypeHDR= "exr";
00234             outputImageTypeHDRCompression = "LZW";
00235 
00236             enblendOptions = "";
00237             enfuseOptions  = "";
00238             hdrmergeOptions = "";
00239 
00240             outputEMoRParams.resize(5,0.0);
00241             outputExposureValue = 0.0;
00242             outputPixelType = "";
00243 
00244             panoProjectionFeaturesQuery(m_projectionFormat, &m_projFeatures);
00245             resetProjectionParameters();
00246 
00247             outputStacksMinOverlap = 0.7;
00248             outputLayersExposureDiff = 0.5;
00249         }
00250 
00251     public:
00253         void printScriptLine(std::ostream & o,bool forPTOptimizer=false) const;
00254 
00256         static const std::string & getFormatName(FileFormat f);
00257 
00262         static FileFormat getFormatFromName(const std::string & name);
00263 
00265         const std::string & getOutputExtension() const;
00266 
00267     public:
00271         void setWidth(unsigned int w, bool keepView = true);
00272 
00277         void setHeight(unsigned int h);
00278 
00279         /* get panorama width */
00280         unsigned int getWidth() const
00281             { return m_size.x; }
00282 
00284         unsigned int getHeight() const
00285             {return m_size.y;}
00286 
00288         vigra::Size2D getSize() const
00289             { return m_size; }
00290 
00292         const vigra::Rect2D & getROI() const
00293             { return m_roi; }
00294 
00296         void setROI(const vigra::Rect2D & val)
00297             { m_roi = val & vigra::Rect2D(m_size); }
00298 
00302         void setProjection(ProjectionFormat f);
00303 
00305         void resetProjectionParameters();
00306 
00308         PanoramaOptions::ProjectionFormat getProjection() const
00309             { return m_projectionFormat; };
00310 
00312         const std::vector<double> & getProjectionParameters() const
00313             { return m_projectionParams; }
00314 
00316         void setProjectionParameters(const std::vector<double> & params);
00317 
00319         bool fovCalcSupported(ProjectionFormat f) const;
00320 
00325         void setHFOV(double h, bool keepView=true);
00326 
00328         double getHFOV() const
00329             { return m_hfov; }
00330         
00332         void setVFOV(double v);
00333         
00335         double getVFOV() const;
00336 
00338         double getMaxHFOV() const
00339             { return m_projFeatures.maxHFOV; }
00340 
00342         double getMaxVFOV() const
00343             { return m_projFeatures.maxVFOV; }
00344 
00345     public:
00346         //TODO: Write accessor methods; make instance variables private unless absolutely neccesary for backward-compatibility.
00347         
00348         std::string outfile;
00349         FileFormat outputFormat;
00350 
00351         // jpeg options
00352         int quality;
00353 
00354         // TIFF options
00355         std::string tiffCompression;
00356         bool tiff_saveROI;
00357 
00358         ColorCorrection colorCorrection;
00359         unsigned int colorReferenceImage;
00360 
00361         // misc options
00362         double gamma;
00363         vigra_ext::Interpolator interpolator;
00364 
00365         unsigned int optimizeReferenceImage;
00366         // unsigned int featherWidth;
00367 
00368         PTStitcherAcceleration remapAcceleration;
00369         BlendingMechanism blendMode;
00370         HDRMergeType hdrMergeMode;
00371         Remapper remapper;
00372         bool remapUsingGPU;
00373 
00374         bool saveCoordImgs;
00375 
00376         double huberSigma;
00377 
00378         double photometricHuberSigma;
00379 
00380         // modes related to high dynamic range output
00381         OutputMode outputMode;
00382 
00383         bool outputLDRBlended;         
00384         bool outputLDRLayers;          
00385         bool outputLDRExposureRemapped;
00386         bool outputLDRExposureLayers;  
00387         bool outputLDRExposureLayersFused; 
00388         bool outputLDRStacks;          
00389         bool outputLDRExposureBlended; 
00390         bool outputHDRBlended;         
00391         bool outputHDRLayers;          
00392         bool outputHDRStacks;          
00393 
00394         std::string outputLayersCompression;
00395         std::string outputImageType;
00396         std::string outputImageTypeCompression;
00397         std::string outputImageTypeHDR;
00398         std::string outputImageTypeHDRCompression;
00399 
00400         std::string enblendOptions;
00401         std::string enfuseOptions;
00402         std::string hdrmergeOptions;
00403 
00404         // select the exposure of the output images in LDR mode.
00405         double outputExposureValue;
00406         std::vector<float> outputEMoRParams;
00407 
00408         // choose pixel type for output images.
00409         std::string outputPixelType;
00410 
00411         // parameters for generating output layers and stacks
00412         double outputStacksMinOverlap;
00413         double outputLayersExposureDiff;
00414 
00415         pano_projection_features m_projFeatures;
00416 
00417     private:
00418         static const std::string fileformatNames[];
00419         static const std::string fileformatExt[];
00420         double m_hfov;
00421         double m_vfov;
00422     //    unsigned int m_width;
00423     //    unsigned int m_height;
00424         ProjectionFormat m_projectionFormat;
00425 
00426         std::vector<double> m_projectionParams;
00427         vigra::Size2D m_size;
00428         vigra::Rect2D m_roi;
00429 };
00430 
00431 
00432 } // namespace
00433 #endif // _H

Generated on 4 Aug 2015 for Hugintrunk by  doxygen 1.4.7