Hugin trunk 0.1
Loading...
Searching...
No Matches
PanoToolsUtils.cpp
Go to the documentation of this file.
1// -*- c-basic-offset: 4 -*-
2
27#include <hugin_config.h>
28
29#include <sstream>
30#include <hugin_utils/utils.h>
31
32// libpano includes ------------------------------------------------------------
33
34#include <stdlib.h>
35
36#ifdef _WIN32
37// include windows.h with sensible defines, otherwise
38// panotools might include with its stupid, commonly
39// named macros all over the place.
40#define _STLP_VERBOSE_AUTO_LINK
41//#define _USE_MATH_DEFINES
42#define NOMINMAX
43#define VC_EXTRALEAN
44#include <windows.h>
45#undef DIFFERENCE
46#endif
47
48#include "PanoToolsInterface.h"
49#include "PanoToolsUtils.h"
50
51namespace HuginBase { namespace PTools {
52
54{
55 if(pano.getNrOfImages()>0 && pano.getNrOfCtrlPoints()>0)
56 {
57 char * p=setlocale(LC_ALL,NULL);
58 char * oldlocale=strdup(p);
59 setlocale(LC_ALL,"C");
61 std::ostringstream scriptbuf;
62 fill_set(allImg,0, unsigned(pano.getNrOfImages()-1));
63 //create temporary non-empty optimize vector
65 std::set<std::string> opt;
66 opt.insert("y");
67 for(unsigned int i=0;i<pano.getNrOfImages();i++)
68 {
69 optVec.push_back(opt);
70 };
72 pano.getOptions(), allImg, true);
73
74 char * script = 0;
75 script = strdup(scriptbuf.str().c_str());
77 if (ParseScript( script, &ainf ) == 0)
78 {
79 if( CheckParams( &ainf ) == 0 )
80 {
81 ainf.fcn = fcnPano;
82 SetGlobalPtr( &ainf );
84 }
85 }
87 free(script);
90 };
91}
92
93
94} // PTools namespace
95} // HuginBase namespace
Utility calls into PanoTools using CPP interface.
Model for a panorama.
virtual std::size_t getNrOfCtrlPoints() const =0
number of control points
virtual const PanoramaOptions & getOptions() const =0
returns the options for this panorama
virtual void updateCtrlPointErrors(const CPVector &controlPoints)=0
update control points distances.
virtual void printPanoramaScript(std::ostream &o, const OptimizeVector &optvars, const PanoramaOptions &options, const UIntSet &imgs, bool forPTOptimizer, const std::string &stripPrefix="") const =0
create an optimizer script
virtual std::size_t getNrOfImages() const =0
number of images.
void calcCtrlPointErrors(PanoramaData &pano)
Update the Ctrl Point errors without optimizing.
CPVector GetAlignInfoCtrlPoints(const AlignInfo &gl)
mainly consists of wrapper around the pano tools library, to assist in ressource management and to pr...
Definition wxcms.cpp:39
std::vector< std::set< std::string > > OptimizeVector
std::set< unsigned int > UIntSet
void fill_set(_Container &c, typename _Container::key_type begin, typename _Container::key_type end)
Definition stl_utils.h:81
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.
Definition threshold.h:41