Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
HuginBase::LensDB::LensDB Class Reference

main database class More...

#include <LensDB.h>

Classes

class  Database
 

Public Member Functions

 LensDB ()
 constructor More...
 
virtual ~LensDB ()
 destructor More...
 
bool GetCropFactor (const std::string &maker, const std::string &model, double &cropFactor) const
 returns the crop factor for the given camera (maker/model) More...
 
bool GetProjection (const std::string &lens, BaseSrcPanoImage::Projection &projection) const
 returns the projection of the lens More...
 
bool GetCrop (const std::string &lens, const double focal, const vigra::Size2D &imageSize, vigra::Rect2D &cropRect) const
 returns the crop of the lens the information for landscape and portrait images are stored separately More...
 
bool GetFov (const std::string &lens, const double focal, double &fov) const
 returns the field of view of the lens the fov is always returned for a landscape image with aspect ratio 3:2 More...
 
bool GetDistortion (const std::string &lens, const double focal, std::vector< double > &distortion) const
 returns the distortion parameters of the lens More...
 
bool GetVignetting (const std::string &lens, const double focal, const double aperture, const double distance, std::vector< double > &vignetting) const
 returns the vignetting parameters of the lens More...
 
bool GetTCA (const std::string &lens, const double focal, std::vector< double > &tca_red, std::vector< double > &tca_blue) const
 returns the tca distortion parameters of the lens More...
 
bool GetLensNames (const bool distortion, const bool vignetting, const bool tca, LensList &lensList) const
 return a vector of lenses with selected database entries More...
 
bool CleanUpDatabase ()
 compress database by remove all entries and insert instead the average values More...
 
bool RemoveLens (const std::string &lensname)
 remove all database entry which refers to given lens More...
 
bool RemoveCamera (const std::string &maker, const std::string &model)
 remove all database entry which refers to given camera More...
 
bool SaveCameraCrop (const std::string &maker, const std::string &model, const double cropfactor)
 save the camera with the given cropfactor into the database More...
 
bool SaveEMoR (const std::string &maker, const std::string &model, const int iso, const std::vector< float > &emor, const int weight=10)
 save the camera with the given EMoR parameters into the database More...
 
bool SaveLensProjection (const std::string &lens, const BaseSrcPanoImage::Projection projection)
 saves the projection for the lens in the database More...
 
bool SaveLensCrop (const std::string &lens, const double focal, const vigra::Size2D &imageSize, const vigra::Rect2D &cropRect)
 saves the crop information of the lens in the database the information for landscape and portrait images are stored separately More...
 
bool SaveLensFov (const std::string &lens, const double focal, const double fov, const int weight=10)
 saves the field of view of the lens the fov should always calculated for a landscape image with aspect ratio 3:2 More...
 
bool SaveDistortion (const std::string &lens, const double focal, const std::vector< double > &distortion, const int weight=10)
 saves the distortion parameters of the lens in the database More...
 
bool SaveVignetting (const std::string &lens, const double focal, const double aperture, const double distance, const std::vector< double > &vignetting, const int weight=10)
 saves the vignetting parameters of the lens More...
 
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)
 saves the tca distortion parameters of the lens More...
 
std::string GetDBFilename () const
 returns the filename of the lens database More...
 
bool ExportToFile (const std::string &filename)
 export database to file More...
 
bool ImportFromFile (const std::string &filename)
 import data from external file More...
 

Static Public Member Functions

static LensDBGetSingleton ()
 returns the static LensDB instance More...
 
static void Clean ()
 cleanup the static LensDB instance, must be called at the end of the program More...
 

Private Member Functions

 LensDB (const LensDB &)
 
LensDBoperator= (const LensDB &)
 

Private Attributes

Databasem_db
 

Static Private Attributes

static LensDBm_instance =NULL
 

Detailed Description

main database class

Definition at line 44 of file LensDB.h.

Constructor & Destructor Documentation

HuginBase::LensDB::LensDB::LensDB ( )

constructor

Definition at line 1972 of file LensDB.cpp.

References hugin_utils::GetUserAppDataDir(), and m_db.

Referenced by GetSingleton().

HuginBase::LensDB::LensDB::~LensDB ( )
virtual

destructor

Definition at line 1995 of file LensDB.cpp.

References m_db.

HuginBase::LensDB::LensDB::LensDB ( const LensDB )
private

Member Function Documentation

void HuginBase::LensDB::LensDB::Clean ( )
static

cleanup the static LensDB instance, must be called at the end of the program

Definition at line 2010 of file LensDB.cpp.

References m_instance.

Referenced by main(), PTBatcherGUI::OnExit(), print_result(), huginApp::~huginApp(), and LensCalFrame::~LensCalFrame().

bool HuginBase::LensDB::LensDB::CleanUpDatabase ( )

compress database by remove all entries and insert instead the average values

Returns
true, if cleanup was successful

Definition at line 2508 of file LensDB.cpp.

References HuginBase::LensDB::LensDB::Database::CleanUp(), and m_db.

bool HuginBase::LensDB::LensDB::ExportToFile ( const std::string &  filename)

export database to file

Definition at line 2535 of file LensDB.cpp.

References HuginBase::LensDB::LensDB::Database::ExportToFile(), and m_db.

Referenced by main().

bool HuginBase::LensDB::LensDB::GetCrop ( const std::string &  lens,
const double  focal,
const vigra::Size2D &  imageSize,
vigra::Rect2D &  cropRect 
) const

returns the crop of the lens the information for landscape and portrait images are stored separately

Parameters
lensname of the lens, or for compact camera Maker|Model
focalfocal length, for which the crop should be returned
imageSizesize of the image for which the crop information is wanted
cropRectcontains the crop information
Returns
true, if the database has stored information about the lens crop

Definition at line 2073 of file LensDB.cpp.

References HuginBase::LensDB::LensDB::Database::GetLensCrop(), HuginBase::LensDB::InterpolateValue(), HuginBase::LensDB::IsFocallengthNearRange(), m_db, and hugin_utils::roundi().

Referenced by ApplyLensDBParameters(), and HuginBase::SrcPanoImage::readProjectionFromDB().

bool HuginBase::LensDB::LensDB::GetCropFactor ( const std::string &  maker,
const std::string &  model,
double &  cropFactor 
) const

returns the crop factor for the given camera (maker/model)

Parameters
makermaker of the desired camera
modelcamera model
cropFactorcontains the crop factor
Returns
true, if the crop factor could be obtained from the database, otherwise false

Definition at line 2031 of file LensDB.cpp.

References HuginBase::LensDB::LensDB::Database::GetCropFactor(), and m_db.

std::string HuginBase::LensDB::LensDB::GetDBFilename ( ) const

returns the filename of the lens database

Definition at line 2019 of file LensDB.cpp.

References HuginBase::LensDB::LensDB::Database::GetDBFilename(), and m_db.

Referenced by AboutDialog::GetSystemInformation(), and main().

bool HuginBase::LensDB::LensDB::GetDistortion ( const std::string &  lens,
const double  focal,
std::vector< double > &  distortion 
) const

returns the distortion parameters of the lens

Parameters
lensname of the lens, or for compact camera Maker|Model
focalfocal length, for which the distortion parameters should be returned
distortionstored the returned distortion parameters
Returns
true, if the database has stored information about the distortion

Definition at line 2162 of file LensDB.cpp.

References HuginBase::LensDB::LensDB::Database::GetDistortionData(), HuginBase::LensDB::InterpolateValue(), HuginBase::LensDB::IsFocallengthNearRange(), and m_db.

Referenced by ApplyLensDBParameters(), HuginBase::SrcPanoImage::readDistortionFromDB(), and HuginBase::SrcPanoImage::readProjectionFromDB().

bool HuginBase::LensDB::LensDB::GetFov ( const std::string &  lens,
const double  focal,
double &  fov 
) const

returns the field of view of the lens the fov is always returned for a landscape image with aspect ratio 3:2

Parameters
lensname of the lens, or for compact camera Maker|Model
focalfocal length, for which the fov should be returned
fovstored the returned field of view
Returns
true, if the database has stored information about the field of view

Definition at line 2119 of file LensDB.cpp.

References HuginBase::LensDB::LensDB::Database::GetHFOV(), HFOV, HuginBase::LensDB::InterpolateValue(), HuginBase::LensDB::IsFocallengthNearRange(), and m_db.

Referenced by ApplyLensDBParameters(), and HuginBase::SrcPanoImage::readProjectionFromDB().

bool HuginBase::LensDB::LensDB::GetLensNames ( const bool  distortion,
const bool  vignetting,
const bool  tca,
LensList lensList 
) const

return a vector of lenses with selected database entries

Parameters
distortionvector contains lenses with distortion data
vignettingvector contains lenses with vignetting data
tcavector contains lenses with tca data
lensListvector containing the lens names
Returns
true, if lenses were found

Definition at line 2419 of file LensDB.cpp.

References HuginBase::LensDB::LensDB::Database::GetLensNames(), and m_db.

bool HuginBase::LensDB::LensDB::GetProjection ( const std::string &  lens,
BaseSrcPanoImage::Projection projection 
) const

returns the projection of the lens

Parameters
lensname of the lens, or for compact camera Maker|Model
projectioncontains the projection of the lens
Returns
true, if the database has stored information about the lens projection

Definition at line 2040 of file LensDB.cpp.

References HuginBase::LensDB::LensDB::Database::GetLensProjection(), and m_db.

Referenced by ApplyLensDBParameters(), and HuginBase::SrcPanoImage::readProjectionFromDB().

LensDB & HuginBase::LensDB::LensDB::GetSingleton ( )
static
bool HuginBase::LensDB::LensDB::GetTCA ( const std::string &  lens,
const double  focal,
std::vector< double > &  tca_red,
std::vector< double > &  tca_blue 
) const

returns the tca distortion parameters of the lens

Parameters
lensname of the lens, or for compact camera Maker|Model
focalfocal length, for which the distortion parameters should be returned
tca_redstored the returned tca distortion parameters for red channel
tca_bluestored the returned tca distortion parameters for blue channel
Returns
true, if the database has stored information about the distortion

Definition at line 2366 of file LensDB.cpp.

References HuginBase::LensDB::LensDB::Database::GetTCAData(), HuginBase::LensDB::InterpolateValue(), HuginBase::LensDB::IsFocallengthNearRange(), and m_db.

Referenced by main().

bool HuginBase::LensDB::LensDB::GetVignetting ( const std::string &  lens,
const double  focal,
const double  aperture,
const double  distance,
std::vector< double > &  vignetting 
) const

returns the vignetting parameters of the lens

Parameters
lensname of the lens, or for compact camera Maker|Model
focalfocal length, for which the vignetting parameters should be returned
apertureaperture, for which the vignetting parameters should be returned
distancedistance, for which the vignetting parameters should be returned (currently ignored)
vignettingstored the returned vignetting
Returns
true, if the database has stored information about the vignetting

Definition at line 2205 of file LensDB.cpp.

References HuginBase::LensDB::LensDB::Database::GetVignettingData(), HuginBase::LensDB::InterpolateValue(), HuginBase::LensDB::InterpolateValueTriangle(), HuginBase::LensDB::IsFocallengthNearRange(), and m_db.

Referenced by ApplyLensDBParameters(), and HuginBase::SrcPanoImage::readVignettingFromDB().

bool HuginBase::LensDB::LensDB::ImportFromFile ( const std::string &  filename)

import data from external file

Definition at line 2544 of file LensDB.cpp.

References HuginBase::LensDB::LensDB::Database::ImportFromFile(), and m_db.

Referenced by main().

LensDB& HuginBase::LensDB::LensDB::operator= ( const LensDB )
private
bool HuginBase::LensDB::LensDB::RemoveCamera ( const std::string &  maker,
const std::string &  model 
)

remove all database entry which refers to given camera

Returns
true, if all was successful, false, if there were errors

Definition at line 2526 of file LensDB.cpp.

References m_db, and HuginBase::LensDB::LensDB::Database::RemoveCamera().

Referenced by main().

bool HuginBase::LensDB::LensDB::RemoveLens ( const std::string &  lensname)

remove all database entry which refers to given lens

Returns
true, if all was successful, false, if there were errors

Definition at line 2517 of file LensDB.cpp.

References m_db, and HuginBase::LensDB::LensDB::Database::RemoveLens().

Referenced by main().

bool HuginBase::LensDB::LensDB::SaveCameraCrop ( const std::string &  maker,
const std::string &  model,
const double  cropfactor 
)

save the camera with the given cropfactor into the database

Parameters
makercamera maker to save
modelcamera model to save
cropfactorcrop factor for given camera
Returns
true, if saving was successful

Definition at line 2429 of file LensDB.cpp.

References m_db, and HuginBase::LensDB::LensDB::Database::SaveCropFactor().

Referenced by HuginBase::LensDB::SaveLensDataFromPano(), and SaveLensParameters().

bool HuginBase::LensDB::LensDB::SaveDistortion ( const std::string &  lens,
const double  focal,
const std::vector< double > &  distortion,
const int  weight = 10 
)

saves the distortion parameters of the lens in the database

Parameters
lensname of the lens, or for compact camera Maker|Model
focalfocal length, for which the distortion parameters should be saved
distortiondistortion parameters which should be stored in database
weightweight factor for given values (0-100, default is 10)
Returns
true, if saving was successful

Definition at line 2481 of file LensDB.cpp.

References m_db, and HuginBase::LensDB::LensDB::Database::SaveDistortion().

Referenced by HuginBase::LensDB::SaveLensDataFromPano(), and SaveLensParameters().

bool HuginBase::LensDB::LensDB::SaveEMoR ( const std::string &  maker,
const std::string &  model,
const int  iso,
const std::vector< float > &  emor,
const int  weight = 10 
)

save the camera with the given EMoR parameters into the database

Parameters
makercamera maker to save
modelcamera model to save
ISOISO settings for which the EMoR parameters applies
emorEMoR parameters to save
weightweight factor for given values (0-100, default is 10)
Returns
true, if saving was successful

Definition at line 2438 of file LensDB.cpp.

References m_db, and HuginBase::LensDB::LensDB::Database::SaveEMoR().

Referenced by HuginBase::LensDB::SaveLensDataFromPano().

bool HuginBase::LensDB::LensDB::SaveLensCrop ( const std::string &  lens,
const double  focal,
const vigra::Size2D &  imageSize,
const vigra::Rect2D &  cropRect 
)

saves the crop information of the lens in the database the information for landscape and portrait images are stored separately

Parameters
lensname of the lens, or for compact camera Maker|Model
focalfocal length, for which the crop should be saved
imageSizesize of the image for which the crop information is saved
cropRectcontains the crop information which should be saved
Returns
true, if saving was successful

Definition at line 2456 of file LensDB.cpp.

References m_db, HuginBase::LensDB::LensDB::Database::RemoveLensCrop(), and HuginBase::LensDB::LensDB::Database::SaveLensCrop().

Referenced by HuginBase::LensDB::SaveLensDataFromPano().

bool HuginBase::LensDB::LensDB::SaveLensFov ( const std::string &  lens,
const double  focal,
const double  fov,
const int  weight = 10 
)

saves the field of view of the lens the fov should always calculated for a landscape image with aspect ratio 3:2

Parameters
lensname of the lens, or for compact camera Maker|Model
focalfocal length, for which the fov should be saved
fovfield of view for storing
weightweight factor for given values (0-100, default is 10)
Returns
true, if saving was successful

Definition at line 2472 of file LensDB.cpp.

References m_db, and HuginBase::LensDB::LensDB::Database::SaveHFOV().

Referenced by HuginBase::LensDB::SaveLensDataFromPano(), and SaveLensParameters().

bool HuginBase::LensDB::LensDB::SaveLensProjection ( const std::string &  lens,
const BaseSrcPanoImage::Projection  projection 
)

saves the projection for the lens in the database

Parameters
lensname of the lens, or for compact camera Maker|Model
projectionprojection of the lens
Returns
true, if saving was successful

Definition at line 2447 of file LensDB.cpp.

References m_db, and HuginBase::LensDB::LensDB::Database::SaveLensProjection().

Referenced by HuginBase::LensDB::SaveLensDataFromPano().

bool HuginBase::LensDB::LensDB::SaveTCA ( const std::string &  lens,
const double  focal,
const std::vector< double > &  tca_red,
const std::vector< double > &  tca_blue,
const int  weight = 10 
)

saves the tca distortion parameters of the lens

Parameters
lensname of the lens, or for compact camera Maker|Model
focalfocal length, for which the distortion parameters should be saved
tca_redtca distortion parameters for red channel
tca_bluetca distortion parameters for blue channel
weightweight factor for given values (0-100, default is 10)
Returns
true, if saving was successful

Definition at line 2499 of file LensDB.cpp.

References m_db, and HuginBase::LensDB::LensDB::Database::SaveTCAData().

Referenced by print_result().

bool HuginBase::LensDB::LensDB::SaveVignetting ( const std::string &  lens,
const double  focal,
const double  aperture,
const double  distance,
const std::vector< double > &  vignetting,
const int  weight = 10 
)

saves the vignetting parameters of the lens

Parameters
lensname of the lens, or for compact camera Maker|Model
focalfocal length, for which the vignetting parameters should be saved
apertureaperture, for which the vignetting parameters should be saved
distancedistance, for which the vignetting parameters should be saved
vignettingvignetting parameters which should be stored
weightweight factor for given values (0-100, default is 10)
Returns
true, if saving was successful

Definition at line 2490 of file LensDB.cpp.

References m_db, and HuginBase::LensDB::LensDB::Database::SaveVignetting().

Referenced by HuginBase::LensDB::SaveLensDataFromPano(), and SaveLensParameters().

Member Data Documentation

Database* HuginBase::LensDB::LensDB::m_db
private
LensDB * HuginBase::LensDB::LensDB::m_instance =NULL
staticprivate

Definition at line 195 of file LensDB.h.

Referenced by Clean(), and GetSingleton().


The documentation for this class was generated from the following files: