PanoToolsUtils.cpp

Go to the documentation of this file.
00001 // -*- c-basic-offset: 4 -*-
00002 
00027 #include <hugin_config.h>
00028 
00029 #include <sstream>
00030 #include <hugin_utils/utils.h>
00031 
00032 // libpano includes ------------------------------------------------------------
00033 
00034 #include <stdlib.h>
00035 
00036 #ifdef _WIN32
00037 // include windows.h with sensible defines, otherwise
00038 // panotools might include with its stupid, commonly
00039 // named macros all over the place.
00040 #define _STLP_VERBOSE_AUTO_LINK
00041 //#define _USE_MATH_DEFINES
00042 #define NOMINMAX
00043 #define VC_EXTRALEAN
00044 #include <windows.h>
00045 #undef DIFFERENCE
00046 #endif
00047 
00048 #include "PanoToolsInterface.h"
00049 #include "PanoToolsUtils.h"
00050 
00051 namespace HuginBase { namespace PTools {
00052 
00053 void calcCtrlPointErrors (PanoramaData& pano) 
00054 {
00055     if(pano.getNrOfImages()>0 && pano.getNrOfCtrlPoints()>0)
00056     {
00057         char * p=setlocale(LC_ALL,NULL);
00058         char * oldlocale=strdup(p);
00059         setlocale(LC_ALL,"C");
00060         UIntSet allImg;
00061         std::ostringstream scriptbuf;
00062         fill_set(allImg,0, unsigned(pano.getNrOfImages()-1));
00063         //create temporary non-empty optimize vector
00064         OptimizeVector optVec;
00065         std::set<std::string> opt;
00066         opt.insert("y");
00067         for(unsigned int i=0;i<pano.getNrOfImages();i++)
00068         {
00069             optVec.push_back(opt);
00070         };
00071         pano.printPanoramaScript(scriptbuf, optVec, 
00072                 pano.getOptions(), allImg, true);
00073 
00074         char * script = 0;
00075         script = strdup(scriptbuf.str().c_str());
00076         AlignInfo ainf;
00077         if (ParseScript( script, &ainf ) == 0)
00078         {
00079             if( CheckParams( &ainf ) == 0 )
00080             {
00081                 ainf.fcn = fcnPano;
00082                 SetGlobalPtr( &ainf ); 
00083                 pano.updateCtrlPointErrors( GetAlignInfoCtrlPoints(ainf) );
00084             }
00085         }
00086         setlocale(LC_ALL,oldlocale);
00087         free(oldlocale);
00088     };
00089 }
00090 
00091 
00092 } // PTools namespace
00093 } // HuginBase namespace

Generated on 26 Nov 2014 for Hugintrunk by  doxygen 1.4.7