Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CalculateCPStatistics.h
Go to the documentation of this file.
1 // -*- c-basic-offset: 4 -*-
26 #ifndef _BASICALGORITHMS_CALCULATECPSTSTISTICS_H
27 #define _BASICALGORITHMS_CALCULATECPSTSTISTICS_H
28 
29 #include <hugin_shared.h>
31 
32 
33 
34 namespace HuginBase {
35 
36 
39 {
40 
41  protected:
43  CalculateCPStatistics(PanoramaData& panorama, const int& imgNr=-1)
44  : PanoramaAlgorithm(panorama), o_imageNumber(imgNr), o_resultMin(0), o_resultMax(0), o_resultMean(0), o_resultVar(0)
45  {};
46 
47  public:
49  virtual ~CalculateCPStatistics() {};
50 
51 
52  public:
54  virtual bool modifiesPanoramaData() const
55  { return false; }
56 
58  virtual bool runAlgorithm() =0;
59 
60 
61  public:
63  virtual double getResultMin()
64  {
65  // [TODO] if(!hasRunSuccessfully()) DEBUG;
66  return o_resultMin;
67  }
68 
70  virtual double getResultMax()
71  {
72  // [TODO] if(!hasRunSuccessfully()) DEBUG;
73  return o_resultMax;
74  }
75 
77  virtual double getResultMean()
78  {
79  // [TODO] if(!hasRunSuccessfully()) DEBUG;
80  return o_resultMean;
81  }
82 
84  virtual double getResultVariance()
85  {
86  // [TODO] if(!hasRunSuccessfully()) DEBUG;
87  return o_resultVar;
88  }
89 
90  protected:
92  double o_resultMin, o_resultMax, o_resultMean, o_resultVar;
93 };
94 
95 
96 
97 
99 {
100 
101  public:
103  CalculateCPStatisticsError(PanoramaData& panorama, const int& imgNr=-1)
104  : CalculateCPStatistics(panorama, imgNr)
105  {};
106  CalculateCPStatisticsError(PanoramaData& panorama, const bool onlyActive, const bool ignoreLineCps=false)
107  :CalculateCPStatistics(panorama, -1), m_onlyActiveImages(onlyActive), m_ignoreLineCps(ignoreLineCps)
108  {};
109 
112 
113 
114  public:
116  static void calcCtrlPntsErrorStats(const PanoramaData& pano,
117  double & min, double & max, double & mean,
118  double & var,
119  const int& imgNr=-1,
120  const bool onlyActive=false,
121  const bool ignoreLineCp=false);
122 
123 
124  public:
126  virtual bool runAlgorithm()
127  {
128  calcCtrlPntsErrorStats(o_panorama,
129  o_resultMin, o_resultMax, o_resultMean,
130  o_resultVar,
131  o_imageNumber, m_onlyActiveImages, m_ignoreLineCps);
132  return true; // let's hope so.
133  }
134  private:
135  bool m_onlyActiveImages = false;
136  bool m_ignoreLineCps = false;
137 };
138 
139 
141 {
142 
143  public:
145  CalculateCPStatisticsRadial(PanoramaData& panorama, const int& imgNr=-1)
146  : CalculateCPStatistics(panorama, imgNr), o_resultQ10(0), o_resultQ90(0)
147  {};
148 
151 
152 
153  public:
155  static void calcCtrlPntsRadiStats(const PanoramaData& pano,
156  double & min, double & max, double & mean, double & var,
157  double & q10, double & q90,
158  const int& imgNr=-1);
159 
161  virtual double getResultPercentile10()
162  {
163  // [TODO] if(!hasRunSuccessfully()) DEBUG;
164  return o_resultQ10;
165  }
166 
168  virtual double getResultPercentile90()
169  {
170  // [TODO] if(!hasRunSuccessfully()) DEBUG;
171  return o_resultQ90;
172  }
173 
174 
175  public:
177  virtual bool runAlgorithm()
178  {
179  calcCtrlPntsRadiStats(o_panorama,
180  o_resultMin, o_resultMax, o_resultMean, o_resultVar,
181  o_resultQ10, o_resultQ90,
182  o_imageNumber);
183  return true; // let's hope so.
184  }
185 
186 
187  protected:
188  double o_resultQ10, o_resultQ90;
189 
190 };
191 
192 } //namespace
193 #endif //_H
just some common implementation; probably not so useful
CalculateCPStatisticsRadial(PanoramaData &panorama, const int &imgNr=-1)
virtual bool runAlgorithm()
implementation of the algorithm.
virtual bool modifiesPanoramaData() const
returns true if the algorithm changes the PanoramaData.
virtual bool runAlgorithm()
implementation of the algorithm.
Model for a panorama.
Definition: PanoramaData.h:81
#define IMPEX
Definition: hugin_shared.h:39
CalculateCPStatisticsError(PanoramaData &panorama, const int &imgNr=-1)
CalculateCPStatistics(PanoramaData &panorama, const int &imgNr=-1)
static T max(T x, T y)
Definition: svm.cpp:65
static T min(T x, T y)
Definition: svm.cpp:62
CalculateCPStatisticsError(PanoramaData &panorama, const bool onlyActive, const bool ignoreLineCps=false)