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

#include <ossimPpjFrameSensor.h>

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

Public Member Functions

 ossimPpjFrameSensor ()
 
 ossimPpjFrameSensor (const ossimPpjFrameSensor &src)
 
virtual ossimObjectdup () const
 
virtual void imagingRay (const ossimDpt &image_point, ossimEcefRay &image_ray) const
 
virtual void lineSampleToWorld (const ossimDpt &image_point, ossimGpt &worldPoint) 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 setFocalLength (double focX, double focY)
 
void setCameraPosition (const ossimGpt &value)
 
void setPrincipalPoint (const ossimDpt &value)
 
void setecef2CamMatrix (const NEWMAT::Matrix &value)
 
void setAveragePrjectedHeight (double averageProjectedHeight)
 
virtual bool useForward () const
 
virtual void initAdjustableParameters ()
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 
- 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)
 
virtual bool setupOptimizer (const ossimString &setup)
 setupFromString() Derived classes should implement as needed. Initialize parameters needed for optimizeFit and degreesOfFreedom More...
 
- 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 m_ecef2Cam
 
NEWMAT::Matrix m_ecef2CamInverse
 
ossimDpt m_principalPoint
 
double m_focalLengthX
 
double m_focalLengthY
 
double m_focalLength
 
ossimEcefPoint m_ecefCameraPosition
 
ossimGpt m_cameraPositionEllipsoid
 
double m_radialK1
 
double m_radialK2
 
double m_radialP1
 
double m_radialP2
 
ossimGpt m_adjustedCameraPosition
 
double m_adjustedFocalLength
 
double m_averageProjectedHeight
 
- 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 15 of file ossimPpjFrameSensor.h.

Constructor & Destructor Documentation

◆ ossimPpjFrameSensor() [1/2]

ossimPpjFrameSensor::ossimPpjFrameSensor ( )

Definition at line 40 of file ossimPpjFrameSensor.cpp.

Referenced by dup().

41  :
42  m_ecef2Cam(),
44  m_principalPoint(0.0, 0.0),
45  m_focalLengthX(0.0),
46  m_focalLengthY(0.0),
47  m_focalLength(0.0),
50  m_radialK1(0.0),
51  m_radialK2(0.0),
52  m_radialP1(0.0),
53  m_radialP2(0.0),
57 {
58  if (traceDebug())
59  {
61  << "ossimPpjFrameSensor::ossimPpjFrameSensor DEBUG:" << std::endl;
62  }
64  theSensorID = "PpjFrame";
65  m_ecef2Cam.ReSize(3,3);
66  m_ecef2CamInverse.ReSize(3,3);
67 
68  std::fill(m_ecef2Cam.Store(), m_ecef2Cam.Store()+9, 0.0);
69  std::fill(m_ecef2CamInverse.Store(), m_ecef2CamInverse.Store()+9, 0.0);
70  m_ecef2Cam[0][0] = 1.0;
71  m_ecef2Cam[1][1] = 1.0;
72  m_ecef2Cam[2][2] = 1.0;
73  m_ecef2CamInverse[0][0] = 1.0;
74  m_ecef2CamInverse[1][1] = 1.0;
75  m_ecef2CamInverse[2][2] = 1.0;
76 }
ossimString theSensorID
NEWMAT::Matrix m_ecef2Cam
ossimEcefPoint m_ecefCameraPosition
virtual void initAdjustableParameters()
NEWMAT::Matrix m_ecef2CamInverse
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ ossimPpjFrameSensor() [2/2]

ossimPpjFrameSensor::ossimPpjFrameSensor ( const ossimPpjFrameSensor src)

Definition at line 78 of file ossimPpjFrameSensor.cpp.

79  :
80  ossimSensorModel(src),
96 {
97 }
NEWMAT::Matrix m_ecef2Cam
ossimEcefPoint m_ecefCameraPosition
NEWMAT::Matrix m_ecef2CamInverse

Member Function Documentation

◆ dup()

ossimObject * ossimPpjFrameSensor::dup ( ) const
virtual

Implements ossimProjection.

Definition at line 99 of file ossimPpjFrameSensor.cpp.

References ossimPpjFrameSensor().

100 {
101  return new ossimPpjFrameSensor(*this);
102 }

◆ imagingRay()

void ossimPpjFrameSensor::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 133 of file ossimPpjFrameSensor.cpp.

References m_adjustedCameraPosition, m_adjustedFocalLength, m_ecef2CamInverse, m_principalPoint, ossimEcefRay::setDirection(), ossimEcefRay::setOrigin(), ossimDpt::x, and ossimDpt::y.

Referenced by lineSampleHeightToWorld(), and lineSampleToWorld().

135 {
136  // Form camera frame LOS vector
137  ossimColumnVector3d camLOS(imagePoint.x - m_principalPoint.x,
138  imagePoint.y - m_principalPoint.y,
140 
141  // Rotate to ECF
142  ossimColumnVector3d ecfLOS = m_ecef2CamInverse * camLOS;
143  imageRay.setOrigin(m_adjustedCameraPosition);
144  ossimEcefVector ecfRayDir(ecfLOS);
145  imageRay.setDirection(ecfRayDir);
146 
147  if (traceDebug())
148  {
150  << "ossimPpjFrameSensor::imagingRay DEBUG:\n"
151  << " camLOS = " << camLOS << "\n"
152  << " m_adjustedPlatformPosition = " << m_adjustedCameraPosition << "\n"
153  << " imageRay = " << imageRay << "\n"
154  << std::endl;
155  }
156 
157 }
double y
Definition: ossimDpt.h:165
NEWMAT::Matrix m_ecef2CamInverse
double x
Definition: ossimDpt.h:164
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ initAdjustableParameters()

void ossimPpjFrameSensor::initAdjustableParameters ( )
virtual

Reimplemented from ossimAdjustableParameterInterface.

Definition at line 269 of file ossimPpjFrameSensor.cpp.

270 {
271  if (traceExec())
272  ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG ossimPpjFrameSensor::initAdjustableParameters: returning..." << std::endl;
274 
279 
284 
289 
290  // TODO Add these back in when orientation angle offsets are fixed.
291  // setAdjustableParameter(PARAM_ADJ_ROLL_OFFSET, 0.0);
292  // setParameterDescription(PARAM_ADJ_ROLL_OFFSET, "roll_offset");
293  // setParameterUnit(PARAM_ADJ_ROLL_OFFSET, "degrees");
294  // setParameterSigma(PARAM_ADJ_ROLL_OFFSET, 10);
295 
296  // setAdjustableParameter(PARAM_ADJ_PITCH_OFFSET, 0.0);
297  // setParameterDescription(PARAM_ADJ_PITCH_OFFSET, "pitch_offset");
298  // setParameterUnit(PARAM_ADJ_PITCH_OFFSET, "degrees");
299  // setParameterSigma(PARAM_ADJ_PITCH_OFFSET, 10);
300 
301  // setAdjustableParameter(PARAM_ADJ_YAW_OFFSET, 0.0);
302  // setParameterDescription(PARAM_ADJ_YAW_OFFSET, "yaw_offset");
303  // setParameterUnit(PARAM_ADJ_YAW_OFFSET, "degrees");
304  // setParameterSigma(PARAM_ADJ_YAW_OFFSET, .04);
305 
310 }
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)
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ lineSampleHeightToWorld()

void ossimPpjFrameSensor::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 167 of file ossimPpjFrameSensor.cpp.

References ossim::almostEqual(), imagingRay(), ossimEcefRay::intersectAboveEarthEllipsoid(), ossim::isnan(), and m_averageProjectedHeight.

170 {
171  ossimEcefRay ray;
172  imagingRay(imagePoint, ray);
173  double h = (ossim::isnan(heightEllipsoid)||ossim::almostEqual(heightEllipsoid, 0.0))?m_averageProjectedHeight:heightEllipsoid;
175  worldPt = ossimGpt(pecf);
176 
177  if (traceDebug())
178  {
179  ossimNotify(ossimNotifyLevel_DEBUG) << "ossimPpjFrameSensor::lineSampleHeightToWorld DEBUG:" << std::endl;
180  ossimNotify(ossimNotifyLevel_DEBUG) << " imagePoint = " << imagePoint << std::endl;
181  ossimNotify(ossimNotifyLevel_DEBUG) << " heightEllipsoid = " << heightEllipsoid << std::endl;
182  ossimNotify(ossimNotifyLevel_DEBUG) << " ray = " << ray << std::endl;
183  ossimNotify(ossimNotifyLevel_DEBUG) << " worldPt = " << worldPt << std::endl;
184  }
185 }
virtual void imagingRay(const ossimDpt &image_point, ossimEcefRay &image_ray) const
ossimEcefPoint intersectAboveEarthEllipsoid(const double &heightAboveEllipsoid, const ossimDatum *aDatum=ossimDatumFactory::instance() ->wgs84()) const
bool almostEqual(T x, T y, T tolerance=FLT_EPSILON)
Definition: ossimCommon.h:53
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
bool isnan(const float &v)
isnan Test for floating point Not A Number (NAN) value.
Definition: ossimCommon.h:91

◆ lineSampleToWorld()

void ossimPpjFrameSensor::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 159 of file ossimPpjFrameSensor.cpp.

References imagingRay(), ossimElevManager::instance(), ossimElevSource::intersectRay(), and m_averageProjectedHeight.

161 {
162  ossimEcefRay ray;
163  imagingRay(imagePoint, ray);
165 }
virtual void imagingRay(const ossimDpt &image_point, ossimEcefRay &image_ray) const
bool intersectRay(const ossimEcefRay &ray, ossimGpt &gpt, double defaultElevValue=0.0)
METHOD: intersectRay()
static ossimElevManager * instance()
METHOD: instance() Implements singelton pattern.

◆ loadState()

bool ossimPpjFrameSensor::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 312 of file ossimPpjFrameSensor.cpp.

313 {
314  if (traceDebug())
315  {
317  << "ossimPpjFrameSensor::loadState DEBUG:" << std::endl;
318  }
319 
320  theGSD.makeNan();
322  ossimSensorModel::loadState(kwl, prefix);
324  {
326  }
327  ossimString principal_point = kwl.find(prefix, "principal_point");
328  ossimString focal_length_x = kwl.find(prefix, "focal_length_x");
329  ossimString focal_length_y = kwl.find(prefix, "focal_length_y");
330  ossimString number_samples = kwl.find(prefix, "number_samples");
331  ossimString number_lines = kwl.find(prefix, "number_lines");
332  ossimString ecf_to_cam_row1 = kwl.find(prefix, "ecf_to_cam_row1");
333  ossimString ecf_to_cam_row2 = kwl.find(prefix, "ecf_to_cam_row2");
334  ossimString ecf_to_cam_row3 = kwl.find(prefix, "ecf_to_cam_row3");
335  ossimString platform_position = kwl.find(prefix, "ecef_camera_position");
336  ossimString averageProjectedHeight = kwl.find(prefix, "average_projected_height");
337 
338  // ossimString roll;
339  // ossimString pitch;
340  // ossimString yaw;
341  // m_roll = 0;
342  // m_pitch = 0;
343  // m_yaw = 0;
344  // roll = kwl.find(prefix, "roll");
345  // pitch = kwl.find(prefix, "pitch");
346  // yaw = kwl.find(prefix, "yaw");
347 
348  bool result = (!principal_point.empty()&&
349  !focal_length_x.empty()&&
350  !platform_position.empty()&&
351  !ecf_to_cam_row1.empty()&&
352  !ecf_to_cam_row2.empty()&&
353  !ecf_to_cam_row3.empty());
354  if(!averageProjectedHeight.empty())
355  {
356  m_averageProjectedHeight = averageProjectedHeight.toDouble();
357  }
358  if(!number_samples.empty())
359  {
360  theImageSize = ossimIpt(number_samples.toDouble(), number_lines.toDouble());
363  }
365  {
367  }
368  if(theRefImgPt.hasNans())
369  {
371  }
372  if(!focal_length_x.empty())
373  {
374  m_focalLengthX = focal_length_x.toDouble();
376  }
377  if(!focal_length_y.empty())
378  {
379  m_focalLengthY = focal_length_y.toDouble();
380  }
381 
382  std::vector<ossimString> row;
383  if(!ecf_to_cam_row1.empty())
384  {
385  row = ecf_to_cam_row1.explode(" ");
386  for (int i=0; i<3; ++i)
387  m_ecef2Cam[0][i] = row[i].toDouble();
388  row = ecf_to_cam_row2.explode(" ");
389  for (int i=0; i<3; ++i)
390  m_ecef2Cam[1][i] = row[i].toDouble();
391  row = ecf_to_cam_row3.explode(" ");
392  for (int i=0; i<3; ++i)
393  m_ecef2Cam[2][i] = row[i].toDouble();
395  }
396 
397  // if(!roll.empty())
398  // {
399  // m_roll = roll.toDouble();
400  // }
401  // if(!pitch.empty())
402  // {
403  // m_pitch = pitch.toDouble();
404  // }
405  // if(!yaw.empty())
406  // {
407  // m_yaw = yaw.toDouble();
408  // }
409 
410  if(!principal_point.empty())
411  {
412  m_principalPoint.toPoint(principal_point);
413  }
414  if(!platform_position.empty())
415  {
416  m_ecefCameraPosition.toPoint(platform_position);
418  }
419 
420 
421  updateModel();
422 
423  if(theGSD.isNan())
424  {
425  try
426  {
427  computeGsd();
428  }
429  catch (const ossimException& e)
430  {
431  if (traceDebug())
432  {
434  << "ossimPpjFrameSensor::loadState Caught Exception:\n"
435  << e.what() << std::endl;
436  }
437  }
438  }
439  if (traceDebug())
440  {
442  << "ossimPpjFrameSensor::loadState complete..." << std::endl;
443  }
444 
445  return result;
446 }
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
const char * find(const char *key) const
bool isNan() const
Definition: ossimDpt.h:72
NEWMAT::Matrix m_ecef2Cam
void toPoint(const std::string &s)
Initializes this point from string.
void computeGsd()
This method computes the ground sample distance(gsd) and sets class attributes theGSD and theMeanGSD ...
virtual const char * what() const
Returns the error message.
void toPoint(const std::string &s)
Initializes this point from string.
Definition: ossimDpt.cpp:192
double toDouble() const
ossimEcefPoint m_ecefCameraPosition
virtual void initAdjustableParameters()
bool hasNans() const
Definition: ossimDrect.h:396
std::vector< ossimString > explode(const ossimString &delimeter) const
bool hasNans() const
Definition: ossimDpt.h:67
NEWMAT::Matrix m_ecef2CamInverse
ossimDrect theImageClipRect
ossimDpt midPoint() const
Definition: ossimDrect.h:817
ossim_int32 y
Definition: ossimIpt.h:142
bool empty() const
Definition: ossimString.h:411
ossim_int32 x
Definition: ossimIpt.h:141
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
void makeNan()
Definition: ossimDpt.h:65

◆ saveState()

bool ossimPpjFrameSensor::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 448 of file ossimPpjFrameSensor.cpp.

References ossimKeywordlist::add(), m_averageProjectedHeight, m_ecef2Cam, m_ecefCameraPosition, m_focalLengthX, m_focalLengthY, m_principalPoint, ossimSensorModel::saveState(), ossimSensorModel::theGSD, ossimSensorModel::theImageSize, ossimIpt::toString(), ossimDpt::toString(), ossimEcefPoint::toString(), and ossimString::toString().

449 {
450  ossimSensorModel::saveState(kwl, prefix);
451  // kwl.add(prefix, "roll", ossimString::toString(m_roll), true);
452  // kwl.add(prefix, "pitch", ossimString::toString(m_pitch), true);
453  // kwl.add(prefix, "yaw", ossimString::toString(m_yaw), true);
454  kwl.add(prefix, "gsd", theGSD.toString(), true);
455  kwl.add(prefix, "principal_point", m_principalPoint.toString(), true);
456  kwl.add(prefix, "ecef_camera_position",m_ecefCameraPosition.toString() ,true);
457  kwl.add(prefix, "focal_length_x", ossimString::toString(m_focalLengthX) ,true);
458  kwl.add(prefix, "focal_length_y", ossimString::toString(m_focalLengthY) ,true);
459  kwl.add(prefix, "image_size", theImageSize.toString() ,true);
460  kwl.add(prefix, "average_projected_height", m_averageProjectedHeight, true);
461  ossimString row1 = ossimString::toString(m_ecef2Cam[0][0]) + " " +
462  ossimString::toString(m_ecef2Cam[0][1]) + " " +
464  kwl.add(prefix, "ecf_to_cam_row1", row1, true);
465  ossimString row2 = ossimString::toString(m_ecef2Cam[1][0]) + " " +
466  ossimString::toString(m_ecef2Cam[1][1]) + " " +
468  kwl.add(prefix, "ecf_to_cam_row2", row2, true);
469  ossimString row3 = ossimString::toString(m_ecef2Cam[2][0]) + " " +
470  ossimString::toString(m_ecef2Cam[2][1]) + " " +
472  kwl.add(prefix, "ecf_to_cam_row3", row3, true);
473 
474  return true;
475 }
ossimString toString() const
Definition: ossimIpt.cpp:139
static ossimString toString(bool aValue)
Numeric to string methods.
NEWMAT::Matrix m_ecef2Cam
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
ossimEcefPoint m_ecefCameraPosition
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
ossimString toString(ossim_uint32 precision=15) const
Definition: ossimDpt.cpp:160
ossimString toString(ossim_uint32 precision=15) const
To string method.

◆ setAveragePrjectedHeight()

void ossimPpjFrameSensor::setAveragePrjectedHeight ( double  averageProjectedHeight)

Definition at line 128 of file ossimPpjFrameSensor.cpp.

References m_averageProjectedHeight.

129 {
130  m_averageProjectedHeight = averageProjectedHeight;
131 }

◆ setCameraPosition()

void ossimPpjFrameSensor::setCameraPosition ( const ossimGpt value)

Definition at line 111 of file ossimPpjFrameSensor.cpp.

References m_cameraPositionEllipsoid, and m_ecefCameraPosition.

112 {
114  m_ecefCameraPosition = value;
115 }
ossimEcefPoint m_ecefCameraPosition

◆ setecef2CamMatrix()

void ossimPpjFrameSensor::setecef2CamMatrix ( const NEWMAT::Matrix &  value)

Definition at line 122 of file ossimPpjFrameSensor.cpp.

References m_ecef2Cam, and m_ecef2CamInverse.

123 {
124  m_ecef2Cam = value;
126 }
NEWMAT::Matrix m_ecef2Cam
NEWMAT::Matrix m_ecef2CamInverse

◆ setFocalLength()

void ossimPpjFrameSensor::setFocalLength ( double  focX,
double  focY 
)

Definition at line 104 of file ossimPpjFrameSensor.cpp.

References m_focalLength, m_focalLengthX, and m_focalLengthY.

105 {
106  m_focalLengthX = focX;
107  m_focalLengthY = focY;
109 }

◆ setPrincipalPoint()

void ossimPpjFrameSensor::setPrincipalPoint ( const ossimDpt value)

Definition at line 117 of file ossimPpjFrameSensor.cpp.

References m_principalPoint.

118 {
119  m_principalPoint = value;
120 }

◆ updateModel()

void ossimPpjFrameSensor::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 208 of file ossimPpjFrameSensor.cpp.

209 {
210  if (traceDebug())
211  {
213  << "ossimPpjFrameSensor::updateModel DEBUG:" << std::endl;
214  }
215 
220 
222  m_cameraPositionEllipsoid.lond() + deltal,
224 
225  // TODO Need to add correction matrix to accommodate orientation offsets. It
226  // shouldn't be done in ECF frame.
227  // double r = ossim::degreesToRadians(m_roll + computeParameterOffset(PARAM_ADJ_ROLL_OFFSET));
228  // double p = ossim::degreesToRadians(m_pitch + computeParameterOffset(PARAM_ADJ_PITCH_OFFSET) );
229  // double y = ossim::degreesToRadians(m_yaw + computeParameterOffset(PARAM_ADJ_YAW_OFFSET));
230  // NEWMAT::Matrix rollM = ossimMatrix3x3::create(1, 0, 0,
231  // 0, cos(r), sin(r),
232  // 0, -sin(r), cos(r));
233  // NEWMAT::Matrix pitchM = ossimMatrix3x3::create(cos(p), 0, -sin(p),
234  // 0, 1, 0,
235  // sin(p), 0, cos(p));
236  // NEWMAT::Matrix yawM = ossimMatrix3x3::create(cos(y), sin(y), 0,
237  // -sin(y), cos(y), 0,
238  // 0,0,1);
239 
241 
242 
243  try
244  {
245  computeGsd();
246  }
247  catch(...)
248  {
249 
250  }
251  if (traceDebug())
252  {
254  << "ossimPpjFrameSensor::updateModel complete..." << std::endl;
255  }
256  /*
257  ossimGpt gpt;
258  lineSampleToWorld(theImageClipRect.ul(),gpt);//+ossimDpt(-w, -h), gpt);
259  theBoundGndPolygon[0] = gpt;
260  lineSampleToWorld(theImageClipRect.ur(),gpt);//+ossimDpt(w, -h), gpt);
261  theBoundGndPolygon[1] = gpt;
262  lineSampleToWorld(theImageClipRect.lr(),gpt);//+ossimDpt(w, h), gpt);
263  theBoundGndPolygon[2] = gpt;
264  lineSampleToWorld(theImageClipRect.ll(),gpt);//+ossimDpt(-w, h), gpt);
265  theBoundGndPolygon[3] = gpt;
266  */
267 }
double lond() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:97
double y
Definition: ossimDpt.h:165
double latd() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:87
void computeGsd()
This method computes the ground sample distance(gsd) and sets class attributes theGSD and theMeanGSD ...
double height() const
Definition: ossimGpt.h:107
double x
Definition: ossimDpt.h:164
ossimDpt metersPerDegree() const
Definition: ossimGpt.cpp:498
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ useForward()

virtual bool ossimPpjFrameSensor::useForward ( ) const
inlinevirtual

useForward() return true when it's better (more accurate / fast) to use forward (from ground to image) than inverse(from image to ground)

Implements ossimOptimizableProjection.

Definition at line 48 of file ossimPpjFrameSensor.h.

48 {return true;}

◆ worldToLineSample()

void ossimPpjFrameSensor::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 187 of file ossimPpjFrameSensor.cpp.

References ossimEcefVector::data(), ossimGpt::height(), ossimGpt::isHgtNan(), m_adjustedCameraPosition, m_adjustedFocalLength, m_averageProjectedHeight, m_ecef2Cam, m_principalPoint, ossimDpt::x, x, ossimDpt::y, and y.

189 {
190  ossimGpt wpt = world_point;
191  if(wpt.isHgtNan())
192  {
194  }
195  ossimEcefPoint gnd_ecf(wpt);
197  ossimEcefVector ecfRay(gnd_ecf - cam_ecf);
198  ossimColumnVector3d camRay(m_ecef2Cam*ecfRay.data());
199 
200  double x = m_principalPoint.x + m_adjustedFocalLength*camRay[0]/camRay[2];
201  double y = m_principalPoint.y + m_adjustedFocalLength*camRay[1]/camRay[2];
202 
203  ossimDpt p(x, y);
204 
205  image_point = p;
206 }
ossim_uint32 x
ossim_uint32 y
double y
Definition: ossimDpt.h:165
NEWMAT::Matrix m_ecef2Cam
bool isHgtNan() const
Definition: ossimGpt.h:143
double height() const
Definition: ossimGpt.h:107
double x
Definition: ossimDpt.h:164

Member Data Documentation

◆ m_adjustedCameraPosition

ossimGpt ossimPpjFrameSensor::m_adjustedCameraPosition
protected

Definition at line 70 of file ossimPpjFrameSensor.h.

Referenced by imagingRay(), and worldToLineSample().

◆ m_adjustedFocalLength

double ossimPpjFrameSensor::m_adjustedFocalLength
protected

Definition at line 71 of file ossimPpjFrameSensor.h.

Referenced by imagingRay(), and worldToLineSample().

◆ m_averageProjectedHeight

double ossimPpjFrameSensor::m_averageProjectedHeight
protected

◆ m_cameraPositionEllipsoid

ossimGpt ossimPpjFrameSensor::m_cameraPositionEllipsoid
protected

Definition at line 62 of file ossimPpjFrameSensor.h.

Referenced by setCameraPosition().

◆ m_ecef2Cam

NEWMAT::Matrix ossimPpjFrameSensor::m_ecef2Cam
protected

Definition at line 55 of file ossimPpjFrameSensor.h.

Referenced by saveState(), setecef2CamMatrix(), and worldToLineSample().

◆ m_ecef2CamInverse

NEWMAT::Matrix ossimPpjFrameSensor::m_ecef2CamInverse
protected

Definition at line 56 of file ossimPpjFrameSensor.h.

Referenced by imagingRay(), and setecef2CamMatrix().

◆ m_ecefCameraPosition

ossimEcefPoint ossimPpjFrameSensor::m_ecefCameraPosition
protected

Definition at line 61 of file ossimPpjFrameSensor.h.

Referenced by saveState(), and setCameraPosition().

◆ m_focalLength

double ossimPpjFrameSensor::m_focalLength
protected

Definition at line 60 of file ossimPpjFrameSensor.h.

Referenced by setFocalLength().

◆ m_focalLengthX

double ossimPpjFrameSensor::m_focalLengthX
protected

Definition at line 58 of file ossimPpjFrameSensor.h.

Referenced by saveState(), and setFocalLength().

◆ m_focalLengthY

double ossimPpjFrameSensor::m_focalLengthY
protected

Definition at line 59 of file ossimPpjFrameSensor.h.

Referenced by saveState(), and setFocalLength().

◆ m_principalPoint

ossimDpt ossimPpjFrameSensor::m_principalPoint
protected

Definition at line 57 of file ossimPpjFrameSensor.h.

Referenced by imagingRay(), saveState(), setPrincipalPoint(), and worldToLineSample().

◆ m_radialK1

double ossimPpjFrameSensor::m_radialK1
protected

Definition at line 65 of file ossimPpjFrameSensor.h.

◆ m_radialK2

double ossimPpjFrameSensor::m_radialK2
protected

Definition at line 66 of file ossimPpjFrameSensor.h.

◆ m_radialP1

double ossimPpjFrameSensor::m_radialP1
protected

Definition at line 67 of file ossimPpjFrameSensor.h.

◆ m_radialP2

double ossimPpjFrameSensor::m_radialP2
protected

Definition at line 68 of file ossimPpjFrameSensor.h.


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