41 static ossimTrace traceExec (
"ossimFormosatModel:exec");
42 static ossimTrace traceDebug (
"ossimFormosatModel:debug");
46 static const char* PARAM_NAMES[] = {
"roll_offset",
52 "focal_length_offset" };
54 static const char* PARAM_UNITS[] = {
"degrees",
73 theSupportData (NULL),
74 theMetaDataFile (
"NOT ASSIGNED"),
75 theIllumAzimuth (0.0),
76 theIllumElevation (0.0),
78 thePositionError (0.0),
79 theRefImagingTime (0.0),
80 theRefImagingTimeLine (0.0),
81 theLineSamplingPeriod (0.0),
90 theFocalLenOffset (0.0)
99 theMetaDataFile (
"NOT ASSIGNED"),
100 theIllumAzimuth (0.0),
101 theIllumElevation (0.0),
103 thePositionError (0.0),
104 theRefImagingTime (0.0),
105 theRefImagingTimeLine (0.0),
106 theLineSamplingPeriod (0.0),
110 thePitchOffset (0.0),
115 theFocalLenOffset (0.0)
169 <<
"DEBUG ossimFormosatModel::computeSatToOrbRotation(): entering..." 176 theSupportData->getAttitude(t, att);
181 double dt = theRefImagingTime - t;
182 att.
x += thePitchOffset + dt*thePitchRate;
183 att.
y += theRollOffset + dt*theRollRate;
184 att.
z += theYawOffset + dt*theYawRate;
189 double cp = cos(att.
x);
190 double sp = sin(att.
x);
191 double cr = cos(att.
y);
192 double sr = sin(att.
y);
193 double cy = cos(att.
z);
194 double sy = sin(att.
z);
199 result = NEWMAT::Matrix(3,3);
200 result << (cr*cy) << (-cr*sy) << (-sr)
201 << (cp*sy+sp*sr*cy) << (cp*cy-sp*sr*sy) << (sp*cr)
202 << (-sp*sy+cp*sr*cy) << (-sp*cy-cp*sr*sy) << cp*cr;
217 <<
"DEBUG ossimFormosatModel::computeSatToOrbRotation(): entering..." 225 theSupportData->getAttitude(t, att);
230 double dt = theRefImagingTime - t;
231 att.
x += thePitchOffset + dt*thePitchRate;
232 att.
y += theRollOffset + dt*theRollRate;
233 att.
z += theYawOffset + dt*theYawRate;
238 double cp = cos(att.
x);
239 double sp = sin(att.
x);
240 double cr = cos(att.
y);
241 double sr = sin(att.
y);
242 double cy = cos(att.
z);
243 double sy = sin(att.
z);
248 theSatToOrbRotation = NEWMAT::Matrix(3,3);
249 theSatToOrbRotation << (cr*cy) << (-cr*sy) << (-sr)
250 << (cp*sy+sp*sr*cy) << (cp*cy-sp*sr*sy) << (sp*cr)
251 << (-sp*sy+cp*sr*cy) << (-sp*cy-cp*sr*sy) << cp*cr;
272 if(getNumberOfAdjustableParameters() < 1)
280 theFocalLenOffset = 0;
284 theRollOffset = computeParameterOffset(0);
285 thePitchOffset = computeParameterOffset(1);
286 theYawOffset = computeParameterOffset(2);
287 theRollRate = computeParameterOffset(3);
288 thePitchRate = computeParameterOffset(4);
289 theYawRate = computeParameterOffset(5);
290 theFocalLenOffset = computeParameterOffset(6);
294 lineSampleToWorld(theImageClipRect.ul(), ulg);
295 lineSampleToWorld(theImageClipRect.ur(), urg);
296 lineSampleToWorld(theImageClipRect.lr(), lrg);
297 lineSampleToWorld(theImageClipRect.ll(), llg);
299 theImageClipRect.ur(),
300 theImageClipRect.lr(),
301 theImageClipRect.ll(),
323 resizeAdjustableParameterArray(7);
324 ossim_uint32 numParams = getNumberOfAdjustableParameters();
331 setAdjustableParameter(i, 0.0);
332 setParameterDescription(i, PARAM_NAMES[i]);
333 setParameterUnit(i,PARAM_UNITS[i]);
334 setParameterSigma(i, SIGMA[i]);
351 <<
" constructor! Aborting..." << std::endl;
359 << theSupportData->getErrorStatus() <<std::endl;
374 theSensorID = theSupportData->getSensorID();
375 theImageID = theSupportData->getImageID();
376 theMetaDataFile = theSupportData->getMetadataFile();
379 theSupportData->getRefGroundPoint(theRefGndPt);
381 theSupportData->getSunAzimuth(theIllumAzimuth);
382 theSupportData->getSunElevation(theIllumElevation);
383 theSupportData->getSatAzimuth(theSatAzimuth);
386 theSupportData->getImageSize(sz);
388 theSupportData->getRefLineTime(theRefImagingTime);
389 theSupportData->getRefLineTimeLine(theRefImagingTimeLine);
391 theSupportData->getLineSamplingPeriod(theLineSamplingPeriod);
392 theSupportData->getSubImageOffset(theSpotSubImageOffset);
398 theSupportData->getImageRect(theImageClipRect);
399 theSupportData->getRefImagePoint(theRefImgPt);
413 if (theSupportData->isStarTrackerUsed())
415 thePositionError = 50.0;
419 thePositionError = 200.0;
422 lineSampleToWorld(theImageClipRect.ul(), p1);
423 lineSampleToWorld(theImageClipRect.ur(), p2);
424 lineSampleToWorld(theImageClipRect.lr(), p3);
425 lineSampleToWorld(theImageClipRect.ll(), p4);
437 ossimDpt midpt = theImageClipRect.midPoint();
439 lineSampleToWorld(midpt, cgpt);
440 lineSampleToWorld(midpt +
ossimDpt(1,0), hgpt);
441 lineSampleToWorld(midpt +
ossimDpt(0,1), vgpt);
446 theMeanGSD = (theGSD.x+theGSD.y)/2.0;
459 std::ios_base::fmtflags f = out.flags();
461 out <<
"\nDump of ossimFormosatModel at address " << (hex) <<
this 463 <<
"\n------------------------------------------------" 464 <<
"\n theImageID = " << theImageID
465 <<
"\n theMetadataFile = " << theMetaDataFile
466 <<
"\n theIllumAzimuth = " << theIllumAzimuth
467 <<
"\n theIllumElevation = " << theIllumElevation
468 <<
"\n theSatAzimuth = " << theSatAzimuth
469 <<
"\n thePositionError = " << thePositionError
470 <<
"\n theImageSize = " << theImageSize
471 <<
"\n theRefGndPt = " << theRefGndPt
472 <<
"\n theRefImgPt = " << theRefImgPt
473 <<
"\n theRefImagingTime = " << theRefImagingTime
474 <<
"\n theRefImagingTimeLine = " << theRefImagingTimeLine
475 <<
"\n theLineSamplingPeriod = " << theLineSamplingPeriod
476 <<
"\n theRollOffset = " << theRollOffset
477 <<
"\n thePitchOffset = " << thePitchOffset
478 <<
"\n theYawOffset = " << theYawOffset
479 <<
"\n theRollRate = " << theRollRate
480 <<
"\n thePitchRate = " << thePitchRate
481 <<
"\n theYawRate = " << theYawRate
482 <<
"\n theFocalLenOffset = " << theFocalLenOffset
483 <<
"\n------------------------------------------------" 493 const char* prefix)
const 495 if(theSupportData.valid())
498 theSupportData->saveState(kwl, supportPrefix);
518 if(theSupportData->loadState(kwl, supportPrefix))
539 bool runtime_dbflag = 0;
540 NEWMAT::Matrix satToOrbit;
542 iPt.
samp += theSpotSubImageOffset.samp;
543 iPt.
line += theSpotSubImageOffset.line;
548 double t_line = theRefImagingTime +
549 theLineSamplingPeriod*(iPt.
line - theRefImagingTimeLine);
550 if (traceDebug() || runtime_dbflag)
561 theSupportData->getPositionEcf(t_line, P_ecf);
562 theSupportData->getVelocityEcf(t_line, tempEcefPoint);
566 if (traceDebug() || runtime_dbflag)
569 <<
"DEBUG:\n\tP_ecf = " << P_ecf
570 <<
"\n\t V_ecf = " << V_ecf << std::endl;
578 theSupportData->getPixelLookAngleX(iPt.
samp, Psi_x);
580 theSupportData->getPixelLookAngleY(iPt.
samp, Psi_y);
581 if (traceDebug() || runtime_dbflag)
584 <<
"DEBUG:\n\t Psi_x = " << Psi_x
585 <<
"\n\t Psi_y = " << Psi_y << endl;
589 if (traceDebug() || runtime_dbflag)
592 <<
"DEBUG \n\t u_sat = " << u_sat << endl;
599 computeSatToOrbRotation(satToOrbit, t_line);
602 if (traceDebug() || runtime_dbflag)
605 <<
"DEBUG:\n\t theSatToOrbRotation = " << satToOrbit
606 <<
"\n\t u_orb = " << u_orb << endl;
619 Z_orb = Z_orb.
unit();
623 V_ecf.z()).cross(Z_orb).
unit();
626 NEWMAT::Matrix orbToEcfRotation = NEWMAT::Matrix(3, 3);
627 orbToEcfRotation << X_orb[0] << Y_orb[0] << Z_orb[0]
628 << X_orb[1] << Y_orb[1] << Z_orb[1]
629 << X_orb[2] << Y_orb[2] << Z_orb[2];
633 if (traceDebug() || runtime_dbflag)
636 <<
"DEBUG:\n\t orbToEcfRotation = " << orbToEcfRotation
637 <<
"\n\t u_ecf = " << u_ecf << endl;
648 <<
"DEBUG FormosatModel::imagingRay(): returning..." << std::endl;
656 if (!insideImage(image_point))
658 if(theSeedFunction.valid())
660 theSeedFunction->lineSampleToWorld(image_point, worldPoint);
664 worldPoint = extrapolate(image_point, heightEllipsoid);
674 imagingRay(image_point, imaging_ray);
716 if(!FormosatTest.
exists())
718 FormosatTest = geomFile.
path();
720 if(FormosatTest.
exists() ==
false)
722 FormosatTest = geomFile.
path();
731 initFromMetadata(meta.
get());
732 if (getErrorStatus())
753 return loadState(kwl);
764 theMetaDataFile =
"NOT ASSIGNED";
765 theIllumAzimuth = 0.0;
766 theIllumElevation = 0.0;
768 thePositionError = 0.0;
769 theRefImagingTime = 0.0;
770 theLineSamplingPeriod = 0.0;
774 thePitchOffset = 0.0;
779 theFocalLenOffset = 0.0;
787 if (traceExec())
ossimNotify(
ossimNotifyLevel_DEBUG) <<
"DEBUG ossimplugins::ossimFormosatModel::initFromMetadata(dimap_file): returning with error..." << std::endl;
794 initAdjustableParameters();
ossimColumnVector3d cross(const ossimColumnVector3d &rhs) const
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
ossimEcefPoint intersectAboveEarthEllipsoid(const double &heightAboveEllipsoid, const ossimDatum *aDatum=ossimDatumFactory::instance() ->wgs84()) const
Represents serializable keyword/value map.
bool addFile(const char *file)
static const ossimErrorCode OSSIM_OK
ossimColumnVector3d unit() const
static const ossimErrorCode OSSIM_ERROR
unsigned int ossim_uint32
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
virtual std::ostream & print(std::ostream &out) const
virtual ossimErrorCode getErrorStatus() const
ossimFilename dirCat(const ossimFilename &file) const
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string's contents...
ossimFilename & setExtension(const ossimString &e)
Sets the extension of a file name.
ossimFilename path() const
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
RTTI_DEF1(ossimFormosatModel, "ossimFormosatModel", ossimSensorModel)
std::basic_ostream< char > ostream
Base class for char output streams.