OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimRadialDecentLensDistortion.h
Go to the documentation of this file.
1 //*******************************************************************
2 //
3 // License: See top level LICENSE.txt file.
4 //
5 // Author: Garrett Potts (gpotts@imagelinks.com)
6 //
7 // Description: Modeling for lens radial and decentering distortion.
8 //
9 // The default implementation is:
10 //
11 // Let X and Y be coordinates relative to the center. Let
12 // Xc and Yc be the adjusted point so that:
13 //
14 // Xc = X + delta1X + delta2X
15 // Yc = Y + delta1Y + delta2Y
16 //
17 //
18 // delta1X = X*(k0 + k1*r^2 + k2*r^4 + k3*r^6 + k4*r^8)
19 // delta1Y = Y*(k0 + k1*r^2 + k2*r^4 + k3*r^6 + k4*r^8)
20 //
21 // delta2X = (1 + p3*r^2 + p4*r^4)[p1*(r^2 + 2*X^2) + 2*p2*X*Y]
22 // delta2Y = (1 + p3*r^2 + p4*r^4)[2*p1*X*Y + p2*(r^2 + 2*Y^2) ]
23 //
24 //
25 // Note the point that is passed in we will compute:
26 // <X, Y> = position - calibratedPrincipalPoint.
27 //
28 // so if you compute the delta then make sure that
29 // this class is constructed with principal point
30 // at 0,0
31 //
32 // Reference book: Elements of Photogrammetry Paul Wolf
33 //
34 //*******************************************************************
35 // $Id: ossimRadialDecentLensDistortion.h 22879 2014-09-03 20:19:42Z dburken $
36 #ifndef ossimRadialDecentLensDistortion_HEADER
37 #define ossimRadialDecentLensDistortion_HEADER
38 #include <iostream>
39 using namespace std;
40 
41 #include <ossim/matrix/newmat.h>
42 #include <ossim/base/ossimDpt.h>
44 
45 //*****************************************************************************
46 // CLASS
47 //*****************************************************************************
49  : public ossim2dTo2dTransform
50 {
51 public:
54  (const ossimDpt& calibratedPrincipalPoint,
55  const NEWMAT::ColumnVector &radialDistortionParameters,
56  const NEWMAT::ColumnVector &decentDistortionParameters)
57  : theCalibratedPrincipalPoint(calibratedPrincipalPoint),
58  theRadialDistortionParameters(radialDistortionParameters),
59  theDecentDistortionParameters(decentDistortionParameters)
60  { }
61 
63  : theCalibratedPrincipalPoint (copy.theCalibratedPrincipalPoint),
64  theRadialDistortionParameters (copy.theRadialDistortionParameters),
65  theDecentDistortionParameters (copy.theDecentDistortionParameters) { }
66 
68  const char* prefix);
69 
71 
81  virtual void forward(const ossimDpt& undistorted_point_in,
82  ossimDpt& distorted_point_out) const;
83 
84  virtual void forward(ossimDpt& modify_this) const
85  {
86  ossimDpt output;
87  forward(modify_this, output);
88  modify_this = output;
89  }
90 
91 
96  virtual bool saveState(ossimKeywordlist& kwl,
97  const char* prefix=0) const;
98 
103  virtual bool loadState(const ossimKeywordlist& kwl,
104  const char* prefix=0);
105 
109  void setPrincipalPoint(const ossimDpt pp);
110  void setRadialDistortionParams(const NEWMAT::ColumnVector& params);
111  void setDecentDistortionParams(const NEWMAT::ColumnVector& params);
115  virtual std::ostream& print(std::ostream& out) const;
116 
117  static const char* PRINCIPAL_POINT_X_KW;
118  static const char* PRINCIPAL_POINT_Y_KW;
119  static const char* RADIAL_DISTORTION_COEFF_KW;
120  static const char* DECENT_DISTORTION_COEFF_KW;
121 
122 protected:
128  virtual double deltaR(double radius)const;
129 
131  NEWMAT::ColumnVector theRadialDistortionParameters;
132  NEWMAT::ColumnVector theDecentDistortionParameters;
133 
134  TYPE_DATA
135 };
136 
137 //*****************************************************************************
138 // INLINE METHODS
139 //*****************************************************************************
140 inline void
142 {
143  theCalibratedPrincipalPoint = pp;
144 }
145 
147  (const NEWMAT::ColumnVector& params)
148 {
149  theRadialDistortionParameters = params;
150 }
151 
153  (const NEWMAT::ColumnVector& params)
154 {
155  theDecentDistortionParameters = params;
156 }
157 
158 
159 #endif
void setDecentDistortionParams(const NEWMAT::ColumnVector &params)
#define OSSIMDLLEXPORT
Represents serializable keyword/value map.
std::ostream & print(H5::H5File *file, std::ostream &out)
Print method.
Definition: ossimH5Util.cpp:41
void setRadialDistortionParams(const NEWMAT::ColumnVector &params)
ossimRadialDecentLensDistortion(const ossimRadialDecentLensDistortion &copy)
#define TYPE_DATA
Definition: ossimRtti.h:339
virtual void forward(ossimDpt &modify_this) const
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23