OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimRpcModel.h
Go to the documentation of this file.
1 //*****************************************************************************
2 // FILE: ossimRpcModel.h
3 //
4 // License: See top level LICENSE.txt file.
5 //
6 // AUTHOR: Oscar Kramer
7 //
8 // DESCRIPTION: Contains declaration of class ossimRpcModel.
9 // This is a replacement model utilizing the Rational Polynomial Coefficients
10 // (RPC), a.k.a. Rapid Positioning Capability, and Universal Sensor Model
11 // (USM).
12 //
13 //*****************************************************************************
14 // $Id: ossimRpcModel.h 16174 2009-12-23 16:34:06Z dburken $
15 
16 #ifndef ossimRpcModel_HEADER
17 #define ossimRpcModel_HEADER
18 
20 #include <ossim/base/ossimIpt.h>
23 #include <ossim/ossimConfig.h>
25 
26 /*!****************************************************************************
27  *
28  * CLASS: ossimRpcModel
29  *
30  *****************************************************************************/
32 {
33 public:
34  //***
35  // Enumeration of supported RPC polynomial formats:
36  //***
38  {
39  A='A', // corresponds to "RPC00A"
40  B='B' // corresponds to "RPC00B"
41  };
42 
45  {
46  double lineScale;
47  double sampScale;
48  double latScale;
49  double lonScale;
50  double hgtScale;
51  double lineOffset;
52  double sampOffset;
53  double latOffset;
54  double lonOffset;
55  double hgtOffset;
56  double lineNumCoef[20];
57  double lineDenCoef[20];
58  double sampNumCoef[20];
59  double sampDenCoef[20];
60  char type;
61  };
62 
64  ossimRpcModel();
65 
67  ossimRpcModel(const ossimRpcModel& copy_this);
68 
69  void setAttributes(ossim_float64 theSampleOffset,
70  ossim_float64 theLineOffset,
71  ossim_float64 theSampleScale,
72  ossim_float64 theLineScale,
73  ossim_float64 theLatOffset,
74  ossim_float64 theLonOffset,
75  ossim_float64 theHeightOffset,
76  ossim_float64 theLatScale,
77  ossim_float64 theLonScale,
78  ossim_float64 theHeightScale,
79  const std::vector<double>& xNumeratorCoeffs,
80  const std::vector<double>& xDenominatorCoeffs,
81  const std::vector<double>& yNumeratorCoeffs,
82  const std::vector<double>& yDenominatorCoeffs,
83  PolynomialType polyType = B,
84  bool computeGsdFlag=true);
85 
86  void setMetersPerPixel(const ossimDpt& metersPerPixel);
87 
101  void setPositionError(const ossim_float64& biasError,
102  const ossim_float64& randomError,
103  bool initNominalPostionErrorFlag);
104 
110  virtual void worldToLineSample(const ossimGpt& world_point,
111  ossimDpt& image_point) const;
116  virtual std::ostream& print(std::ostream& out) const;
117 
123  virtual bool saveState(ossimKeywordlist& kwl,
124  const char* prefix=0) const;
125 
131  virtual bool loadState(const ossimKeywordlist& kwl,
132  const char* prefix=0);
133 
134  //***
135  // @brief lineSampleToWorld()
136  // Overrides base class pure virtual. Intersects DEM.
137  //***
138  virtual void lineSampleToWorld(const ossimDpt& image_point,
139  ossimGpt& world_point) const;
140  //***
141  // @brief lineSampleHeightToWorld()
142  // Overrides base class pure virtual. Height understood to be relative to
143  // standard ellipsoid.
144  //***
145  virtual void lineSampleHeightToWorld(const ossimDpt& image_point,
146  const double& heightEllipsoid,
147  ossimGpt& worldPoint) const;
148 
153  virtual void imagingRay(const ossimDpt& image_point,
154  ossimEcefRay& image_ray) const;
155 
161  static void writeGeomTemplate(ostream& os);
162 
163  virtual void updateModel();
164  virtual void initAdjustableParameters();
165 
170  virtual ossimObject* dup() const;
171 
172  inline virtual bool useForward()const {return false;}
173 
175  virtual bool setupOptimizer(const ossimString& init_file);
176 
189  virtual ossimDpt getForwardDeriv(int parmIdx,
190  const ossimGpt& gpos,
191  double h);
192 
198  double getBiasError() const;
199 
205  double getRandError() const;
206 
211  void getRpcParameters(ossimRpcModel::rpcModelStruct& model) const;
212 
218  void setImageOffset(const ossimDpt& offset_to_chip_ul);
219 
223  bool toJSON(std::ostream& json) const;
224 
229  bool toRPB(std::ostream &out) const;
230 
231 protected:
233  {
234  INTRACK_OFFSET = 0,
239 // YAW_OFFSET,
240  NUM_ADJUSTABLE_PARAMS // not an index
241  };
242 
244  virtual ~ossimRpcModel();
245 
246  //***
247  // Methods for computing RPC polynomial and its derivatives:
248  //***
249  double polynomial(const double& nlat,
250  const double& nlon,
251  const double& nhgt,
252  const double* coeffs) const;
253  double dPoly_dLat(const double& nlat,
254  const double& nlon,
255  const double& nhgt,
256  const double* coeffs) const;
257  double dPoly_dLon(const double& nlat,
258  const double& nlon,
259  const double& nhgt,
260  const double* coeffs) const;
261  double dPoly_dHgt(const double& nlat,
262  const double& nlon,
263  const double& nhgt,
264  const double* coeffs) const;
265 
267 
268  //***
269  // Quantities for zero-biasing and normalizing the image point and
270  // ground point coordinates referenced in the polynomials:
271  //***
272  double theLineScale;
273  double theSampScale;
274  double theLatScale;
275  double theLonScale;
276  double theHgtScale;
279  double theLatOffset;
280  double theLonOffset;
281  double theHgtOffset;
282 
283 
284  //***
285  // Quantities derived from the adjustable parameters:
286  //***
291  double theCosMapRot;
292  double theSinMapRot;
293 
295  double theBiasError; // meters
296  double theRandError; // meters
297 
298  //***
299  // Coefficients:
300  //***
301  double theLineNumCoef[20];
302  double theLineDenCoef[20];
303  double theSampNumCoef[20];
304  double theSampDenCoef[20];
305 
306  friend class ossimRpcSolver;
307  friend class ossimNitfRpcBase;
308 
309  TYPE_DATA
310 };
311 
312 #endif
double theSampOffset
PolynomialType thePolyType
virtual ossimObject * dup() const =0
double theIntrackOffset
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
#define OSSIMDLLEXPORT
virtual bool setupOptimizer(const ossimString &setup)
setupFromString() Derived classes should implement as needed. Initialize parameters needed for optimi...
Represents serializable keyword/value map.
double theIntrackScale
virtual void lineSampleToWorld(const ossimDpt &image_point, ossimGpt &world_point) const
double theLonScale
#define A(r, c)
double theLineScale
virtual ossimDpt getForwardDeriv(int parmIdx, const ossimGpt &gpos, double hdelta=1e-11)
double theLatOffset
double ossim_float64
double theHgtOffset
double theLonOffset
double theRandError
virtual bool useForward() const
double theLatScale
double theCrtrackScale
#define TYPE_DATA
Definition: ossimRtti.h:339
virtual void lineSampleHeightToWorld(const ossimDpt &lineSampPt, const double &heightEllipsoid, ossimGpt &worldPt) const =0
virtual void imagingRay(const ossimDpt &image_point, ossimEcefRay &image_ray) const
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
virtual std::ostream & print(std::ostream &out) const
RPC model structure used for access function.
Definition: ossimRpcModel.h:44
virtual void updateModel()
static void writeGeomTemplate(ostream &os)
virtual void worldToLineSample(const ossimGpt &world_point, ossimDpt &image_point) const
double theCrtrackOffset
This currently only support Rational poilynomial B format.
double theSampScale
double theSinMapRot
double theCosMapRot
double theLineOffset
double theHgtScale
double theBiasError
error
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23