28#include <hugin_config.h>
48static void usage(
const char* name)
50 std::cout << name <<
": optimize image positions" << std::endl
53 <<
"Usage: " << name <<
" [options] input.pto" << std::endl
54 <<
" To read a project from stdio, specify - as input file." << std::endl
56 <<
" Options:" << std::endl
57 <<
" -o file.pto output file. If omitted, stdout is used." << std::endl
59 <<
" Optimisation options (if not specified, no optimisation takes place)" << std::endl
60 <<
" -a auto align mode, includes various optimisation stages, depending" << std::endl
61 <<
" on the amount and distribution of the control points" << std::endl
62 <<
" -p pairwise optimisation of yaw, pitch and roll, starting from" << std::endl
63 <<
" first image" << std::endl
64 <<
" -m Optimise photometric parameters" << std::endl
65 <<
" -n Optimize parameters specified in script file (like PTOptimizer)" << std::endl
67 <<
" Postprocessing options:" << std::endl
68 <<
" -l level horizon (works best for horizontal panos)" << std::endl
69 <<
" -s automatically select a suitable output projection and size" << std::endl
70 <<
" Other options:" << std::endl
71 <<
" -q quiet operation (no progress is reported)" << std::endl
72 <<
" -v HFOV specify horizontal field of view of input images." << std::endl
73 <<
" Used if the .pto file contains invalid HFOV values" << std::endl
74 <<
" (autopano-SIFT writes .pto files with invalid HFOV)" << std::endl
76 <<
" --only-active-images take only active images into account when" << std::endl
77 <<
" optimising (only valid with -n switch)" << std::endl
79 <<
" When using -a -l -m and -s options together, a similar operation to the" << std::endl
80 <<
" \"Align\" button in hugin is performed." << std::endl
181 std::cerr <<
"Panorama should consist of at least one image" << std::endl;
190 && img.getHFOV() >= 180)
193 std::cerr <<
"HFOV of image " << img.getFilename() <<
" invalid, trying to read EXIF tags" << std::endl;
204 std::cerr <<
"EXIF reading failed, please specify HFOV with -v" << std::endl;
216 std::cerr <<
"Panorama have to have control points to optimise positions" << std::endl;
227 std::cerr <<
"*** Pairwise position optimisation" << std::endl;
235 std::cerr <<
"*** Adaptive geometric optimisation" << std::endl;
245 std::cerr <<
"*** Optimising parameters specified in PTO file (active images only)" << std::endl;
249 if (activeImages.empty())
251 std::cerr <<
"*** Image contains no active images. Nothing to do." << std::endl;
266 std::cerr <<
"*** Optimising parameters specified in PTO file" << std::endl;
275 std::cerr <<
"*** Geometric parameters not optimized" << std::endl;
293 std::cout <<
"Skipping automatic leveling because of existing vertical control points." << std::endl;
316 const double hfov = opts.
getHFOV();
318 const double mf = 100;
323 switch (pano.
getImage(0).getProjection())
412 std::vector<vigra_ext::PointPairRGB>
points;
427 catch (std::exception& e)
429 std::cerr <<
"caught exception: " << e.what() << std::endl;
434 std::cout <<
"\rSelected " <<
points.size() <<
" points" << std::endl;
439 std::cerr <<
"Error: no overlapping points found, exiting" << std::endl;
447 HuginBase::ImageVariableGroup::IVE_EMoRParams,
448 HuginBase::ImageVariableGroup::IVE_ResponseType,
449 HuginBase::ImageVariableGroup::IVE_VigCorrMode,
450 HuginBase::ImageVariableGroup::IVE_RadialVigCorrCoeff,
451 HuginBase::ImageVariableGroup::IVE_RadialVigCorrCenterShift
455 for (
size_t i = 0;
i <
lenses.getNumberOfParts();
i++)
457 std::set<HuginBase::ImageVariableGroup::ImageVariableEnum>
links_needed;
459 for (
int v = 0;
v < 5;
v++)
461 if (!
lenses.getVarLinkedInPart(vars[
v],
i))
468 std::set<HuginBase::ImageVariableGroup::ImageVariableEnum>::iterator
it;
497 std::cout <<
"Written output to " <<
output << std::endl;
Declare the ImageVariableGroup and ImageVariableGroupObserver classes.
!! from PTOptimise.h 1951
Somewhere to specify what variables belong to what.
int main(int argc, char *argv[])
Dummy progress display, without output.
a progress display to print progress reports to a stream
static void autoOptimise(PanoramaData &pano, bool optRoll=true)
virtual double getResultHorizontalFOV()
virtual double getResultHeight()
static double calcMeanExposure(const PanoramaData &pano)
static double calcOptimalScale(PanoramaData &panorama)
@ X
evaluate x, points are on a vertical line
Same as above, but use a non const panorama.
void linkVariablePart(ImageVariableEnum variable, unsigned int partNr)
link one of the variables across a given part
virtual void run()
runs the algorithm.
void setHFOV(double h, bool keepView=true)
set the horizontal field of view.
void setProjection(ProjectionFormat f)
set the Projection format and adjust the hfov/vfov if nessecary
void setHeight(unsigned int h)
set panorama height
void setWidth(unsigned int w, bool keepView=true)
set panorama width keep the HFOV, if keepView=true
unsigned int getWidth() const
PanoramaOptions::ProjectionFormat getProjection() const
double outputExposureValue
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
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
std::size_t getNrOfCtrlPoints() const
number of control points
void updateOptimizeVector()
updates the optimize vector according to master switches
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
const CPVector & getCtrlPoints() const
get all control point of this Panorama
virtual void updateVariables(const VariableMapVector &vars)
Set the variables.
Panorama getSubset(const UIntSet &imgs) const
get a subset of the panorama
const OptimizeVector & getOptimizeVector() const
return the optimize settings stored inside panorama
bool WritePTOFile(const std::string &filename, const std::string &prefix="")
write data to given pto file
UIntSet getActiveImages() const
get active images
std::size_t getNrOfImages() const
number of images.
static void smartOptimize(PanoramaData &pano)
PhotometricOptimizeMode
local optimize definition.
All variables of a source image.
bool applyEXIFValues(bool applyEVValue=true)
apply values found in EXIF data to SrcPanoImage class, call readEXIF() before to initialize some valu...
bool readEXIF()
try to fill out information about the image, by examining the exif data
std::vector< ControlPoint > CPVector
std::set< unsigned int > UIntSet
std::string GetHuginVersion()
return a string with version numbers
std::string GetOutputFilename(const std::string &out, const std::string &in, const std::string &suffix)
construct output filename, if ouput is known return this value otherwise use the input filename and a...
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.