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)
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         
00108         virtual ~CalculateCPStatisticsError() {};
00109           
00110         
00111     public:
00113         static void calcCtrlPntsErrorStats(const PanoramaData& pano,
00114                                            double & min, double & max, double & mean,
00115                                            double & var,
00116                                            const int& imgNr=-1);
00117         
00118         
00119     public:
00121         virtual bool runAlgorithm()
00122         {
00123             calcCtrlPntsErrorStats(o_panorama, 
00124                                    o_resultMin, o_resultMax, o_resultMean,
00125                                    o_resultVar,
00126                                    o_imageNumber);
00127             return true; // let's hope so.
00128         }
00129         
00130 };
00131 
00132 
00133 class IMPEX CalculateCPStatisticsRadial : public CalculateCPStatistics
00134 {
00135     
00136     public:
00138         CalculateCPStatisticsRadial(PanoramaData& panorama, const int& imgNr=-1)
00139          : CalculateCPStatistics(panorama, imgNr)
00140         {};
00141         
00143         virtual ~CalculateCPStatisticsRadial() {};
00144         
00145         
00146     public:
00148         static void calcCtrlPntsRadiStats(const PanoramaData& pano,
00149                                           double & min, double & max, double & mean, double & var,
00150                                           double & q10, double & q90, 
00151                                           const int& imgNr=-1);
00152         
00154         virtual double getResultPercentile10()
00155         {
00156             // [TODO] if(!hasRunSuccessfully()) DEBUG;
00157             return o_resultQ10;
00158         }
00159         
00161         virtual double getResultPercentile90()
00162         {
00163             // [TODO] if(!hasRunSuccessfully()) DEBUG;
00164             return o_resultQ90;
00165         }
00166         
00167         
00168     public:
00170         virtual bool runAlgorithm()
00171         {
00172                 calcCtrlPntsRadiStats(o_panorama, 
00173                                       o_resultMin, o_resultMax, o_resultMean, o_resultVar,
00174                                       o_resultQ10, o_resultQ90,
00175                                       o_imageNumber);
00176                 return true; // let's hope so.
00177         }
00178         
00179         
00180     protected:
00181         double o_resultQ10, o_resultQ90;
00182         
00183 };
00184 
00185 } //namespace
00186 #endif //_H

Generated on 23 Oct 2014 for Hugintrunk by  doxygen 1.4.7