49static std::map<HuginBase::BaseSrcPanoImage::Projection, std::string>
lensTypeNames;
55 for (
int n = 0;
n <
nP; ++
n)
89 return variable.find(value) != std::string::npos;
94 return variable.find(value) == std::string::npos;
96 std::cerr <<
"Invalid operator \"" <<
operatorString <<
"\"" << std::endl;
101template<
class Number>
128 std::cerr <<
"Invalid operator \"" <<
operatorString <<
"\"" << std::endl;
138 std::cerr <<
"Invalid number \"" <<
stringValue <<
"\"" << std::endl;
150 std::cerr <<
"Invalid number \"" <<
stringValue <<
"\"" << std::endl;
160 if (
pos != std::string::npos)
167 if (
pos2 != std::string::npos)
175 std::cerr <<
"Missing value in comparison \"" <<
condition <<
"\"." << std::endl;
259 std::cout <<
"Fit panorama field of view to best size" << std::endl;
266 std::cout <<
"Setting field of view to " << options.
getHFOV() <<
" x " << options.
getVFOV() << std::endl;
280 std::cout <<
"Setting field of view to " << options.
getHFOV() <<
" x " << options.
getVFOV() << std::endl;
287 if (canvas ==
"auto" || canvas.back() ==
'%')
290 if (canvas.back() ==
'%')
294 std::cout <<
"Invalid scale factor \"" << canvas <<
"\" for canvas" << std::endl;
300 std::cout <<
"Calculate optimal size of panorama" << std::endl;
305 std::cout <<
"Setting canvas size to " << options.
getWidth() <<
" x " << options.
getHeight() << std::endl;
312 int n =
sscanf(canvas.c_str(),
"%dx%d", &width, &height);
313 if (
n == 2 && width > 0 && height > 0)
317 std::cout <<
"Setting canvas size to " << options.
getWidth() <<
" x " << options.
getHeight() << std::endl;
321 std::cerr <<
"Could not parse canvas size \"" << canvas <<
"\"." << std::endl;
330 std::cout <<
"Searching for best crop rectangle" << std::endl;
357 std::cout <<
"Set crop size to " <<
roi.left() <<
"," <<
roi.top() <<
"," <<
roi.right() <<
"," <<
roi.bottom() << std::endl;
361 std::cerr <<
"Could not find best crop rectangle" << std::endl;
369 double left, right, top, bottom;
372 if (
n == 4 && right > left && bottom > top && left >= 0.0 && top >= 0.0 && right <= 100.0 && bottom <= 100.0)
377 std::cout <<
"Set crop size to " << options.
getROI().left() <<
"," << options.
getROI().top() <<
"," <<
378 options.
getROI().right() <<
"," << options.
getROI().bottom() << std::endl;
383 std::cerr <<
"Invalid crop area \"" <<
cropString <<
"\"" << std::endl;
389 int left, right, top, bottom;
392 if (
n == 4 && right > left && bottom > top && left >= 0 && top >= 0)
394 options.
setROI(vigra::Rect2D(left, top, right, bottom));
395 std::cout <<
"Set crop size to " << options.
getROI().left() <<
"," << options.
getROI().top() <<
"," <<
396 options.
getROI().right() <<
"," << options.
getROI().bottom() << std::endl;
401 std::cerr <<
"Invalid crop area \"" <<
cropString <<
"\"" << std::endl;
409 if (exposure ==
"auto")
412 std::cout <<
"Setting output exposure value to " << options.
outputExposureValue << std::endl;
416 if (!exposure.empty() && exposure.front() ==
'r')
422 std::cout <<
"Setting output exposure value to " << options.
outputExposureValue << std::endl;
426 std::cerr <<
"Value \"" << exposure <<
"\" is not a valid exposure value." << std::endl;
435 std::cout <<
"Setting output exposure value to " << options.
outputExposureValue << std::endl;
439 std::cerr <<
"Value \"" << exposure <<
"\" is not a valid exposure value." << std::endl;
468 if (
s ==
"NORMAL" ||
s ==
"N")
471 std::cout <<
"Activate output of normal panorama." << std::endl;
474 if (
s ==
"STACKSFUSEDBLENDED" ||
s ==
"FB")
477 std::cout <<
"Activate output of LDR panorama: Exposure fused from stacks." << std::endl;
480 if (
s ==
"EXPOSURELAYERSFUSED" ||
s ==
"BF")
483 std::cout <<
"Activate output of LDR panorama: Exposure fused from any arrangement." << std::endl;
489 std::cout <<
"Activate output of hdr panorama." << std::endl;
496 std::cout <<
"Activate output of remapped, exposure corrected images." << std::endl;
499 if (
s ==
"REMAPORIG")
502 std::cout <<
"Activate output of remapped images with unmodified exposure." << std::endl;
508 std::cout <<
"Activate output of remapped hdr images." << std::endl;
512 if (
s ==
"FUSEDSTACKS")
515 std::cout <<
"Activate output of exposure fused stacks." << std::endl;
518 if (
s ==
"HDRSTACKS")
521 std::cout <<
"Activate output of HDR stacks." << std::endl;
525 if (
s ==
"EXPOSURELAYERS")
528 std::cout <<
"Activate output of exposure layers." << std::endl;
531 std::cerr <<
"Unknown parameter \"" <<
s <<
"\" found in Output-type." << std::endl
532 <<
"Ignoring this parameter." << std::endl;
544 std::cout <<
"Setting TIF compression to \"" <<
ldrCompression <<
"\"." << std::endl;
549 std::cout <<
"LDR compression \"" <<
ldrCompression <<
"\" is not a valid compression value for TIF files." << std::endl;
560 if (quality > 0 && quality <= 100)
563 std::cout <<
"Setting JPEG quality to " << quality <<
"." << std::endl;
567 std::cerr <<
"Given value for JPEG quality is outside the valid range 1..100." << std::endl;
572 std::cerr <<
"Could not parse \"" <<
ldrCompression <<
"\" as a valid JPEG quality number." << std::endl;
579 std::cerr <<
"Setting compression for PNG images is not supported." << std::endl;
584 std::cerr <<
"Unknown image format" << std::endl;
597 std::cout <<
"Setting HDR-TIF compression to \"" <<
hdrCompression <<
"\"." << std::endl;
601 std::cerr <<
"HDR compression \"" <<
hdrCompression <<
"\" is not a valid compression value for TIF files." << std::endl;
608 std::cerr <<
"Setting compression for EXR images is not supported." << std::endl;
613 std::cerr <<
"Unknown HDR image format" << std::endl;
625 for (
const auto&
key : keys)
628 if (
key.compare(0, 9,
"Condition") == 0)
640 std::cout <<
"Applying settings from \"" <<
section <<
"\"" << std::endl;
646 if (!projection.empty())
657 SetFOV(fov, pano, options);
680 if (!exposure.empty())
696 std::cout <<
"Setting blender type to \"ENBLEND\"." << std::endl;
703 std::cout <<
"Setting blender type to \"INTERNAL\"." << std::endl;
707 std::cerr <<
"Blender \"" <<
blender <<
"\" is not a valid blender ." << std::endl
708 <<
"Ignoring parameter." << std::endl;
719 std::cout <<
"Setting enblend arguments to " <<
blenderArgs << std::endl;
723 std::cout <<
"Setting verdandi arguments to " <<
blenderArgs << std::endl;
726 std::cout <<
"Unknown blender in pto file." << std::endl;
738 std::cout <<
"Setting ldr output to filetype \"" <<
ldrFileType <<
"\"." << std::endl;
742 std::cerr <<
"LDR file format \"" <<
ldrFileType <<
"\" is not a valid LDR output filetype." << std::endl;
759 std::cout <<
"Setting hdr output to filetype \"" <<
hdrFileType <<
"\"." << std::endl;
763 std::cerr <<
"HDR file format \"" <<
hdrFileType <<
"\" is not a valid HDR output filetype." << std::endl;
775 std::cout <<
"Ignoring settings from \"" <<
section <<
"\" because condition is not fulfilled." << std::endl;
reads and parse an ini file
declaration of functions to handle stacks and layers
void SetLDRCompression(const std::string ldrCompression, HuginBase::PanoramaOptions &options)
void ProcessSection(const IniParser &iniParser, const std::string §ion, HuginBase::Panorama &pano, HuginBase::PanoramaOptions &options, const PanoProperties &panoProps)
process the given section, check if all conditions are fulfilled and if so apply all wished settings
static std::map< HuginBase::BaseSrcPanoImage::Projection, std::string > lensTypeNames
void SetExposure(const std::string &exposure, HuginBase::Panorama &pano, HuginBase::PanoramaOptions &options)
void SetCanvas(const std::string &canvas, HuginBase::Panorama &pano, HuginBase::PanoramaOptions &options)
bool CheckInt(const int variable, const std::string &operatorString, const std::string &stringValue)
check if given integer matches the condition (operator and value)
void SetProjection(const std::string &projectionString, HuginBase::PanoramaOptions &options)
bool CheckCondition(const std::string &condition, const HuginBase::Panorama &pano, const PanoProperties &panoProps)
check if given condition is fulfilled by given panorama and PanoProperties
static std::vector< std::string > projectionNames
bool CheckString(const std::string &variable, const std::string &operatorString, const std::string &value)
check if given string matches the value with the corresponding operator
void SetFOV(const std::string &fov, HuginBase::Panorama &pano, HuginBase::PanoramaOptions &options)
void SetHDRCompression(const std::string hdrCompression, HuginBase::PanoramaOptions &options)
HuginBase::PanoramaOptions ReadPanoramaOptionsFromIni(const std::string &iniFile, HuginBase::Panorama &pano)
read settings from given ini file and apply wished settings if they are applicable
bool CheckNumber(const Number variable, const std::string &operatorString, const Number value)
general number comparison function
void SetCrop(const std::string &cropString, HuginBase::Panorama &pano, HuginBase::PanoramaOptions &options)
void SetOutputType(const std::string &outputType, HuginBase::PanoramaOptions &options)
void ReadProjectionNames()
bool CheckDouble(const double variable, const std::string &operatorString, const std::string &stringValue)
check if given double matches the condition (operator and value)
read settings from ini file and apply only applicable values
Dummy progress display, without output.
virtual double getResultHorizontalFOV()
virtual double getResultHeight()
static double calcMeanExposure(const PanoramaData &pano)
static double calcOptimalScale(PanoramaData &panorama)
virtual void run()
runs the algorithm.
void setHFOV(double h, bool keepView=true)
set the horizontal field of view.
bool outputHDRLayers
save remapped layers (HDR)
bool outputLDRExposureLayers
save blended exposure layers, do not perform fusion (no exposure adjustment)
void setProjection(ProjectionFormat f)
set the Projection format and adjust the hfov/vfov if nessecary
bool fovCalcSupported(ProjectionFormat f) const
true, if FOV calcuations are supported for projection f
BlendingMechanism blendMode
bool outputLDRExposureBlended
< save exposure fused stacks (no exposure adjustment)
void setHeight(unsigned int h)
set panorama height
std::string verdandiOptions
bool outputLDRExposureRemapped
save remapped layers (no exposure adjustment)
const vigra::Rect2D & getROI() const
void setWidth(unsigned int w, bool keepView=true)
set panorama width keep the HFOV, if keepView=true
void setROI(const vigra::Rect2D &val)
bool outputLDRBlended
save blended panorama (LDR)
bool outputLDRLayers
save remapped layers (LDR)
unsigned int getWidth() const
PanoramaOptions::ProjectionFormat getProjection() const
double outputExposureValue
bool outputHDRStacks
save image stacks (HDR)
std::string enblendOptions
std::string tiffCompression
ProjectionFormat
Projection of final panorama.
bool outputLDRExposureLayersFused
save blended exposure layers which are then fused (no exposure adjustment)
std::string outputImageType
std::string outputImageTypeHDRCompression
std::string outputImageTypeHDR
std::string outputImageTypeCompression
unsigned int getHeight() const
get panorama height
bool outputHDRBlended
save blended panorama (HDR)
const SrcPanoImage & getImage(std::size_t nr) const
get a panorama image, counting starts with 0
const PanoramaOptions & getOptions() const
returns the options for this panorama
void setOptions(const PanoramaOptions &opt)
set new output settings This is not used directly for optimizing/stiching, but it can be feed into ru...
void setSrcImage(unsigned int nr, const SrcPanoImage &img)
set input image parameters
Panorama duplicate() const
duplicate the panorama
UIntSet getActiveImages() const
get active images
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
A simple parser for ini files, it implements only some basic features.
int Read(const std::string &file)
Reads the given ini file.
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 GetAbsoluteFilename(const std::string &filename)
returns the full absolute filename
std::string StrTrim(const std::string &str)
remove trailing and leading white spaces and tabs
std::string tolower(const std::string &s)
convert a string to lowercase
bool stringToDouble(const STR &str_, double &dest)
convert a string to a double, ignore localisation.
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.
bool stringToInt(const std::string &s, int &val)
convert string to integer value, returns true, if sucessful
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.