31#include "hugin_config.h"
40typedef std::vector<std::filesystem::path>
pathVec;
43template <
class iteratorType>
53 projectFiles.push_back(*
it);
57 catch(std::filesystem::filesystem_error& e)
59 std::cout << e.what() << std::endl;
81 const std::string
input = filename.string();
90 std::cout <<
"Checking " << filename.string() <<
"..." << std::endl;
92 if (
lenses.getLenses().getNumberOfParts()==1)
100 std::cout <<
" Ignored (File missing or missing metadata)" << std::endl;
110 std::cout <<
" Saved." << std::endl;
115 std::cout <<
" Ignored." << std::endl;
119 std::cout <<
" Ignored (More than one lens)." << std::endl;
125 std::cout << name <<
": tool for lens database maintenance" << std::endl
128 <<
"Usage: hugin_lensdb [--recursive] --populate BASEPATH " << std::endl
129 <<
" Populate database with information from all pto files" << std::endl
130 <<
" in given BASEPATH" << std::endl
131 <<
" With --recursive switch all subfolders will also be" << std::endl
132 <<
" searched." << std::endl
133 <<
" hugin_lensdb --compress" << std::endl
134 <<
" Compresses the database by replacing single values" << std::endl
135 <<
" with averaged values." << std::endl
136 <<
" hugin_lensdb --remove-lens=LENS" << std::endl
137 <<
" Removes given lens from the database." << std::endl
138 <<
" hugin_lensdb --remove-camera=MAKER|MODEL" << std::endl
139 <<
" Removes given camera from the database." << std::endl
140 <<
" hugin_lensdb --export-database=FILENAME" << std::endl
141 <<
" Export data from database to external file." << std::endl
142 <<
" hugin_lensdb --import-from-file=FILENAME" << std::endl
143 <<
" Import data from external file." << std::endl
230 std::cout <<
"Nothing to do." << std::endl;
236 if (std::filesystem::exists(p))
238 p = std::filesystem::absolute(p);
239 if (std::filesystem::is_directory(p))
243 if (projectFiles.empty())
245 std::cerr <<
"ERROR: No project files found in given directory " << p.string() << std::endl;
248 for (pathVec::const_iterator
it = projectFiles.begin();
it != projectFiles.end(); ++
it)
255 std::cerr <<
"ERROR: " <<
basepath <<
" is not a directory." << std::endl;
261 std::cerr <<
"ERROR: Path " <<
basepath <<
" does not exists." << std::endl;
268 std::cout <<
"Compressing database..." << std::endl;
271 std::cout <<
"Successful." << std::endl;
275 std::cout <<
"FAILED." << std::endl;
281 std::cout <<
"Removing lens \"" <<
lensToRemove <<
"\"..." << std::endl;
284 std::cout <<
"Successful." << std::endl;
288 std::cout <<
"FAILED." << std::endl;
295 if (
input.size() == 2)
297 std::cout <<
"Removing camera \"" <<
input[1] <<
"\" (Maker: \"" <<
input[0] <<
"\")..." << std::endl;
300 std::cout <<
"Successful." << std::endl;
304 std::cout <<
"FAILED." << std::endl;
309 std::cout <<
"\"" <<
camToRemove <<
"\" is not a valid string for the camera." << std::endl
310 <<
" Use syntax MAKER|MODEL (separate camera maker and model by |)" << std::endl;
316 std::cout <<
"Exporting database to \"" <<
exportDatabase <<
"\"..." << std::endl;
319 std::cout <<
"Successful." << std::endl;
323 std::cout <<
"FAILED." << std::endl;
329 std::cout <<
"Importing data from \"" <<
importDatabase <<
"\"..." << std::endl;
332 std::cout <<
"Successful." << std::endl;
336 std::cout <<
"FAILED." << std::endl;
class to access Hugins camera and lens database
Somewhere to specify what variables belong to what.
static void Clean()
cleanup the static LensDB instance, must be called at the end of the program
static LensDB & GetSingleton()
returns the static LensDB instance
std::string GetDBFilename() const
returns the filename of the lens database
bool ReadPTOFile(const std::string &filename, const std::string &prefix="")
read pto file from the given filename into Panorama object it does some checks on the file and issues...
SrcPanoImage getSrcImage(unsigned imgNr) const
get a description of a source image
void setSrcImage(unsigned int nr, const SrcPanoImage &img)
set input image parameters
std::size_t getNrOfImages() const
number of images.
All variables of a source image.
bool readEXIF()
try to fill out information about the image, by examining the exif data
bool CheckProjectFile(const std::filesystem::path filename)
int main(int argc, char *argv[])
bool iterateFileSystem(std::string src, pathVec &projectFiles)
void FindPTOFiles(pathVec &projectFiles, std::string src, bool recursive)
std::vector< std::filesystem::path > pathVec
bool SaveLensDataFromPano(const HuginBase::Panorama &pano)
routine for automatically saving information from pano into database
std::string toupper(const std::string &s)
std::vector< std::string > SplitString(const std::string &s, const std::string &sep)
split string s at given sep, returns vector of strings
std::string StrTrim(const std::string &str)
remove trailing and leading white spaces and tabs
std::string GetHuginVersion()
return a string with version numbers
std::string stripPath(const std::string &filename)
remove the path of a filename (mainly useful for gui display of filenames)
std::string getPathPrefix(const std::string &filename)
Get the path to a filename.
std::vector< deghosting::BImagePtr > threshold(const std::vector< deghosting::FImagePtr > &inputImages, const double threshold, const uint16_t flags)
Threshold function used for creating alpha masks for images.