[an error occurred while processing this directive]
Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

hugin_base/panodata/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 #include <panodata/DestPanoImage.h>
00079 
00080 namespace HuginBase {
00081 
00086 class IMPEX PanoramaOptions
00087 {
00088         
00089     public:
00092         enum ProjectionFormat {
00093             RECTILINEAR = 0,
00094             CYLINDRICAL = 1,
00095             EQUIRECTANGULAR = 2,
00096             FULL_FRAME_FISHEYE = 3,
00097             STEREOGRAPHIC = 4,
00098             MERCATOR = 5,
00099             TRANSVERSE_MERCATOR = 6,
00100             SINUSOIDAL = 7,
00101             LAMBERT = 8,
00102             LAMBERT_AZIMUTHAL = 9,
00103             ALBERS_EQUAL_AREA_CONIC = 10,
00104             MILLER_CYLINDRICAL = 11,
00105             PANINI = 12,
00106             ARCHITECTURAL = 13,
00107             ORTHOGRAPHIC = 14,
00108             EQUISOLID = 15,
00109             EQUI_PANINI = 16,
00110             BIPLANE = 17,
00111             TRIPLANE = 18,
00112             GENERAL_PANINI = 19
00113         };
00114 
00116         enum PTStitcherAcceleration {
00117             NO_SPEEDUP,
00118             MAX_SPEEDUP,
00119             MEDIUM_SPEEDUP  // for projects with morphing.
00120         };
00121 
00124         enum FileFormat {
00125             JPEG = 0,
00126             PNG,
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         };
00167 
00169         enum Remapper {
00170             NONA=0,
00171             PTMENDER
00172         };
00173 
00176         enum ColorCorrection {
00177             NONE = 0,
00178             BRIGHTNESS_COLOR,
00179             BRIGHTNESS,
00180             COLOR
00181         };
00182 
00183     public:
00184         PanoramaOptions()
00185         {
00186             reset();
00187         };
00188 
00189         virtual ~PanoramaOptions() {};
00190 
00191         virtual void reset()
00192         {
00193             m_projectionFormat = EQUIRECTANGULAR;
00194             panoProjectionFeaturesQuery(m_projectionFormat, &m_projFeatures);
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 = "NONE";
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             outputLDRExposureBlended = false;
00226             outputHDRBlended = false;
00227             outputHDRLayers = false;
00228             outputHDRStacks = false;
00229 
00230             outputLayersCompression = "PACKBITS";
00231             outputImageType = "tif";
00232             outputImageTypeCompression = "NONE";
00233             outputImageTypeHDR= "exr";
00234             outputImageTypeHDRCompression = "";
00235 
00236             enblendOptions = "";
00237             enfuseOptions  = "";
00238             hdrmergeOptions = "";
00239 
00240             outputEMoRParams.resize(5,0.0);
00241             outputExposureValue = 0.0;
00242             outputPixelType = "";
00243         }
00244 
00245     public:
00247         void printScriptLine(std::ostream & o,bool forPTOptimizer=false) const;
00248 
00250         static const std::string & getFormatName(FileFormat f);
00251 
00256         static FileFormat getFormatFromName(const std::string & name);
00257 
00259         const std::string & getOutputExtension() const;
00260 
00261     public:
00265         void setWidth(unsigned int w, bool keepView = true);
00266 
00271         void setHeight(unsigned int h);
00272 
00273         /* get panorama width */
00274         unsigned int getWidth() const
00275             { return m_size.x; }
00276 
00278         unsigned int getHeight() const
00279             {return m_size.y;}
00280 
00282         vigra::Size2D getSize() const
00283             { return m_size; }
00284 
00286         const vigra::Rect2D & getROI() const
00287             { return m_roi; }
00288 
00290         void setROI(const vigra::Rect2D & val)
00291             { m_roi = val & vigra::Rect2D(m_size); }
00292 
00296         void setProjection(ProjectionFormat f);
00297 
00299         void resetProjectionParameters();
00300 
00302         PanoramaOptions::ProjectionFormat getProjection() const
00303             { return m_projectionFormat; };
00304 
00306         const std::vector<double> & getProjectionParameters() const
00307             { return m_projectionParams; }
00308 
00310         void setProjectionParameters(const std::vector<double> & params);
00311 
00313         bool fovCalcSupported(ProjectionFormat f) const;
00314 
00319         void setHFOV(double h, bool keepView=true);
00320 
00322         double getHFOV() const
00323             { return m_hfov; }
00324         
00326         void setVFOV(double v);
00327         
00329         double getVFOV() const;
00330 
00332         double getMaxHFOV() const
00333             { return m_projFeatures.maxHFOV; }
00334 
00336         double getMaxVFOV() const
00337             { return m_projFeatures.maxVFOV; }
00338 
00340         DestPanoImage getDestImage() const;
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         double photometricSymmetricError;
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 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         pano_projection_features m_projFeatures;
00409 
00410     private:
00411         static const std::string fileformatNames[];
00412         static const std::string fileformatExt[];
00413         double m_hfov;
00414         double m_vfov;
00415     //    unsigned int m_width;
00416     //    unsigned int m_height;
00417         ProjectionFormat m_projectionFormat;
00418 
00419         std::vector<double> m_projectionParams;
00420         vigra::Size2D m_size;
00421         vigra::Rect2D m_roi;
00422 };
00423 
00424 
00425 } // namespace
00426 #endif // _H

Generated on Mon Sep 20 01:01:27 2010 for Hugintrunk by doxygen 1.3.9.1