Lens distortion correction division model 1p
 All Classes Files Functions Variables
lens_distortion_model.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 2010-2013, AMI RESEARCH GROUP <lalvarez@dis.ulpgc.es>
3  License : CC Creative Commons "Attribution-NonCommercial-ShareAlike"
4  see http://creativecommons.org/licenses/by-nc-sa/3.0/es/deed.en
5  */
6 
7 
8  #ifndef AMI_DLL_H
9  #define AMI_DLL_H
10 #endif
11 
17 #ifndef LENS_DISTORTION_MODEL_H
18 #define LENS_DISTORTION_MODEL_H
19 
20 
21 #include "../ami_primitives/point2d.h"
22 
23 #ifdef __AMIDEBUG__
24  #include "wxAmiDebugLog.h"
25 #endif
26 
27 using namespace ami;
28 using namespace std;
29 
30 namespace ami
31 {
38 class AMI_DLL_H lens_distortion_model{
39  std::vector<double> d ;
41 
42 
43 public:
44  lens_distortion_model(){c.x=0; c.y=0;}; // CONSTRUCTOR WITHOUT TAKING MEMORY
45  ~lens_distortion_model(){d.clear();} ;
46 
52  std::vector<double> &get_d(){return d;}
53 
54 
59  const std::vector<double> &get_d() const {return d;}
60 
66  void set_d(const std::vector<double> &d_2){d=d_2;}
67  void set_d(std::vector<double> &d_2){d=d_2;}
68 
74  void set_distortion_center(const point2d<double> &c2){c=c2;}
75 
83 
88  const point2d<double> &get_distortion_center() const {return c;}
89 
96  point2d<double> evaluation_quotient(const point2d<double> &p) const;
97  point2d<double> evaluation_quotient(point2d<double> &p);
98 
105  point2d<double> evaluation(const point2d<double> &p) const;
106  point2d<double> evaluation(point2d<double> &p);
107 
114  point2d<double> inverse_evaluation(const point2d<double> &p) const;
115  point2d<double> inverse_evaluation(point2d<double> &p);
116 
123  point2d<double> inverse_evaluation_quotient(const point2d<double> &p) const;
124  point2d<double> inverse_evaluation_quotient(point2d<double> &p);
125 
132  point2d<double> inverse_evaluation_fast(point2d<double> &p,double dl1r, double *a, int Na);
133 
140  std::vector<point2d<double> > evaluation(const std::vector<point2d<double> > & ptl) const{
141  std::vector<point2d<double> > res;
142  for(int i=0;i<((int)ptl.size());i++)
143  {
144  res.push_back(evaluation(ptl[i]));
145  }
146  return res;
147  }
148 
154  int read(char name[300]);
155 
161  int write(char name[300]);
162 
169  void reset(){d.clear(); c.x=0; c.y=0; /*H.reset();*/}
170 
171 
172 };
173 
174 
175 
176 
177 }
178 
179 #endif
void reset()
Reset to initial state.
Definition: lens_distortion_model.h:169
point2d< double > & get_distortion_center()
This function returns the center of the lens distortion model.
Definition: lens_distortion_model.h:82
Class to store distortion model and basic methods.
Definition: lens_distortion_model.h:38
void set_d(const std::vector< double > &d_2)
Method for setting the lens distortion model parameters.
Definition: lens_distortion_model.h:66
void set_distortion_center(const point2d< double > &c2)
Method for setting the center of the lens distortion model.
Definition: lens_distortion_model.h:74
std::vector< double > & get_d()
This function returns the vector with the lens distortion model parameters.
Definition: lens_distortion_model.h:52