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)
00107             :CalculateCPStatistics(panorama, -1), m_onlyActiveImages(onlyActive)
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         
00122         
00123     public:
00125         virtual bool runAlgorithm()
00126         {
00127             calcCtrlPntsErrorStats(o_panorama, 
00128                                    o_resultMin, o_resultMax, o_resultMean,
00129                                    o_resultVar,
00130                                    o_imageNumber, m_onlyActiveImages);
00131             return true; // let's hope so.
00132         }
00133     private:
00134         bool m_onlyActiveImages = false;
00135 };
00136 
00137 
00138 class IMPEX CalculateCPStatisticsRadial : public CalculateCPStatistics
00139 {
00140     
00141     public:
00143         CalculateCPStatisticsRadial(PanoramaData& panorama, const int& imgNr=-1)
00144             : CalculateCPStatistics(panorama, imgNr), o_resultQ10(0), o_resultQ90(0)
00145         {};
00146         
00148         virtual ~CalculateCPStatisticsRadial() {};
00149         
00150         
00151     public:
00153         static void calcCtrlPntsRadiStats(const PanoramaData& pano,
00154                                           double & min, double & max, double & mean, double & var,
00155                                           double & q10, double & q90, 
00156                                           const int& imgNr=-1);
00157         
00159         virtual double getResultPercentile10()
00160         {
00161             // [TODO] if(!hasRunSuccessfully()) DEBUG;
00162             return o_resultQ10;
00163         }
00164         
00166         virtual double getResultPercentile90()
00167         {
00168             // [TODO] if(!hasRunSuccessfully()) DEBUG;
00169             return o_resultQ90;
00170         }
00171         
00172         
00173     public:
00175         virtual bool runAlgorithm()
00176         {
00177                 calcCtrlPntsRadiStats(o_panorama, 
00178                                       o_resultMin, o_resultMax, o_resultMean, o_resultVar,
00179                                       o_resultQ10, o_resultQ90,
00180                                       o_imageNumber);
00181                 return true; // let's hope so.
00182         }
00183         
00184         
00185     protected:
00186         double o_resultQ10, o_resultQ90;
00187         
00188 };
00189 
00190 } //namespace
00191 #endif //_H

Generated on 6 May 2016 for Hugintrunk by  doxygen 1.4.7