OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Member Functions | Protected Attributes | List of all members
ossimApplanixUtmModel Class Reference

#include <ossimApplanixUtmModel.h>

Inheritance diagram for ossimApplanixUtmModel:
ossimSensorModel ossimProjection ossimOptimizableProjection ossimAdjustableParameterInterface ossimObject ossimErrorStatusInterface ossimReferenced

Public Member Functions

 ossimApplanixUtmModel ()
 
 ossimApplanixUtmModel (const ossimApplanixUtmModel &src)
 
virtual ossimObjectdup () const
 
virtual void imagingRay (const ossimDpt &image_point, ossimEcefRay &image_ray) const
 
void lineSampleToWorld (const ossimDpt &image_point, ossimGpt &gpt) const
 
virtual void lineSampleHeightToWorld (const ossimDpt &image_point, const double &heightEllipsoid, ossimGpt &worldPoint) const
 
virtual void worldToLineSample (const ossimGpt &world_point, ossimDpt &image_point) const
 
virtual void updateModel ()
 
void setPrincipalPoint (ossimDpt principalPoint)
 
void setPixelSize (const ossimDpt &pixelSize)
 
void setImageRect (const ossimDrect &rect)
 
void setFocalLength (double focalLength)
 
void setPlatformPosition (const ossimGpt &gpt)
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 
virtual void initAdjustableParameters ()
 
virtual bool useForward () const
 
virtual bool setupOptimizer (const ossimString &init_file)
 ground to image faster (you don't need DEM) //TBC More...
 
- Public Member Functions inherited from ossimSensorModel
 ossimSensorModel ()
 
 ossimSensorModel (const ossimSensorModel &copy_this)
 
 ossimSensorModel (const ossimKeywordlist &geom_kwl)
 
const ossimSensorModeloperator= (const ossimSensorModel &rhs)
 assignment operator More...
 
virtual ossimObjectgetBaseObject ()
 
virtual const ossimObjectgetBaseObject () const
 
virtual ossimGpt origin () const
 
virtual ossimDpt getMetersPerPixel () const
 
virtual const double & getNominalPosError () const
 Returns the estimated Absolute horizontal position error (CE90) of the sensor model. More...
 
virtual const double & getRelativePosError () const
 Returns the estimated RELATIVE horizontal position error (CE90) of the sensor model. More...
 
virtual void setNominalPosError (const double &ce90)
 Assigns the absolute image position error uncertainty (abs CE90) More...
 
virtual void setRelativePosError (const double &ce90)
 Assigns the relative image position error uncertainty (rel CE90) More...
 
virtual std::ostream & print (std::ostream &out) const
 
void setRefImgPt (const ossimDpt &pt)
 Sets the center line sampe of the image. More...
 
void setRefGndPt (const ossimGpt &pt)
 Sets the center latitude, longitude, height of the image. More...
 
void setImageRect (const ossimDrect &imageRect)
 
void setGroundRect (const ossimGpt &ul, const ossimGpt &ur, const ossimGpt &lr, const ossimGpt &ll)
 
ossimDpt imageSize () const
 
void setImageSize (const ossimDpt &size)
 
virtual void adjustableParametersChanged ()
 
virtual bool insideImage (const ossimDpt &p) const
 
virtual bool operator== (const ossimProjection &proj) const
 
const ossimStringgetImageID () const
 Access methods: More...
 
const ossimDrectgetImageClipRect () const
 
virtual ossim_uint32 degreesOfFreedom () const
 
virtual bool needsInitialState () const
 needsInitialState() More...
 
virtual double optimizeFit (const ossimTieGptSet &tieSet, double *targetVariance=0)
 
virtual ossimDpt getForwardDeriv (int parmIdx, const ossimGpt &gpos, double hdelta=1e-11)
 
virtual ossimGpt getInverseDeriv (int parmIdx, const ossimDpt &ipos, double hdelta=1e-11)
 
virtual ossimSensorModel::CovMatStatus getObsCovMat (const ossimDpt &ipos, NEWMAT::SymmetricMatrix &Cov, const ossim_float64 defPointingSigma=0.5) const
 Gives 2X2 covariance matrix of observations. More...
 
virtual bool isAffectedByElevation () const
 Implementation of pure virtual ossimProjection::isAffectedByElevation method. More...
 
void computeGsd ()
 This method computes the ground sample distance(gsd) and sets class attributes theGSD and theMeanGSD by doing a lineSampleHeightToWorld on four points and calculating the distance from them. More...
 
virtual bool getImageGeometry (const ossimString &, const ossimString &, ossimKeywordlist &) const
 Extracts geometry info from a non-ossim key,value pair to an ossim keyword list. More...
 
- Public Member Functions inherited from ossimProjection
 ossimProjection ()
 
virtual ~ossimProjection ()
 
virtual ossimDpt forward (const ossimGpt &wp) const
 
virtual ossimGpt inverse (const ossimDpt &pp) const
 
virtual void getRoundTripError (const ossimDpt &imagePoint, ossimDpt &errorResult) const
 
virtual void getRoundTripError (const ossimGpt &groundPoint, ossimDpt &errorResult) const
 
virtual void getGroundClipPoints (ossimGeoPolygon &gpts) const
 
virtual bool isEqualTo (const ossimObject &obj, ossimCompareType compareType=OSSIM_COMPARE_FULL) const
 
virtual bool operator!= (const ossimProjection &projection) const
 
- Public Member Functions inherited from ossimObject
 ossimObject ()
 
virtual ~ossimObject ()
 
virtual ossimString getShortName () const
 
virtual ossimString getLongName () const
 
virtual ossimString getDescription () const
 
virtual ossimString getClassName () const
 
virtual RTTItypeid getType () const
 
virtual bool canCastTo (ossimObject *obj) const
 
virtual bool canCastTo (const RTTItypeid &id) const
 
virtual bool canCastTo (const ossimString &parentClassName) const
 
virtual void accept (ossimVisitor &visitor)
 
- Public Member Functions inherited from ossimReferenced
 ossimReferenced ()
 
 ossimReferenced (const ossimReferenced &)
 
ossimReferencedoperator= (const ossimReferenced &)
 
void ref () const
 increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
void unref () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unref_nodelete () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
int referenceCount () const
 
- Public Member Functions inherited from ossimErrorStatusInterface
 ossimErrorStatusInterface ()
 
virtual ~ossimErrorStatusInterface ()
 
virtual ossimErrorCode getErrorStatus () const
 
virtual ossimString getErrorStatusString () const
 
virtual void setErrorStatus (ossimErrorCode error_status) const
 
virtual void setErrorStatus () const
 
virtual void clearErrorStatus () const
 
bool hasError () const
 
- Public Member Functions inherited from ossimOptimizableProjection
 ossimOptimizableProjection ()
 
 ossimOptimizableProjection (const ossimOptimizableProjection &source)
 
virtual ~ossimOptimizableProjection ()
 
virtual ossimOptimizableProjectionoperator= (const ossimOptimizableProjection &source)
 
- Public Member Functions inherited from ossimAdjustableParameterInterface
 ossimAdjustableParameterInterface ()
 
 ossimAdjustableParameterInterface (const ossimAdjustableParameterInterface &rhs)
 
virtual ~ossimAdjustableParameterInterface ()
 
void newAdjustment (ossim_uint32 numberOfParameters=0)
 
void setAdjustmentDescription (const ossimString &description)
 
ossimString getAdjustmentDescription () const
 
ossimString getAdjustmentDescription (ossim_uint32 adjustmentIdx) const
 Returns adjustmentDescription of specific adjustmentInfo. More...
 
void setCurrentAdjustment (ossim_uint32 adjustmentIndex, bool notify=false)
 
bool setCurrentAdjustment (const ossimString &description, bool notify=false)
 Sets the current adjustment to the adjustment with a matching description. More...
 
void eraseAdjustment (bool notify)
 
void eraseAdjustment (ossim_uint32 idx, bool notify)
 
void resetAdjustableParameters (bool notify=false)
 
void copyAdjustment (ossim_uint32 idx, bool notify)
 
void copyAdjustment (bool notify=false)
 
void keepAdjustment (ossim_uint32 idx, bool createCopy)
 
virtual void keepAdjustment (bool createCopy=true)
 
const ossimAdjustableParameterInterfaceoperator= (const ossimAdjustableParameterInterface &rhs)
 
void removeAllAdjustments ()
 
ossim_uint32 getNumberOfAdjustableParameters () const
 
double getAdjustableParameter (ossim_uint32 idx) const
 
virtual void setAdjustableParameter (ossim_uint32 idx, double value, bool notify=false)
 
virtual void setAdjustableParameter (ossim_uint32 idx, double value, double sigma, bool notify=false)
 
double getParameterSigma (ossim_uint32 idx) const
 
void setParameterSigma (ossim_uint32 idx, double value, bool notify=false)
 
ossimUnitType getParameterUnit (ossim_uint32 idx) const
 
void setParameterUnit (ossim_uint32 idx, ossimUnitType unit)
 
void setParameterUnit (ossim_uint32 idx, const ossimString &unit)
 
void setParameterCenter (ossim_uint32 idx, double center, bool notify=false)
 
double getParameterCenter (ossim_uint32 idx) const
 
double computeParameterOffset (ossim_uint32 idx) const
 
void setParameterOffset (ossim_uint32 idx, ossim_float64 value, bool notify=false)
 
ossimString getParameterDescription (ossim_uint32 idx) const
 
void setParameterDescription (ossim_uint32 idx, const ossimString &descrption)
 
ossim_int32 findParameterIdxGivenDescription (ossim_uint32 adjustmentIdx, const ossimString &name) const
 
ossim_int32 findParameterIdxContainingDescription (ossim_uint32 adjustmentIdx, const ossimString &name) const
 
bool isParameterLocked (ossim_uint32 idx) const
 
void setParameterLockFlag (ossim_uint32 idxParam, bool flag)
 
bool getParameterLockFlag (ossim_uint32 idx) const
 
void lockAllParametersCurrentAdjustment ()
 
void unlockAllParametersCurrentAdjustment ()
 
void lockAllParameters (ossim_uint32 idxAdjustment)
 
void unlockAllParameters (ossim_uint32 idxAdjustment)
 
void resizeAdjustableParameterArray (ossim_uint32 numberOfParameters)
 
void setAdjustment (const ossimAdjustmentInfo &adj, bool notify=false)
 
void setAdjustment (ossim_uint32 idx, const ossimAdjustmentInfo &adj, bool notify=false)
 
void addAdjustment (const ossimAdjustmentInfo &adj, bool notify)
 
void getAdjustment (ossimAdjustmentInfo &adj) const
 
void getAdjustment (ossim_uint32 idx, ossimAdjustmentInfo &adj) const
 
ossim_uint32 getNumberOfAdjustments () const
 
ossim_uint32 getCurrentAdjustmentIdx () const
 
void setDirtyFlag (bool flag=true)
 
void setAllDirtyFlag (bool flag=true)
 
bool hasDirtyAdjustments () const
 
virtual void saveCurrentAdjustmentOnly (ossimKeywordlist &kwl, const ossimString &prefix=ossimString(""))
 Saves the current active adjustment to the KWL file. More...
 
bool saveAdjustments (ossimKeywordlist &kwl, const ossimString &prefix=ossimString("")) const
 Save all adjustments to the KWL file. More...
 
bool loadAdjustments (const ossimKeywordlist &kwl, const ossimString &prefix=ossimString(""))
 
std::ostream & print (std::ostream &out) const
 Dumps the currently active adjustment to ostream. More...
 

Protected Attributes

NEWMAT::Matrix theCompositeMatrix
 uses file path to init model More...
 
NEWMAT::Matrix theCompositeMatrixInverse
 
double theOmega
 
double thePhi
 
double theKappa
 
double theBoreSightTx
 
double theBoreSightTy
 
double theBoreSightTz
 
ossimDpt thePrincipalPoint
 
ossimDpt thePixelSize
 
double theFocalLength
 
ossimEcefPoint theEcefPlatformPosition
 
ossimGpt thePlatformPosition
 
ossim_int32 theUtmZone
 
ossim_int8 theUtmHemisphere
 
ossimDpt3d theUtmPlatformPosition
 
ossimEcefVector theShiftValues
 
ossimRefPtr< ossimMeanRadialLensDistortiontheLensDistortion
 
ossimEcefPoint theAdjEcefPlatformPosition
 
- Protected Attributes inherited from ossimSensorModel
ossimIpt theImageSize
 
ossimDpt theSubImageOffset
 
ossimString theImageID
 
ossimString theSensorID
 
ossimDpt theGSD
 
ossim_float64 theMeanGSD
 
ossimGpt theRefGndPt
 
ossimDpt theRefImgPt
 
ossimPolygon theBoundGndPolygon
 
ossimDrect theImageClipRect
 
ossim_float64 theRelPosError
 
ossim_float64 theNominalPosError
 
ossimDpt theParWRTx
 Partials for current point. More...
 
ossimDpt theParWRTy
 
ossimDpt theParWRTz
 
ossimDpt theObs
 Observations & residuals for current point. More...
 
ossimDpt theResid
 
ossimRefPtr< ossimProjectiontheSeedFunction
 Used as an initial guess for iterative solutions and a guess for points outside the support bounds. More...
 
bool theExtrapolateImageFlag
 
bool theExtrapolateGroundFlag
 
- Protected Attributes inherited from ossimErrorStatusInterface
ossimErrorCode theErrorStatus
 

Additional Inherited Members

- Public Types inherited from ossimSensorModel
enum  CovMatStatus { COV_INVALID = 0, COV_PARTIAL = 1, COV_FULL = 2 }
 
enum  DeriveMode {
  OBS_INIT =-99, EVALUATE =-98, P_WRT_X = -1, P_WRT_Y = -2,
  P_WRT_Z = -3
}
 
- Static Public Member Functions inherited from ossimSensorModel
static void writeGeomTemplate (ostream &os)
 
- Protected Member Functions inherited from ossimSensorModel
virtual ~ossimSensorModel ()
 
virtual ossimDpt extrapolate (const ossimGpt &gp) const
 
virtual ossimGpt extrapolate (const ossimDpt &ip, const double &height=ossim::nan()) const
 
void buildNormalEquation (const ossimTieGptSet &tieSet, NEWMAT::SymmetricMatrix &A, NEWMAT::ColumnVector &residue, NEWMAT::ColumnVector &projResidue, double pstep_scale)
 
NEWMAT::ColumnVector getResidue (const ossimTieGptSet &tieSet)
 
NEWMAT::ColumnVector solveLeastSquares (NEWMAT::SymmetricMatrix &A, NEWMAT::ColumnVector &r) const
 
NEWMAT::Matrix invert (const NEWMAT::Matrix &m) const
 stable invert stolen from ossimRpcSolver More...
 
- Protected Member Functions inherited from ossimReferenced
virtual ~ossimReferenced ()
 
- Protected Member Functions inherited from ossimAdjustableParameterInterface
bool paramChanged (ossim_uint32 param_idx) const
 Returns true if specified parameter has been modified since last setAllChangeFlag(false) call. More...
 
void setAllChangeFlags (bool areChanged)
 Sets all the change flags to the boolean indicated to indicate parameters are changed (TRUE) or not (FALSE). More...
 
void initChangeFlags ()
 Initializes the change flags to TRUE. More...
 

Detailed Description

Definition at line 16 of file ossimApplanixUtmModel.h.

Constructor & Destructor Documentation

◆ ossimApplanixUtmModel() [1/2]

ossimApplanixUtmModel::ossimApplanixUtmModel ( )

Definition at line 32 of file ossimApplanixUtmModel.cpp.

References ossimMatrix4x4::createIdentity(), initAdjustableParameters(), theCompositeMatrix, theCompositeMatrixInverse, theEcefPlatformPosition, theFocalLength, ossimSensorModel::theGSD, theLensDistortion, ossimSensorModel::theMeanGSD, thePixelSize, ossimDpt::x, and ossimDpt::y.

Referenced by dup().

33  :theOmega(0.0),
34  thePhi(0.0),
35  theKappa(0.0),
36  theBoreSightTx(0.0),
37  theBoreSightTy(0.0),
38  theBoreSightTz(0.0)
39 {
42  theFocalLength = 55.0;
43  thePixelSize = ossimDpt(.009, .009);
44  theEcefPlatformPosition = ossimGpt(0.0,0.0, 1000.0);
45  theGSD.x = 0.1524;
46  theGSD.y = 0.1524;
47  theMeanGSD = 0.1524;
50 
51  if (traceDebug())
52  {
54  << "ossimApplanixUtmModel::ossimApplanixUtmModel DEBUG:" << endl;
55 #ifdef OSSIM_ID_ENABLED
56  ossimNotify(ossimNotifyLevel_DEBUG)<< "OSSIM_ID: " << OSSIM_ID << endl;
57 #endif
58  }
59 }
virtual void initAdjustableParameters()
NEWMAT::Matrix theCompositeMatrixInverse
double y
Definition: ossimDpt.h:165
ossimEcefPoint theEcefPlatformPosition
NEWMAT::Matrix theCompositeMatrix
uses file path to init model
ossimRefPtr< ossimMeanRadialLensDistortion > theLensDistortion
static NEWMAT::Matrix createIdentity()
double x
Definition: ossimDpt.h:164
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
ossim_float64 theMeanGSD

◆ ossimApplanixUtmModel() [2/2]

ossimApplanixUtmModel::ossimApplanixUtmModel ( const ossimApplanixUtmModel src)

Definition at line 61 of file ossimApplanixUtmModel.cpp.

References ossimRefPtr< T >::get(), theLensDistortion, and ossimRefPtr< T >::valid().

62  :ossimSensorModel(src),
65  theOmega(src.theOmega),
66  thePhi(src.thePhi),
67  theKappa(src.theKappa),
79 {
80  if(src.theLensDistortion.valid())
81  {
83  }
84  else
85  {
87  }
88 }
bool valid() const
Definition: ossimRefPtr.h:75
NEWMAT::Matrix theCompositeMatrixInverse
ossimEcefPoint theEcefPlatformPosition
NEWMAT::Matrix theCompositeMatrix
uses file path to init model
ossimRefPtr< ossimMeanRadialLensDistortion > theLensDistortion

Member Function Documentation

◆ dup()

ossimObject * ossimApplanixUtmModel::dup ( ) const
virtual

Implements ossimProjection.

Definition at line 90 of file ossimApplanixUtmModel.cpp.

References ossimApplanixUtmModel().

91 {
92  return new ossimApplanixUtmModel(*this);
93 }

◆ imagingRay()

void ossimApplanixUtmModel::imagingRay ( const ossimDpt image_point,
ossimEcefRay image_ray 
) const
virtual

METHOD: imagingRay(image_point, &ossimEcefRay) Given an image point, returns a ray originating at some arbitrarily high point (ideally at the sensor position) and pointing towards the target. Implemented here but should be overriden for more efficient solution.

Reimplemented from ossimSensorModel.

Definition at line 95 of file ossimApplanixUtmModel.cpp.

References ossimEcefVector::magnitude(), ossimEcefRay::setDirection(), ossimEcefRay::setOrigin(), theAdjEcefPlatformPosition, theCompositeMatrix, theFocalLength, theLensDistortion, thePixelSize, thePrincipalPoint, ossimSensorModel::theRefImgPt, ossimMeanRadialLensDistortion::undistort(), ossimRefPtr< T >::valid(), ossimDpt::x, and ossimDpt::y.

Referenced by lineSampleHeightToWorld().

97 {
98 // if(traceDebug())
99 // {
100 // ossimNotify(ossimNotifyLevel_DEBUG) << "ossimApplanixUtmModel::imagingRay: ..... entered" << std::endl;
101 // }
102  ossimDpt f1 ((image_point) - theRefImgPt);
103  f1.x *= thePixelSize.x;
104  f1.y *= -thePixelSize.y;
105  ossimDpt film (f1 - thePrincipalPoint);
106 // if(traceDebug())
107 // {
108 // ossimNotify(ossimNotifyLevel_DEBUG) << "pixel size = " << thePixelSize << std::endl;
109 // ossimNotify(ossimNotifyLevel_DEBUG) << "principal pt = " << thePrincipalPoint << std::endl;
110 // ossimNotify(ossimNotifyLevel_DEBUG) << "film pt = " << film << std::endl;
111 // }
112  if (theLensDistortion.valid())
113  {
114  ossimDpt filmOut;
115  theLensDistortion->undistort(film, filmOut);
116  film = filmOut;
117  }
118 
119  ossimColumnVector3d cam_ray_dir (film.x,
120  film.y,
121  -theFocalLength);
122  ossimEcefVector ecf_ray_dir (theCompositeMatrix*cam_ray_dir);
123  ecf_ray_dir = ecf_ray_dir*(1.0/ecf_ray_dir.magnitude());
124 
126  image_ray.setDirection(ecf_ray_dir);
127 
128 // if(traceDebug())
129 // {
130 // ossimNotify(ossimNotifyLevel_DEBUG) << "ossimApplanixUtmModel::imagingRay: ..... leaving" << std::endl;
131 // }
132 }
bool valid() const
Definition: ossimRefPtr.h:75
double y
Definition: ossimDpt.h:165
void setOrigin(const ossimEcefPoint &orig)
Definition: ossimEcefRay.h:81
ossimEcefPoint theAdjEcefPlatformPosition
NEWMAT::Matrix theCompositeMatrix
uses file path to init model
virtual void undistort(const ossimDpt &input, ossimDpt &output) const
ossimRefPtr< ossimMeanRadialLensDistortion > theLensDistortion
double x
Definition: ossimDpt.h:164
void setDirection(const ossimEcefVector &d)
Definition: ossimEcefRay.h:82

◆ initAdjustableParameters()

void ossimApplanixUtmModel::initAdjustableParameters ( )
virtual

Reimplemented from ossimAdjustableParameterInterface.

Definition at line 320 of file ossimApplanixUtmModel.cpp.

References ossimAdjustableParameterInterface::resizeAdjustableParameterArray(), ossimAdjustableParameterInterface::setAdjustableParameter(), ossimAdjustableParameterInterface::setParameterDescription(), ossimAdjustableParameterInterface::setParameterSigma(), and ossimAdjustableParameterInterface::setParameterUnit().

Referenced by ossimApplanixUtmModel().

321 {
323 
324  setAdjustableParameter(0, 0.0);
325  setParameterDescription(0, "x_offset");
326  setParameterUnit(0, "pixels");
327 
328  setAdjustableParameter(1, 0.0);
329  setParameterDescription(1, "y_offset");
330  setParameterUnit(1, "pixels");
331 
332  setAdjustableParameter(2, 0.0);
333  setParameterDescription(2, "orientation x");
334  setParameterUnit(2, "degrees");
335 
336  setAdjustableParameter(3, 0.0);
337  setParameterDescription(3, "orientation y");
338  setParameterUnit(3, "degrees");
339 
340  setAdjustableParameter(4, 0.0);
341  setParameterDescription(4, "orientation z");
342  setParameterUnit(4, "degrees");
343 
344  setAdjustableParameter(5, 0.0);
345  setParameterDescription(5, "Altitude delta");
346  setParameterUnit(5, "meters");
347 
348 
349 
350  setParameterSigma(0, 20.0);
351  setParameterSigma(1, 20.0);
352  setParameterSigma(2, .1);
353  setParameterSigma(3, .1);
354  setParameterSigma(4, .1);
355  setParameterSigma(5, 50);
356 }
void setParameterDescription(ossim_uint32 idx, const ossimString &descrption)
void setParameterUnit(ossim_uint32 idx, ossimUnitType unit)
virtual void setAdjustableParameter(ossim_uint32 idx, double value, bool notify=false)
void resizeAdjustableParameterArray(ossim_uint32 numberOfParameters)
void setParameterSigma(ossim_uint32 idx, double value, bool notify=false)

◆ lineSampleHeightToWorld()

void ossimApplanixUtmModel::lineSampleHeightToWorld ( const ossimDpt lineSampPt,
const double &  heightEllipsoid,
ossimGpt worldPt 
) const
virtual

METHOD: lineSampleHeightToWorld This is the pure virtual that performs the actual work of projecting the image point to the given elevation above Ellipsoid.

Implements ossimSensorModel.

Definition at line 173 of file ossimApplanixUtmModel.cpp.

References imagingRay(), and ossimEcefRay::intersectAboveEarthEllipsoid().

176 {
177 // if (!insideImage(image_point))
178 // {
179  //worldPoint.makeNan();
180 // worldPoint = extrapolate(image_point, heightEllipsoid);
181 // }
182 // else
183  {
184  //***
185  // First establish imaging ray from image point:
186  //***
187  ossimEcefRay ray;
188  imagingRay(image_point, ray);
189  ossimEcefPoint Pecf (ray.intersectAboveEarthEllipsoid(heightEllipsoid));
190  worldPoint = ossimGpt(Pecf);
191  }
192 }
ossimEcefPoint intersectAboveEarthEllipsoid(const double &heightAboveEllipsoid, const ossimDatum *aDatum=ossimDatumFactory::instance() ->wgs84()) const
virtual void imagingRay(const ossimDpt &image_point, ossimEcefRay &image_ray) const

◆ lineSampleToWorld()

void ossimApplanixUtmModel::lineSampleToWorld ( const ossimDpt image_point,
ossimGpt world_point 
) const
virtual

Implementation of base-class pure virtual projection methods. These methods may be overriden by derived classes if those have more efficient schemes. The implementations here are iterative (relatively slow). Both depend on calls to the pure virtual lineSampleHeightToWorld() method.

Reimplemented from ossimSensorModel.

Definition at line 134 of file ossimApplanixUtmModel.cpp.

Referenced by updateModel().

136 {
137  if (traceDebug()) ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG ossimApplanixEcefModel::lineSampleToWorld:entering..." << std::endl;
138 
139  if(image_point.hasNans())
140  {
141  gpt.makeNan();
142  return;
143  }
144  //***
145  // Extrapolate if image point is outside image:
146  //***
147  // if (!insideImage(image_point))
148  // {
149  // gpt.makeNan();
150 // gpt = extrapolate(image_point);
151  // return;
152  //}
153 
154  //***
155  // Determine imaging ray and invoke elevation source object's services to
156  // intersect ray with terrain model:
157  //***
158  ossimEcefRay ray;
159  imagingRay(image_point, ray);
161 
162  if (traceDebug())
163  {
164  ossimNotify(ossimNotifyLevel_DEBUG) << "image_point = " << image_point << std::endl;
165  ossimNotify(ossimNotifyLevel_DEBUG) << "ray = " << ray << std::endl;
166  ossimNotify(ossimNotifyLevel_DEBUG) << "gpt = " << gpt << std::endl;
167  }
168 
169  if (traceDebug()) ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG ossimSensorModel::lineSampleToWorld: returning..." << std::endl;
170  return;
171 }
bool intersectRay(const ossimEcefRay &ray, ossimGpt &gpt, double defaultElevValue=0.0)
METHOD: intersectRay()
static ossimElevManager * instance()
METHOD: instance() Implements singelton pattern.
bool hasNans() const
Definition: ossimDpt.h:67
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
virtual void imagingRay(const ossimDpt &image_point, ossimEcefRay &image_ray) const

◆ loadState()

bool ossimApplanixUtmModel::loadState ( const ossimKeywordlist kwl,
const char *  prefix = 0 
)
virtual

Method to the load (recreate) the state of the object from a keyword list. Return true if ok or false on error.

Reimplemented from ossimSensorModel.

Definition at line 443 of file ossimApplanixUtmModel.cpp.

Referenced by setupOptimizer().

445 {
446  if(traceDebug())
447  {
448  std::cout << "ossimApplanixUtmModel::loadState: ......... entered" << std::endl;
449  }
450  theImageClipRect = ossimDrect(0,0,4076,4091);
451  theRefImgPt = ossimDpt(2046.0, 2038.5);
452 
453  ossimSensorModel::loadState(kwl, prefix);
454 
456  {
458  }
459 
460  const char* eo_file = kwl.find(prefix, "eo_file");
461  const char* eo_id = kwl.find(prefix, "eo_id");
462  const char* omega = kwl.find(prefix, "omega");
463  const char* phi = kwl.find(prefix, "phi");
464  const char* kappa = kwl.find(prefix, "kappa");
465  const char* bore_sight_tx = kwl.find(prefix, "bore_sight_tx");
466  const char* bore_sight_ty = kwl.find(prefix, "bore_sight_ty");
467  const char* bore_sight_tz = kwl.find(prefix, "bore_sight_tz");
468 
469  const char* principal_point = kwl.find(prefix, "principal_point");
470  const char* pixel_size = kwl.find(prefix, "pixel_size");
471  const char* focal_length = kwl.find(prefix, "focal_length");
472  const char* latlonh_platform_position = kwl.find(prefix, "latlonh_platform_position");
473  const char* utm_platform_position = kwl.find(prefix, "utm_platform_position");
474  const char* compute_gsd_flag = kwl.find(prefix, "compute_gsd_flag");
475  const char* utm_zone = kwl.find(prefix, "utm_zone");
476  const char* utm_hemisphere = kwl.find(prefix, "utm_hemisphere");
477  const char* camera_file = kwl.find(prefix, "camera_file");
478  const char* shift_values = kwl.find(prefix, "shift_values");
479 
482  theOmega = 0.0;
483  thePhi = 0.0;
484  theKappa = 0.0;
485  theBoreSightTx = 0.0;
486  theBoreSightTy = 0.0;
487  theBoreSightTz = 0.0;
488  theFocalLength = 55.0;
489  thePixelSize = ossimDpt(.009, .009);
490  theEcefPlatformPosition = ossimGpt(0.0,0.0, 1000.0);
491 
492  bool loadedFromEoFile = false;
493 
494  if(eo_id)
495  {
496  theImageID = eo_id;
497  }
498  // loading from standard eo file with given record id
499  //
500  if(eo_file)
501  {
502  ossimApplanixEOFile eoFile;
503 
504  if(eoFile.parseFile(ossimFilename(eo_file)))
505  {
507 
508  if(record.valid())
509  {
510  loadedFromEoFile = true;
511  theBoreSightTx = eoFile.getBoreSightTx()/60.0;
512  theBoreSightTy = eoFile.getBoreSightTy()/60.0;
513  theBoreSightTz = eoFile.getBoreSightTz()/60.0;
515  eoFile.getShiftValuesY(),
516  eoFile.getShiftValuesZ());
517  ossim_int32 easting = eoFile.getFieldIdxLike("EASTING");
518  ossim_int32 northing = eoFile.getFieldIdxLike("NORTHING");
519  ossim_int32 height = eoFile.getFieldIdxLike("HEIGHT");
520  ossim_int32 omega = eoFile.getFieldIdxLike("OMEGA");
521  ossim_int32 phi = eoFile.getFieldIdxLike("PHI");
522  ossim_int32 kappa = eoFile.getFieldIdxLike("KAPPA");
523 
524  if((omega>=0)&&
525  (phi>=0)&&
526  (kappa>=0)&&
527  (height>=0)&&
528  (easting>=0)&&
529  (northing>=0))
530  {
531  theOmega = (*record)[omega].toDouble();
532  thePhi = (*record)[phi].toDouble();
533  theKappa = (*record)[kappa].toDouble();
534  double h = (*record)[height].toDouble();
535  ossimString heightType = kwl.find(prefix, "height_type");
536  if(eoFile.isUtmFrame())
537  {
538  theUtmZone = eoFile.getUtmZone();
539  theUtmHemisphere = eoFile.getUtmHemisphere()=="North"?'N':'S';
540  ossimUtmProjection utmProj;
541  utmProj.setZone(theUtmZone);
542  utmProj.setHemisphere((char)theUtmHemisphere);
543  theUtmPlatformPosition.x = (*record)[easting].toDouble();
544  theUtmPlatformPosition.y = (*record)[northing].toDouble();
549 
550  if(eoFile.isHeightAboveMSL())
551  {
553  if(!ossim::isnan(offset))
554  {
555  thePlatformPosition.height(h + offset);
556  theUtmPlatformPosition.z = h + offset;
557  }
558  }
559  }
560  else
561  {
562  return false;
563  }
564  }
566  }
567  else
568  {
569  return false;
570  }
571  }
572  }
573  if(!loadedFromEoFile)
574  {
575  if(shift_values)
576  {
577  std::vector<ossimString> splitString;
578  ossimString tempString(shift_values);
579  tempString = tempString.trim();
580  tempString.split(splitString, " " );
581  if(splitString.size() == 3)
582  {
583  theShiftValues = ossimEcefVector(splitString[0].toDouble(),
584  splitString[1].toDouble(),
585  splitString[2].toDouble());
586  }
587  }
588  if(omega&&phi&&kappa)
589  {
590  theOmega = ossimString(omega).toDouble();
591  thePhi = ossimString(phi).toDouble();
592  theKappa = ossimString(kappa).toDouble();
593  }
594  if(bore_sight_tx&&bore_sight_ty&&bore_sight_tz)
595  {
596  theBoreSightTx = ossimString(bore_sight_tx).toDouble()/60.0;
597  theBoreSightTy = ossimString(bore_sight_ty).toDouble()/60.0;
598  theBoreSightTz = ossimString(bore_sight_tz).toDouble()/60.0;
599  }
600  double lat=0.0, lon=0.0, h=0.0;
601  if(utm_zone)
602  {
603  theUtmZone = ossimString(utm_zone).toInt32();
604  }
605  if(utm_hemisphere)
606  {
607  ossimString hem = utm_hemisphere;
608  hem = hem.trim();
609  hem = hem.upcase();
610  theUtmHemisphere = *(hem.begin());
611  }
612  if(utm_platform_position)
613  {
614  ossimUtmProjection utmProj;
615  std::vector<ossimString> splitString;
616  ossimString tempString(utm_platform_position);
617  tempString = tempString.trim();
618  ossimString datumString;
619  utmProj.setZone(theUtmZone);
620  utmProj.setHemisphere((char)theUtmHemisphere);
621  tempString.split(splitString, " ");
622  if(splitString.size() > 2)
623  {
624  theUtmPlatformPosition.x = splitString[0].toDouble();
625  theUtmPlatformPosition.y = splitString[1].toDouble();
626  theUtmPlatformPosition.z = splitString[2].toDouble();
627  }
628  if(splitString.size() > 3)
629  {
630  datumString = splitString[3];
631  }
632  const ossimDatum* datum = ossimDatumFactory::instance()->create(datumString);
633  if(datum)
634  {
635  utmProj.setDatum(datum);
636  }
637 
641 
642  ossimString heightType = kwl.find(prefix, "height_type");
643  if(heightType == "msl")
644  {
646  if(ossim::isnan(offset) == false)
647  {
650  }
651  }
653  }
654  else if(latlonh_platform_position)
655  {
656  std::vector<ossimString> splitString;
657  ossimString tempString(latlonh_platform_position);
658  std::string datumString;
659  tempString = tempString.trim();
660  tempString.split(splitString, " ");
661  if(splitString.size() > 2)
662  {
663  lat = splitString[0].toDouble();
664  lon = splitString[1].toDouble();
665  h = splitString[2].toDouble();
666  }
667  if(splitString.size() > 3)
668  {
669  datumString = splitString[3].string();
670  }
674  const ossimDatum* datum = ossimDatumFactory::instance()->create(datumString);
675  if(datum)
676  {
677  thePlatformPosition.datum(datum);
678  }
679  ossimString heightType = kwl.find(prefix, "height_type");
680  if(heightType == "msl")
681  {
683  if(ossim::isnan(offset) == false)
684  {
686  }
687  }
689  }
690  }
691  if(principal_point)
692  {
693  std::vector<ossimString> splitString;
694  ossimString tempString(principal_point);
695  tempString = tempString.trim();
696  tempString.split(splitString, " ");
697  if(splitString.size() == 2)
698  {
699  thePrincipalPoint.x = splitString[0].toDouble();
700  thePrincipalPoint.y = splitString[1].toDouble();
701  }
702  }
703  if(pixel_size)
704  {
705  std::vector<ossimString> splitString;
706  ossimString tempString(principal_point);
707  tempString = tempString.trim();
708  tempString.split(splitString, " ");
709  if(splitString.size() == 2)
710  {
711  thePixelSize.x = splitString[0].toDouble();
712  thePixelSize.y = splitString[1].toDouble();
713  }
714  }
715  if(focal_length)
716  {
717  theFocalLength = ossimString(focal_length).toDouble();
718  }
719 
720  if(camera_file)
721  {
722  ossimKeywordlist cameraKwl;
723  ossimKeywordlist lensKwl;
724  cameraKwl.add(camera_file);
725  const char* sensor = cameraKwl.find("sensor");
726  const char* image_size = cameraKwl.find(prefix, "image_size");
727  principal_point = cameraKwl.find("principal_point");
728  focal_length = cameraKwl.find("focal_length");
729  pixel_size = cameraKwl.find(prefix, "pixel_size");
730  focal_length = cameraKwl.find(prefix, "focal_length");
731  const char* distortion_units = cameraKwl.find(prefix, "distortion_units");
733  ossimUnitType unitType = OSSIM_MILLIMETERS;
734 
735  if(distortion_units)
736  {
737  unitType = (ossimUnitType)ossimUnitTypeLut::instance()->getEntryNumber(distortion_units);
738 
739  if(unitType == OSSIM_UNIT_UNKNOWN)
740  {
741  unitType = OSSIM_MILLIMETERS;
742  }
743  }
744  if(image_size)
745  {
746  std::vector<ossimString> splitString;
747  ossimString tempString(image_size);
748  tempString = tempString.trim();
749  tempString.split(splitString, " ");
750  double w=1, h=1;
751  if(splitString.size() == 2)
752  {
753  w = splitString[0].toDouble();
754  h = splitString[1].toDouble();
755  }
756  theImageClipRect = ossimDrect(0,0,w-1,h-1);
757  theRefImgPt = ossimDpt(w/2.0, h/2.0);
758  theImageSize = ossimDpt(w, h);
759  }
760  if(sensor)
761  {
762  theSensorID = sensor;
763  }
764  if(principal_point)
765  {
766  std::vector<ossimString> splitString;
767  ossimString tempString(principal_point);
768  tempString = tempString.trim();
769  tempString.split(splitString, " ");
770  if(splitString.size() == 2)
771  {
772  thePrincipalPoint.x = splitString[0].toDouble();
773  thePrincipalPoint.y = splitString[1].toDouble();
774  }
775  }
776  if(pixel_size)
777  {
778  std::vector<ossimString> splitString;
779  ossimString tempString(pixel_size);
780  tempString = tempString.trim();
781  tempString.split(splitString, " ");
782  if(splitString.size() == 1)
783  {
784  thePixelSize.x = splitString[0].toDouble();
786  }
787  else if(splitString.size() == 2)
788  {
789  thePixelSize.x = splitString[0].toDouble();
790  thePixelSize.y = splitString[1].toDouble();
791  }
792  }
793  if(focal_length)
794  {
795  theFocalLength = ossimString(focal_length).toDouble();
796  }
797 
798  cameraKwl.trimAllValues();
799 
800 
801  ossimString regExpression = ossimString("^(") + "d[0-9]+)";
802  vector<ossimString> keys;
803  cameraKwl.getSubstringKeyList( keys, regExpression );
804  long numberOfDistortions = (long)keys.size();
805  int offset = (int)ossimString("d").size();
806  ossim_uint32 idx = 0;
807  std::vector<int> numberList(numberOfDistortions);
808  for(idx = 0; idx < numberList.size();++idx)
809  {
810  ossimString numberStr(keys[idx].begin() + offset,
811  keys[idx].end());
812  numberList[idx] = numberStr.toInt();
813  }
814  std::sort(numberList.begin(), numberList.end());
815  double distance=0.0, distortion=0.0;
816 
817  for(idx = 0; idx < numberList.size(); ++idx)
818  {
819  ossimString value = cameraKwl.find(ossimString("d")+ossimString::toString(numberList[idx]));
820  if(!value.empty())
821  {
822  std::istringstream inStr(value.c_str());
823  inStr >> distance;
824  ossim::skipws(inStr);
825  inStr >> distortion;
826 #if 0
827  std::vector<ossimString> splitString;
828  ossimString tempString(value);
829  tempString = tempString.trim();
830  tempString.split(splitString, " ");
831  std::cout << splitString.size() << std::endl;
832  if(splitString.size() >= 2)
833  {
834  distance = splitString[0].toDouble();
835  distortion = splitString[1].toDouble();
836  }
837 #endif
838 
839  tool.setValue(distortion, unitType);
840  lensKwl.add(ossimString("distance") + ossimString::toString(idx),
841  distance,
842  true);
843  lensKwl.add(ossimString("distortion") + ossimString::toString(idx),
844  tool.getMillimeters(),
845  true);
846  }
847  lensKwl.add("convergence_threshold",
848  .00001,
849  true);
850  if(pixel_size)
851  {
852  lensKwl.add("dxdy",
854  true);
855  }
856  else
857  {
858  lensKwl.add("dxdy",
859  ".009 .009",
860  true);
861  }
862  }
864  {
865  theLensDistortion->loadState(lensKwl,"");
866  }
867  }
868  else
869  {
870 
871  if(principal_point)
872  {
873  std::vector<ossimString> splitString;
874  ossimString tempString(principal_point);
875  tempString = tempString.trim();
876  tempString.split(splitString, " ");
877  if(splitString.size() >= 2)
878  {
879  thePrincipalPoint.x = splitString[0].toDouble();
880  thePrincipalPoint.y = splitString[1].toDouble();
881  }
882  }
883  else
884  {
885  if(traceDebug())
886  {
887  ossimNotify(ossimNotifyLevel_DEBUG) << "No principal_point found" << std::endl;
888  return false;
889  }
890  }
891  if(pixel_size)
892  {
893  std::vector<ossimString> splitString;
894  ossimString tempString(pixel_size);
895  tempString = tempString.trim();
896  tempString.split(splitString, " ");
897  if(splitString.size() == 1)
898  {
899  thePixelSize.x = splitString[0].toDouble();
901  }
902  else if(splitString.size() == 2)
903  {
904  thePixelSize.x = splitString[0].toDouble();
905  thePixelSize.y = splitString[1].toDouble();
906  }
907  }
908  else
909  {
910  if(traceDebug())
911  {
912  ossimNotify(ossimNotifyLevel_DEBUG) << "No pixel size found" << std::endl;
913  return false;
914  }
915  }
916  if(focal_length)
917  {
918  theFocalLength = ossimString(focal_length).toDouble();
919  }
920  else
921  {
922  if(traceDebug())
923  {
924  ossimNotify(ossimNotifyLevel_DEBUG) << "No focal length found" << std::endl;
925  return false;
926  }
927  }
928 
930  {
931  ossimString lensPrefix = ossimString(prefix)+"distortion.";
933  lensPrefix.c_str());
934  }
935  }
937 
938  updateModel();
939 
941  if(compute_gsd_flag)
942  {
943  if(ossimString(compute_gsd_flag).toBool())
944  {
945  ossimGpt right;
946  ossimGpt top;
948  right);
950  top);
951 
954 
955  theGSD.x = horizontal.length();
956  theGSD.y = vertical.length();
957  theMeanGSD = (theGSD.x+theGSD.y)*.5;
958  }
959  }
960  if(traceDebug())
961  {
962  ossimNotify(ossimNotifyLevel_DEBUG) << "theOmega: " << theOmega << std::endl
963  << "thePhi: " << thePhi << std::endl
964  << "theKappa: " << theKappa << std::endl;
965  std::cout << "platform position: " << thePlatformPosition << std::endl;
966  std::cout << "platform position ECF: " << theEcefPlatformPosition << std::endl;
967  std::cout << "ossimApplanixModel::loadState: ......... leaving" << std::endl;
968  }
969 
970  return true;
971 }
ossimString theSensorID
virtual const ossimDatum * create(const ossimString &code) const
create method
virtual ossimGpt inverse(const ossimDpt &eastingNorthing) const
Will take a point in meters and convert it to ground.
virtual void initAdjustableParameters()
static ossimString upcase(const ossimString &aString)
Definition: ossimString.cpp:34
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
double lond() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:97
void lineSampleToWorld(const ossimDpt &image_point, ossimGpt &gpt) const
ossimUnitType
Represents serializable keyword/value map.
bool valid() const
Definition: ossimRefPtr.h:75
const char * find(const char *key) const
double getShiftValuesX() const
ossimString theImageID
ossim_int32 getUtmZone() const
NEWMAT::Matrix theCompositeMatrixInverse
double getShiftValuesY() const
void setValue(double value, ossimUnitType unitType=OSSIM_METERS)
double y
Definition: ossimDpt.h:165
static ossimString toString(bool aValue)
Numeric to string methods.
void split(std::vector< ossimString > &result, const ossimString &separatorList, bool skipBlankFields=false) const
Splits this string into a vector of strings (fields) using the delimiter list specified.
virtual ossim_int32 getEntryNumber(const char *entry_string, bool case_insensitive=true) const
double latd() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:87
const ossimDatum * datum() const
datum().
Definition: ossimGpt.h:196
ossimEcefPoint theEcefPlatformPosition
ossim_int32 toInt32() const
ossim_int32 getFieldIdxLike(const ossimString &searchKey) const
Is a case insensitive parse of the column names for the orientation record.
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
double z
Definition: ossimDpt3d.h:145
OSSIM_DLL std::istream & skipws(std::istream &in)
Definition: ossimCommon.cpp:38
std::string::size_type size() const
Definition: ossimString.h:405
std::string::iterator begin()
Definition: ossimString.h:420
unsigned int ossim_uint32
ossimString trim(const ossimString &valueToTrim=ossimString(" \\)) const
this will strip lead and trailing character passed in.
static ossimGeoidManager * instance()
Implements singelton pattern:
double height() const
Definition: ossimGpt.h:107
double toDouble() const
static ossimDatumFactory * instance()
NEWMAT::Matrix theCompositeMatrix
uses file path to init model
ossimString getUtmHemisphere() const
void setZone(const ossimGpt &ground)
const ossimRefPtr< ossimApplanixEORecord > getRecordGivenId(const ossimString &id) const
Given an ID it will search and find an EO record that matches the ID.
double length() const
ossimEcefVector theShiftValues
std::vector< ossimString > getSubstringKeyList(const ossimString &regularExpression) const
ossimRefPtr< ossimMeanRadialLensDistortion > theLensDistortion
ossimDrect theImageClipRect
static NEWMAT::Matrix createIdentity()
double getShiftValuesZ() const
double x
Definition: ossimDpt.h:164
double x
Definition: ossimDpt3d.h:143
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string&#39;s contents...
Definition: ossimString.h:396
bool empty() const
Definition: ossimString.h:411
std::basic_istringstream< char > istringstream
Class for char input memory streams.
Definition: ossimIosFwd.h:32
double y
Definition: ossimDpt3d.h:144
bool parseFile(const ossimFilename &file)
Will parse the entire Exterior orientation file and then index any record ID&#39;s found.
virtual void setDatum(const ossimDatum *datum)
Sets theDatum to datum.
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
float distance(double lat1, double lon1, double lat2, double lon2, int units)
static ossimUnitTypeLut * instance()
Returns the static instance of an ossimUnitTypeLut object.
virtual double offsetFromEllipsoid(const ossimGpt &gpt)
void setHemisphere(const ossimGpt &ground)
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
ossim_float64 theMeanGSD
int ossim_int32
ossimKeywordlist & trimAllValues(const ossimString &valueToTrim=ossimString(" \\))
bool isnan(const float &v)
isnan Test for floating point Not A Number (NAN) value.
Definition: ossimCommon.h:91

◆ saveState()

bool ossimApplanixUtmModel::saveState ( ossimKeywordlist kwl,
const char *  prefix = 0 
) const
virtual

METHODS: saveState, loadState Fulfills ossimObject base-class pure virtuals. Loads and saves geometry KWL files.

Reimplemented from ossimSensorModel.

Definition at line 387 of file ossimApplanixUtmModel.cpp.

References ossimKeywordlist::add(), ossimString::c_str(), ossimDatum::code(), ossimGpt::datum(), ossimGpt::height(), ossimGpt::latd(), ossimGpt::lond(), ossimMeanRadialLensDistortion::saveState(), ossimSensorModel::saveState(), theBoreSightTx, theBoreSightTy, theBoreSightTz, theEcefPlatformPosition, theFocalLength, theKappa, theLensDistortion, theOmega, thePhi, thePixelSize, thePlatformPosition, thePrincipalPoint, theShiftValues, theUtmHemisphere, theUtmPlatformPosition, theUtmZone, ossimString::toString(), ossimRefPtr< T >::valid(), ossimEcefPoint::x(), ossimEcefVector::x(), ossimDpt3d::x, ossimDpt::x, ossimEcefPoint::y(), ossimEcefVector::y(), ossimDpt3d::y, ossimDpt::y, ossimEcefPoint::z(), ossimEcefVector::z(), and ossimDpt3d::z.

389 {
390  ossimSensorModel::saveState(kwl, prefix);
391 
392  kwl.add(prefix, "type", "ossimApplanixUtmModel", true);
393 
394  kwl.add(prefix, "omega", theOmega, true);
395  kwl.add(prefix, "phi", thePhi, true);
396  kwl.add(prefix, "kappa", theKappa, true);
397  kwl.add(prefix, "bore_sight_tx", theBoreSightTx*60, true);
398  kwl.add(prefix, "bore_sight_ty", theBoreSightTy*60, true);
399  kwl.add(prefix, "bore_sight_tz", theBoreSightTz*60, true);
400  kwl.add(prefix, "principal_point", ossimString::toString(thePrincipalPoint.x) + " " + ossimString::toString(thePrincipalPoint.y));
401  kwl.add(prefix, "pixel_size", ossimString::toString(thePixelSize.x) + " " + ossimString::toString(thePixelSize.y));
402  kwl.add(prefix, "focal_length", theFocalLength);
403  kwl.add(prefix, "ecef_platform_position",
407  kwl.add(prefix, "latlonh_platform_position",
412  kwl.add(prefix,
413  "utm_platform_position",
418  true);
419  kwl.add(prefix,
420  "utm_zone",
421  theUtmZone,
422  true);
423  kwl.add(prefix,
424  "utm_hemisphere",
426  true);
427  kwl.add(prefix,
428  "shift_values",
432  true);
434  {
435  ossimString lensPrefix = ossimString(prefix)+"distortion.";
437  lensPrefix.c_str());
438  }
439 
440  return true;
441 }
double z() const
double lond() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:97
bool valid() const
Definition: ossimRefPtr.h:75
double y
Definition: ossimDpt.h:165
virtual const ossimString & code() const
Definition: ossimDatum.h:57
static ossimString toString(bool aValue)
Numeric to string methods.
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
double x() const
double latd() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:87
const ossimDatum * datum() const
datum().
Definition: ossimGpt.h:196
ossimEcefPoint theEcefPlatformPosition
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
double z
Definition: ossimDpt3d.h:145
double height() const
Definition: ossimGpt.h:107
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
ossimEcefVector theShiftValues
ossimRefPtr< ossimMeanRadialLensDistortion > theLensDistortion
double x() const
double y() const
double y() const
double x
Definition: ossimDpt.h:164
double x
Definition: ossimDpt3d.h:143
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string&#39;s contents...
Definition: ossimString.h:396
double y
Definition: ossimDpt3d.h:144
double z() const

◆ setFocalLength()

void ossimApplanixUtmModel::setFocalLength ( double  focalLength)

Definition at line 374 of file ossimApplanixUtmModel.cpp.

References theFocalLength.

375 {
376  theFocalLength = focalLength;
377 }

◆ setImageRect()

void ossimApplanixUtmModel::setImageRect ( const ossimDrect rect)

Definition at line 368 of file ossimApplanixUtmModel.cpp.

References ossimDrect::midPoint(), ossimSensorModel::theImageClipRect, and ossimSensorModel::theRefImgPt.

369 {
370  theImageClipRect = rect;
371  theRefImgPt = rect.midPoint();
372 }
ossimDrect theImageClipRect
ossimDpt midPoint() const
Definition: ossimDrect.h:817

◆ setPixelSize()

void ossimApplanixUtmModel::setPixelSize ( const ossimDpt pixelSize)

Definition at line 363 of file ossimApplanixUtmModel.cpp.

References thePixelSize.

364 {
365  thePixelSize = pixelSize;
366 }

◆ setPlatformPosition()

void ossimApplanixUtmModel::setPlatformPosition ( const ossimGpt gpt)

Definition at line 379 of file ossimApplanixUtmModel.cpp.

References theEcefPlatformPosition, ossimSensorModel::theRefGndPt, and updateModel().

380 {
381  theRefGndPt = gpt;
383  updateModel();
384 
385 }
ossimEcefPoint theEcefPlatformPosition

◆ setPrincipalPoint()

void ossimApplanixUtmModel::setPrincipalPoint ( ossimDpt  principalPoint)

Definition at line 358 of file ossimApplanixUtmModel.cpp.

References thePrincipalPoint.

359 {
360  thePrincipalPoint = principalPoint;
361 }

◆ setupOptimizer()

bool ossimApplanixUtmModel::setupOptimizer ( const ossimString init_file)
virtual

ground to image faster (you don't need DEM) //TBC

Reimplemented from ossimOptimizableProjection.

Definition at line 973 of file ossimApplanixUtmModel.cpp.

References ossimKeywordlist::addFile(), ossimString::c_str(), and loadState().

974 {
975  ossimKeywordlist kwl;
976  kwl.addFile(init_file.c_str());
977 
978  return loadState(kwl);
979 }
Represents serializable keyword/value map.
bool addFile(const char *file)
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string&#39;s contents...
Definition: ossimString.h:396

◆ updateModel()

void ossimApplanixUtmModel::updateModel ( )
virtual

VIRTUAL METHOD: updateModel() Following a change to the adjustable parameter set, this virtual is called to permit instances to compute derived quantities after parameter change.

Reimplemented from ossimSensorModel.

Definition at line 234 of file ossimApplanixUtmModel.cpp.

References ossimAdjustableParameterInterface::computeParameterOffset(), ossimMatrix3x3::createRotationXMatrix(), ossimMatrix3x3::createRotationYMatrix(), ossimMatrix3x3::createRotationZMatrix(), ossimEcefVector::cross(), ossimUtmProjection::forward(), ossimGpt::height(), ossimUtmProjection::inverse(), ossimGpt::latd(), lineSampleToWorld(), ossimDrect::ll(), ossimGpt::lond(), ossimDrect::lr(), ossimLsrSpace::lsrToEcefRotMatrix(), ossimGpt::metersPerDegree(), ossimEcefVector::normalize(), OSSIM_LEFT_HANDED, ossimPolygon::resize(), ossimMapProjection::setMetersPerPixel(), ossimUtmProjection::setZone(), theAdjEcefPlatformPosition, ossimSensorModel::theBoundGndPolygon, theCompositeMatrix, theCompositeMatrixInverse, ossimSensorModel::theImageClipRect, theKappa, ossimSensorModel::theMeanGSD, theOmega, thePhi, thePlatformPosition, theUtmHemisphere, theUtmZone, ossimDrect::ul(), ossimDrect::ur(), and ossimDpt::x.

Referenced by setPlatformPosition().

235 {
236 
237  ossimGpt wgs84Pt;
238  double metersPerDegree = wgs84Pt.metersPerDegree().x;
239  double degreePerMeter = 1.0/metersPerDegree;
240  double latShift = -computeParameterOffset(1)*theMeanGSD*degreePerMeter;
241  double lonShift = computeParameterOffset(0)*theMeanGSD*degreePerMeter;
242 
244 // gpt.height(0.0);
245  double height = gpt.height();
246  gpt.height(height + computeParameterOffset(5));
247  gpt.latd(gpt.latd() + latShift);
248  gpt.lond(gpt.lond() + lonShift);
249 
252  // ORIENT TO A UTM AXIS
253  //
254  NEWMAT::ColumnVector v(3);
255 
256  v[0] = 0.0;
257  v[1] = 0.0;
258  v[2] = 1.0;
259  NEWMAT::ColumnVector v2 = lsrSpace.lsrToEcefRotMatrix()*v;
260  ossimEcefVector zVector(v2[0], v2[1], v2[2]);
261  zVector.normalize();
262 
263  // now lets create a UTM axis by creating a derivative at the center
264  // by shift over a few pixels and subtracting
265  //
266  ossimUtmProjection utmProj;
267 
268  utmProj.setZone(theUtmZone);
269  utmProj.setZone(theUtmHemisphere);
270  utmProj.setMetersPerPixel(ossimDpt(1.0,1.0));
272  ossimDpt rPt = midPt + ossimDpt(10, 0.0);
273  ossimDpt uPt = midPt + ossimDpt(0.0, 10.0);
274  ossimGpt wMidPt = utmProj.inverse(midPt);
275  ossimGpt wRPt = utmProj.inverse(rPt);
276  ossimGpt wUPt = utmProj.inverse(uPt);
277 
278  ossimEcefPoint ecefMidPt = wMidPt;
279  ossimEcefPoint ecefRPt = wRPt;
280  ossimEcefPoint ecefUPt = wUPt;
281 
282  ossimEcefVector east = ecefRPt-ecefMidPt;
283  ossimEcefVector north = ecefUPt-ecefMidPt;
284  east.normalize();
285  north.normalize();
286 
287  // now use the lsr space constructors to construct an orthogonal set of axes
288  //
290  0,
291  north,
292  east.cross(north));
293 // lsrSpace = ossimLsrSpace(thePlatformPosition);
294  // DONE ORIENT TO UTM AXIS
295 
296  NEWMAT::Matrix platformLsrMatrix = lsrSpace.lsrToEcefRotMatrix();
300 
301  theCompositeMatrix = platformLsrMatrix*orientationMatrix;
303 
304 // theAdjEcefPlatformPosition = theEcefPlatformPosition;
305 
307  // ossim_float64 w = theImageClipRect.width();//*2.0;
308  // ossim_float64 h = theImageClipRect.height();//*2.0;
309 
310  lineSampleToWorld(theImageClipRect.ul(),gpt);//+ossimDpt(-w, -h), gpt);
311  theBoundGndPolygon[0] = gpt;
312  lineSampleToWorld(theImageClipRect.ur(),gpt);//+ossimDpt(w, -h), gpt);
313  theBoundGndPolygon[1] = gpt;
314  lineSampleToWorld(theImageClipRect.lr(),gpt);//+ossimDpt(w, h), gpt);
315  theBoundGndPolygon[2] = gpt;
316  lineSampleToWorld(theImageClipRect.ll(),gpt);//+ossimDpt(-w, h), gpt);
317  theBoundGndPolygon[3] = gpt;
318 }
static NEWMAT::Matrix createRotationXMatrix(double angle, ossimCoordSysOrientMode orientationMode=OSSIM_RIGHT_HANDED)
virtual ossimGpt inverse(const ossimDpt &eastingNorthing) const
Will take a point in meters and convert it to ground.
double lond() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:97
void lineSampleToWorld(const ossimDpt &image_point, ossimGpt &gpt) const
ossimEcefVector cross(const ossimEcefVector &) const
static NEWMAT::Matrix createRotationYMatrix(double angle, ossimCoordSysOrientMode orientationMode=OSSIM_RIGHT_HANDED)
NEWMAT::Matrix theCompositeMatrixInverse
const ossimDpt & ul() const
Definition: ossimDrect.h:339
double latd() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:87
virtual ossimDpt forward(const ossimGpt &latLon) const
All map projections will convert the world coordinate to an easting northing (Meters).
virtual void setMetersPerPixel(const ossimDpt &gsd)
const NEWMAT::Matrix & lsrToEcefRotMatrix() const
ossimPolygon theBoundGndPolygon
ossimEcefPoint theAdjEcefPlatformPosition
double height() const
Definition: ossimGpt.h:107
NEWMAT::Matrix theCompositeMatrix
uses file path to init model
void setZone(const ossimGpt &ground)
ossimDrect theImageClipRect
static NEWMAT::Matrix createRotationZMatrix(double angle, ossimCoordSysOrientMode orientationMode=OSSIM_RIGHT_HANDED)
const ossimDpt & ur() const
Definition: ossimDrect.h:340
double x
Definition: ossimDpt.h:164
ossimDpt metersPerDegree() const
Definition: ossimGpt.cpp:498
const ossimDpt & ll() const
Definition: ossimDrect.h:342
void resize(ossim_uint32 newSize)
const ossimDpt & lr() const
Definition: ossimDrect.h:341
ossim_float64 theMeanGSD

◆ useForward()

virtual bool ossimApplanixUtmModel::useForward ( ) const
inlinevirtual

ossimOptimizableProjection

Implements ossimOptimizableProjection.

Definition at line 55 of file ossimApplanixUtmModel.h.

55 {return true;}

◆ worldToLineSample()

void ossimApplanixUtmModel::worldToLineSample ( const ossimGpt worldPoint,
ossimDpt lineSampPt 
) const
virtual

METHOD: worldToLineSample() Performs the forward projection from ground point to line, sample.

Reimplemented from ossimSensorModel.

Definition at line 194 of file ossimApplanixUtmModel.cpp.

References ossimEcefVector::data(), ossimLensDistortion::distort(), ossimPolygon::getNumberOfVertices(), ossimPolygon::hasNans(), ossimDpt::makeNan(), ossimPolygon::pointWithin(), theAdjEcefPlatformPosition, ossimSensorModel::theBoundGndPolygon, theCompositeMatrixInverse, theFocalLength, theLensDistortion, thePixelSize, thePrincipalPoint, ossimSensorModel::theRefImgPt, ossimRefPtr< T >::valid(), ossimDpt::x, and ossimDpt::y.

196 {
197 #if 0
200  {
201  if (!(theBoundGndPolygon.pointWithin(world_point)))
202  {
203  image_point.makeNan();
204 // image_point = extrapolate(world_point);
205  return;
206  }
207  }
208 #endif
209  ossimEcefPoint g_ecf(world_point);
210  ossimEcefVector ecfRayDir(g_ecf - theAdjEcefPlatformPosition);
211  ossimColumnVector3d camRayDir (theCompositeMatrixInverse*ecfRayDir.data());
212 
213 
214  double scale = -theFocalLength/camRayDir[2];
215  ossimDpt film (scale*camRayDir[0], scale*camRayDir[1]);
216 
217  if (theLensDistortion.valid())
218  {
219  ossimDpt filmOut;
220  theLensDistortion->distort(film, filmOut);
221  film = filmOut;
222  }
223 
224  ossimDpt f1(film + thePrincipalPoint);
225  ossimDpt p1(f1.x/thePixelSize.x,
226  -f1.y/thePixelSize.y);
227 
228  ossimDpt p0 (p1.x + theRefImgPt.x,
229  p1.y + theRefImgPt.y);
230 
231  image_point = p0;
232 }
bool valid() const
Definition: ossimRefPtr.h:75
NEWMAT::Matrix theCompositeMatrixInverse
double y
Definition: ossimDpt.h:165
ossimPolygon theBoundGndPolygon
ossimEcefPoint theAdjEcefPlatformPosition
bool hasNans() const
will sequence through the polygon and check to see if any values are NAN
bool pointWithin(const ossimDpt &point) const
METHOD: pointWithin(ossimDpt) Returns TRUE if point is inside polygon.
ossimRefPtr< ossimMeanRadialLensDistortion > theLensDistortion
ossim_uint32 getNumberOfVertices() const
double x
Definition: ossimDpt.h:164
virtual void distort(const ossimDpt &input, ossimDpt &output) const

Member Data Documentation

◆ theAdjEcefPlatformPosition

ossimEcefPoint ossimApplanixUtmModel::theAdjEcefPlatformPosition
protected

Definition at line 78 of file ossimApplanixUtmModel.h.

Referenced by imagingRay(), updateModel(), and worldToLineSample().

◆ theBoreSightTx

double ossimApplanixUtmModel::theBoreSightTx
protected

Definition at line 64 of file ossimApplanixUtmModel.h.

Referenced by saveState().

◆ theBoreSightTy

double ossimApplanixUtmModel::theBoreSightTy
protected

Definition at line 65 of file ossimApplanixUtmModel.h.

Referenced by saveState().

◆ theBoreSightTz

double ossimApplanixUtmModel::theBoreSightTz
protected

Definition at line 66 of file ossimApplanixUtmModel.h.

Referenced by saveState().

◆ theCompositeMatrix

NEWMAT::Matrix ossimApplanixUtmModel::theCompositeMatrix
protected

uses file path to init model

Definition at line 59 of file ossimApplanixUtmModel.h.

Referenced by imagingRay(), ossimApplanixUtmModel(), and updateModel().

◆ theCompositeMatrixInverse

NEWMAT::Matrix ossimApplanixUtmModel::theCompositeMatrixInverse
protected

Definition at line 60 of file ossimApplanixUtmModel.h.

Referenced by ossimApplanixUtmModel(), updateModel(), and worldToLineSample().

◆ theEcefPlatformPosition

ossimEcefPoint ossimApplanixUtmModel::theEcefPlatformPosition
protected

Definition at line 70 of file ossimApplanixUtmModel.h.

Referenced by ossimApplanixUtmModel(), saveState(), and setPlatformPosition().

◆ theFocalLength

double ossimApplanixUtmModel::theFocalLength
protected

◆ theKappa

double ossimApplanixUtmModel::theKappa
protected

Definition at line 63 of file ossimApplanixUtmModel.h.

Referenced by saveState(), and updateModel().

◆ theLensDistortion

ossimRefPtr<ossimMeanRadialLensDistortion> ossimApplanixUtmModel::theLensDistortion
protected

◆ theOmega

double ossimApplanixUtmModel::theOmega
protected

Definition at line 61 of file ossimApplanixUtmModel.h.

Referenced by saveState(), and updateModel().

◆ thePhi

double ossimApplanixUtmModel::thePhi
protected

Definition at line 62 of file ossimApplanixUtmModel.h.

Referenced by saveState(), and updateModel().

◆ thePixelSize

ossimDpt ossimApplanixUtmModel::thePixelSize
protected

◆ thePlatformPosition

ossimGpt ossimApplanixUtmModel::thePlatformPosition
protected

Definition at line 71 of file ossimApplanixUtmModel.h.

Referenced by saveState(), and updateModel().

◆ thePrincipalPoint

ossimDpt ossimApplanixUtmModel::thePrincipalPoint
protected

◆ theShiftValues

ossimEcefVector ossimApplanixUtmModel::theShiftValues
protected

Definition at line 75 of file ossimApplanixUtmModel.h.

Referenced by saveState().

◆ theUtmHemisphere

ossim_int8 ossimApplanixUtmModel::theUtmHemisphere
protected

Definition at line 73 of file ossimApplanixUtmModel.h.

Referenced by saveState(), and updateModel().

◆ theUtmPlatformPosition

ossimDpt3d ossimApplanixUtmModel::theUtmPlatformPosition
protected

Definition at line 74 of file ossimApplanixUtmModel.h.

Referenced by saveState().

◆ theUtmZone

ossim_int32 ossimApplanixUtmModel::theUtmZone
protected

Definition at line 72 of file ossimApplanixUtmModel.h.

Referenced by saveState(), and updateModel().


The documentation for this class was generated from the following files: