LensDB.h

Go to the documentation of this file.
00001 // -*- c-basic-offset: 4 -*-
00002 
00010 /*  This program is free software; you can redistribute it and/or
00011  *  modify it under the terms of the GNU General Public
00012  *  License as published by the Free Software Foundation; either
00013  *  version 2 of the License, or (at your option) any later version.
00014  *
00015  *  This software is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  *  General Public License for more details.
00019  *
00020  *  You should have received a copy of the GNU General Public
00021  *  License along with this software. If not, see
00022  *  <http://www.gnu.org/licenses/>.
00023  *
00024  */
00025 
00026 #ifndef _LENS_DB_H
00027 #define _LENS_DB_H
00028 
00029 #include <hugin_shared.h>
00030 #include <panodata/SrcPanoImage.h>
00031 #include <panodata/Panorama.h>
00032 #include <string>
00033 #include <vector>
00034 
00035 namespace HuginBase
00036 {
00037 
00038 namespace LensDB
00039 {
00041 typedef std::vector<std::string> LensList;
00042 
00044 class IMPEX LensDB
00045 {
00046 public:
00048     LensDB();
00050     virtual ~LensDB();
00051 
00052     // routines to read from database
00058     bool GetCropFactor(const std::string& maker, const std::string& model, double& cropFactor) const;
00063     bool GetProjection(const std::string& lens, BaseSrcPanoImage::Projection& projection) const;
00071     bool GetCrop(const std::string& lens, const double focal, const vigra::Size2D& imageSize, vigra::Rect2D& cropRect) const;
00078     bool GetFov(const std::string& lens, const double focal, double& fov) const;
00084     bool GetDistortion(const std::string& lens, const double focal, std::vector<double>& distortion) const;
00092     bool GetVignetting(const std::string& lens, const double focal, const double aperture, const double distance, std::vector<double>& vignetting) const;
00099     bool GetTCA(const std::string& lens, const double focal, std::vector<double>& tca_red, std::vector<double>& tca_blue) const;
00106     bool GetLensNames(const bool distortion, const bool vignetting, const bool tca, LensList& lensList) const;
00109     bool CleanUpDatabase();
00112     bool RemoveLens(const std::string& lensname);
00115     bool RemoveCamera(const std::string& maker, const std::string& model);
00116 
00117     //routines to save to database
00123     bool SaveCameraCrop(const std::string& maker, const std::string& model, const double cropfactor);
00131     bool SaveEMoR(const std::string& maker, const std::string& model, const int iso, const std::vector<float>& emor, const int weight = 10);
00136     bool SaveLensProjection(const std::string& lens, const BaseSrcPanoImage::Projection projection);
00144     bool SaveLensCrop(const std::string& lens, const double focal, const vigra::Size2D& imageSize, const vigra::Rect2D& cropRect);
00152     bool SaveLensFov(const std::string& lens, const double focal, const double fov, const int weight = 10);
00159     bool SaveDistortion(const std::string& lens, const double focal, const std::vector<double>& distortion, const int weight = 10);
00168     bool SaveVignetting(const std::string& lens, const double focal, const double aperture, const double distance, const std::vector<double>& vignetting, const int weight = 10);
00176     bool SaveTCA(const std::string& lens, const double focal, const std::vector<double>& tca_red, const std::vector<double>& tca_blue, const int weight=10);
00178     std::string GetDBFilename() const;
00179     // access to single database class
00181     static LensDB& GetSingleton();
00183     static void Clean();
00185     bool ExportToFile(const std::string& filename);
00187     bool ImportFromFile(const std::string& filename);
00188 private:
00189     // prevent copying of class
00190     LensDB(const LensDB&);
00191     LensDB& operator=(const LensDB&);
00192     // private variables
00193     class Database;
00194     Database *m_db;
00195     static LensDB* m_instance;
00196 };
00197 
00199 IMPEX bool SaveLensDataFromPano(const HuginBase::Panorama& pano);
00200 
00201 }; //namespace LensDB
00202 }; //namespace HuginBase
00203 
00204 #endif //_LENS_DB_H

Generated on 4 Sep 2015 for Hugintrunk by  doxygen 1.4.7