Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LensDB.h
Go to the documentation of this file.
1 // -*- c-basic-offset: 4 -*-
2 
10 /* This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public
12  * License as published by the Free Software Foundation; either
13  * version 2 of the License, or (at your option) any later version.
14  *
15  * This software is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public
21  * License along with this software. If not, see
22  * <http://www.gnu.org/licenses/>.
23  *
24  */
25 
26 #ifndef _LENS_DB_H
27 #define _LENS_DB_H
28 
29 #include <hugin_shared.h>
30 #include <panodata/SrcPanoImage.h>
31 #include <panodata/Panorama.h>
32 #include <string>
33 #include <vector>
34 
35 namespace HuginBase
36 {
37 
38 namespace LensDB
39 {
41 typedef std::vector<std::string> LensList;
42 
45 {
46 public:
48  LensDB();
50  virtual ~LensDB();
51 
52  // routines to read from database
58  bool GetCropFactor(const std::string& maker, const std::string& model, double& cropFactor) const;
63  bool GetProjection(const std::string& lens, BaseSrcPanoImage::Projection& projection) const;
71  bool GetCrop(const std::string& lens, const double focal, const vigra::Size2D& imageSize, vigra::Rect2D& cropRect) const;
78  bool GetFov(const std::string& lens, const double focal, double& fov) const;
84  bool GetDistortion(const std::string& lens, const double focal, std::vector<double>& distortion) const;
92  bool GetVignetting(const std::string& lens, const double focal, const double aperture, const double distance, std::vector<double>& vignetting) const;
99  bool GetTCA(const std::string& lens, const double focal, std::vector<double>& tca_red, std::vector<double>& tca_blue) const;
106  bool GetLensNames(const bool distortion, const bool vignetting, const bool tca, LensList& lensList) const;
109  bool CleanUpDatabase();
112  bool RemoveLens(const std::string& lensname);
115  bool RemoveCamera(const std::string& maker, const std::string& model);
116 
117  //routines to save to database
123  bool SaveCameraCrop(const std::string& maker, const std::string& model, const double cropfactor);
131  bool SaveEMoR(const std::string& maker, const std::string& model, const int iso, const std::vector<float>& emor, const int weight = 10);
136  bool SaveLensProjection(const std::string& lens, const BaseSrcPanoImage::Projection projection);
144  bool SaveLensCrop(const std::string& lens, const double focal, const vigra::Size2D& imageSize, const vigra::Rect2D& cropRect);
152  bool SaveLensFov(const std::string& lens, const double focal, const double fov, const int weight = 10);
159  bool SaveDistortion(const std::string& lens, const double focal, const std::vector<double>& distortion, const int weight = 10);
168  bool SaveVignetting(const std::string& lens, const double focal, const double aperture, const double distance, const std::vector<double>& vignetting, const int weight = 10);
176  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);
178  std::string GetDBFilename() const;
179  // access to single database class
181  static LensDB& GetSingleton();
183  static void Clean();
185  bool ExportToFile(const std::string& filename);
187  bool ImportFromFile(const std::string& filename);
188 private:
189  // prevent copying of class
190  LensDB(const LensDB&);
191  LensDB& operator=(const LensDB&);
192  // private variables
193  class Database;
194  Database *m_db;
196 };
197 
200 
201 }; //namespace LensDB
202 }; //namespace HuginBase
203 
204 #endif //_LENS_DB_H
static LensDB * m_instance
Definition: LensDB.h:195
bool SaveLensDataFromPano(const HuginBase::Panorama &pano)
routine for automatically saving information from pano into database
Definition: LensDB.cpp:2553
main database class
Definition: LensDB.h:44
Model for a panorama.
Definition: Panorama.h:152
#define IMPEX
Definition: hugin_shared.h:39
std::vector< std::string > LensList
vector storing a list of lens names
Definition: LensDB.h:41