Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages
hugin_base/photometric/OptimizePhotometric.h
Go to the documentation of this file.00001 // -*- c-basic-offset: 4 -*- 00024 #ifndef _PHOTOMETRIC_OPTIMIZER_H_ 00025 #define _PHOTOMETRIC_OPTIMIZER_H_ 00026 00027 #include <stdio.h> 00028 #include <stdlib.h> 00029 #include <math.h> 00030 #include <float.h> 00031 00032 #include <string> 00033 #include <vector> 00034 #include <set> 00035 00036 #include <common/math.h> 00037 #include <PT/Panorama.h> 00038 00039 //#include <vigra_ext/VignettingCorrection.h> 00040 #include <vigra_ext/utils.h> 00041 #include <levmar/lm.h> 00042 00043 00044 namespace PT 00045 { 00046 00047 struct VarMapping 00048 { 00049 std::string type; 00050 std::set<unsigned> imgs; 00051 }; 00052 00053 00054 struct OptimData 00055 { 00056 const Panorama & m_pano; 00057 std::vector<SrcPanoImage> m_imgs; 00058 std::vector<VarMapping> m_vars; 00059 std::vector<vigra_ext::PointPairRGB> m_data; 00060 double huberSigma; 00061 bool symmetricError; 00062 00063 int m_maxIter; 00064 utils::ProgressReporter & m_progress; 00065 00066 OptimData(const Panorama & pano, const OptimizeVector & optvars, 00067 const std::vector<vigra_ext::PointPairRGB> & data, 00068 double mEstimatorSigma, bool symmetric, 00069 int maxIter, utils::ProgressReporter & progress); 00070 00071 // copy optimisation variables into x 00072 void ToX(double * x); 00073 00074 // copy new values from x to into this->m_imgs 00075 void FromX(double * x); 00076 }; 00077 00078 00079 void photometricError(double *p, double *x, int m, int n, void * data); 00080 00081 void 00082 optimizePhotometric(Panorama & pano, const OptimizeVector & vars, 00083 const std::vector<vigra_ext::PointPairRGB> & correspondences, 00084 utils::ProgressReporter & progress, 00085 double & error); 00086 00087 // local optimize definition. 00088 enum PhotometricOptimizeMode {OPT_PHOTOMETRIC_LDR=0, OPT_PHOTOMETRIC_LDR_WB, OPT_PHOTOMETRIC_HDR, OPT_PHOTOMETRIC_HDR_WB}; 00089 00092 void smartOptimizePhotometric(Panorama & pano, PhotometricOptimizeMode mode, 00093 const std::vector<vigra_ext::PointPairRGB> & correspondences, 00094 utils::ProgressReporter & progress, 00095 double & error); 00096 00097 } // namespace 00098 00099 00100 #endif
1.3.9.1