CalculateCPStatistics.h

Go to the documentation of this file.
00001 // -*- c-basic-offset: 4 -*-
00026 #ifndef _BASICALGORITHMS_CALCULATECPSTSTISTICS_H
00027 #define _BASICALGORITHMS_CALCULATECPSTSTISTICS_H
00028 
00029 #include <hugin_shared.h>
00030 #include <algorithms/PanoramaAlgorithm.h>
00031 
00032 
00033 
00034 namespace HuginBase {
00035 
00036 
00038 class IMPEX CalculateCPStatistics : public PanoramaAlgorithm
00039 {
00040 
00041     protected:
00043         CalculateCPStatistics(PanoramaData& panorama, const int& imgNr=-1)
00044             : PanoramaAlgorithm(panorama), o_imageNumber(imgNr), o_resultMin(0), o_resultMax(0), o_resultMean(0), o_resultVar(0)
00045         {};
00046         
00047     public:
00049         virtual ~CalculateCPStatistics() {};
00050         
00051         
00052     public:
00054         virtual bool modifiesPanoramaData() const
00055             { return false; }
00056             
00058         virtual bool runAlgorithm() =0;
00059           
00060         
00061     public:
00063         virtual double getResultMin()
00064         {
00065             // [TODO] if(!hasRunSuccessfully()) DEBUG;
00066             return o_resultMin;
00067         }
00068         
00070         virtual double getResultMax()
00071         {
00072             // [TODO] if(!hasRunSuccessfully()) DEBUG;
00073             return o_resultMax;
00074         }
00075         
00077         virtual double getResultMean()
00078         {
00079             // [TODO] if(!hasRunSuccessfully()) DEBUG;
00080             return o_resultMean;
00081         }
00082     
00084         virtual double getResultVariance()
00085         {
00086             // [TODO] if(!hasRunSuccessfully()) DEBUG;
00087             return o_resultVar;
00088         }
00089         
00090     protected:
00091         int o_imageNumber;
00092         double o_resultMin, o_resultMax, o_resultMean, o_resultVar;
00093 };
00094     
00095     
00096     
00097     
00098 class IMPEX CalculateCPStatisticsError : public CalculateCPStatistics
00099 {
00100 
00101     public:
00103         CalculateCPStatisticsError(PanoramaData& panorama, const int& imgNr=-1)
00104          : CalculateCPStatistics(panorama, imgNr)
00105         {};
00106         CalculateCPStatisticsError(PanoramaData& panorama, const bool onlyActive, const bool ignoreLineCps=false)
00107             :CalculateCPStatistics(panorama, -1), m_onlyActiveImages(onlyActive), m_ignoreLineCps(ignoreLineCps)
00108         {};
00109         
00111         virtual ~CalculateCPStatisticsError() {};
00112           
00113         
00114     public:
00116         static void calcCtrlPntsErrorStats(const PanoramaData& pano,
00117                                            double & min, double & max, double & mean,
00118                                            double & var,
00119                                            const int& imgNr=-1, 
00120                                            const bool onlyActive=false,
00121                                            const bool ignoreLineCp=false);
00122         
00123         
00124     public:
00126         virtual bool runAlgorithm()
00127         {
00128             calcCtrlPntsErrorStats(o_panorama, 
00129                                    o_resultMin, o_resultMax, o_resultMean,
00130                                    o_resultVar,
00131                                    o_imageNumber, m_onlyActiveImages, m_ignoreLineCps);
00132             return true; // let's hope so.
00133         }
00134     private:
00135         bool m_onlyActiveImages = false;
00136         bool m_ignoreLineCps = false;
00137 };
00138 
00139 
00140 class IMPEX CalculateCPStatisticsRadial : public CalculateCPStatistics
00141 {
00142     
00143     public:
00145         CalculateCPStatisticsRadial(PanoramaData& panorama, const int& imgNr=-1)
00146             : CalculateCPStatistics(panorama, imgNr), o_resultQ10(0), o_resultQ90(0)
00147         {};
00148         
00150         virtual ~CalculateCPStatisticsRadial() {};
00151         
00152         
00153     public:
00155         static void calcCtrlPntsRadiStats(const PanoramaData& pano,
00156                                           double & min, double & max, double & mean, double & var,
00157                                           double & q10, double & q90, 
00158                                           const int& imgNr=-1);
00159         
00161         virtual double getResultPercentile10()
00162         {
00163             // [TODO] if(!hasRunSuccessfully()) DEBUG;
00164             return o_resultQ10;
00165         }
00166         
00168         virtual double getResultPercentile90()
00169         {
00170             // [TODO] if(!hasRunSuccessfully()) DEBUG;
00171             return o_resultQ90;
00172         }
00173         
00174         
00175     public:
00177         virtual bool runAlgorithm()
00178         {
00179                 calcCtrlPntsRadiStats(o_panorama, 
00180                                       o_resultMin, o_resultMax, o_resultMean, o_resultVar,
00181                                       o_resultQ10, o_resultQ90,
00182                                       o_imageNumber);
00183                 return true; // let's hope so.
00184         }
00185         
00186         
00187     protected:
00188         double o_resultQ10, o_resultQ90;
00189         
00190 };
00191 
00192 } //namespace
00193 #endif //_H

Generated on 24 Jun 2017 for Hugintrunk by  doxygen 1.4.7