OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimSpectraboticsRedEdgeModel.cpp
Go to the documentation of this file.
15 #include <ossim/base/ossimDms.h>
16 
17 
18 #include <sstream>
19 
20 
21 static ossimTrace traceDebug("ossimSpectraboticsRedEdgeModel:debug");
22 
23 RTTI_DEF1(ossimSpectraboticsRedEdgeModel, "ossimSpectraboticsRedEdgeModel", ossimSensorModel);
24 
25 #ifdef OSSIM_ID_ENABLED
26 static const char OSSIM_ID[] = "$Id: ossimSpectraboticsRedEdgeModel.cpp 23562 2015-10-02 13:12:40Z gpotts $";
27 #endif
28 
30 {
33  m_roll = 0.0;
34  m_pitch = 0.0;
35  m_heading = 0.0;
36  m_focalLength = 5.5;
37  m_pixelSize = ossimDpt(0.003, 0.003);
38  m_ecefPlatformPosition = ossimGpt(0.0,0.0, 1000.0);
39  m_adjEcefPlatformPosition = ossimGpt(0.0,0.0, 1000.0);
40  theGSD.x = 0.076;
41  theGSD.y = 0.076;
42  theMeanGSD = 0.076;
43  m_fov = 48.8; // degrees
46 
47  if (traceDebug())
48  {
50  << "ossimSpectraboticsRedEdgeModel::ossimSpectrabotics DEBUG:" << endl;
51 #ifdef OSSIM_ID_ENABLED
52  ossimNotify(ossimNotifyLevel_DEBUG)<< "OSSIM_ID: " << OSSIM_ID << endl;
53 #endif
54  }
55 }
57  const ossimGpt& platformPosition,
58  double roll,
59  double pitch,
60  double heading,
61  const ossimDpt& /* principalPoint */, // in millimeters
62  double focalLength, // in millimeters
63  const ossimDpt& pixelSize) // in millimeters
64 {
65  theImageClipRect = imageRect;
69  m_roll = roll;
70  m_pitch = pitch;
71  m_heading = heading;
72  m_focalLength = focalLength;
73  m_pixelSize = pixelSize;
74  m_ecefPlatformPosition = platformPosition;
75  m_adjEcefPlatformPosition = platformPosition;
78  updateModel();
79 
80  try
81  {
82  // Method throws ossimException.
83  // computeGsd();
84  }
85  catch (const ossimException& e)
86  {
88  << "ossimSpectrabotics Constructor caught Exception:\n"
89  << e.what() << std::endl;
90  }
91 
92  if (traceDebug())
93  {
95  << "ossimSpectraboticsRedEdgeModel::ossimSpectrabotics DEBUG:" << endl;
96 #ifdef OSSIM_ID_ENABLED
97  ossimNotify(ossimNotifyLevel_DEBUG)<< "OSSIM_ID: " << OSSIM_ID << endl;
98 #endif
99  }
100 }
101 
103  :ossimSensorModel(src)
104 {
106 
107  if(src.m_lensDistortion.valid())
108  {
110  }
111  else
112  {
114  }
115 }
116 
118 {
119  return new ossimSpectraboticsRedEdgeModel(*this);
120 }
121 
123  ossimEcefRay& image_ray) const
124 {
125  if(traceDebug())
126  {
127  ossimNotify(ossimNotifyLevel_DEBUG) << "ossimSpectraboticsRedEdgeModel::imagingRay: ..... entered" << std::endl;
128  }
129  ossimDpt film (image_point.x-m_calibratedCenter.x,
130  m_calibratedCenter.y - image_point.y); //- theRefImgPt);
131 // ossimDpt film (image_point-m_calibratedCenter); //- theRefImgPt);
132  if(m_lensDistortion.valid())
133  {
134  ossimDpt tempFilm(film.x/m_norm, film.y/m_norm);
135  ossimDpt filmOut;
136  m_lensDistortion->undistort(tempFilm, filmOut);
137  film.x = filmOut.x*m_norm;
138  film.y = filmOut.y*m_norm;
139  }
140  film.x *= m_pixelSize.x; // pixel size on the film
141  film.y *= m_pixelSize.y; // pixel size on the film
142  ossimColumnVector3d cam_ray_dir (film.x,
143  film.y,
144  -m_focalLength);
145  ossimEcefVector ecf_ray_dir (m_compositeMatrix*cam_ray_dir);
146  ecf_ray_dir = ecf_ray_dir*(1.0/ecf_ray_dir.magnitude());
147 
149  image_ray.setDirection(ecf_ray_dir);
150 }
151 
153  ossimGpt& gpt) const
154 {
155  if (traceDebug()) ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG ossimSpectraboticsRedEdgeModel::lineSampleToWorld:entering..." << std::endl;
156 
157  if(image_point.hasNans())
158  {
159  gpt.makeNan();
160  return;
161  }
162  //***
163  // Extrapolate if image point is outside image:
164  //***
165 // if (!insideImage(image_point))
166 // {
167 // gpt.makeNan();
168 // gpt = extrapolate(image_point);
169 // return;
170 // }
171 
172  //***
173  // Determine imaging ray and invoke elevation source object's services to
174  // intersect ray with terrain model:
175  //***
176  ossimEcefRay ray;
177  imagingRay(image_point, ray);
179 
180  if (traceDebug())
181  {
182  ossimNotify(ossimNotifyLevel_DEBUG) << "image_point = " << image_point << std::endl;
183  ossimNotify(ossimNotifyLevel_DEBUG) << "ray = " << ray << std::endl;
184  ossimNotify(ossimNotifyLevel_DEBUG) << "gpt = " << gpt << std::endl;
185  }
186 
187  if (traceDebug()) ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG ossimSensorModel::lineSampleToWorld: returning..." << std::endl;
188  return;
189 }
190 
192  const double& heightEllipsoid,
193  ossimGpt& worldPoint) const
194 {
195 // if (!insideImage(image_point))
196 // {
197 // worldPoint.makeNan();
198 // worldPoint = extrapolate(image_point, heightEllipsoid);
199 // }
200 // else
201  {
202  //***
203  // First establish imaging ray from image point:
204  //***
205  ossimEcefRay ray;
206  imagingRay(image_point, ray);
207  ossimEcefPoint Pecf (ray.intersectAboveEarthEllipsoid(heightEllipsoid));
208  worldPoint = ossimGpt(Pecf);
209  }
210 }
211 
213  ossimDpt& image_point) const
214 {
215  #if 0
218  {
219  if (!(theBoundGndPolygon.pointWithin(world_point)))
220  {
221 // image_point.makeNan();
222 // image_point = extrapolate(world_point);
223 // return;
224  }
225  }
226  #endif
227  ossimEcefPoint g_ecf(world_point);
228  ossimEcefVector ecfRayDir(g_ecf - m_adjEcefPlatformPosition);
229  ossimColumnVector3d camRayDir (m_compositeMatrixInverse*ecfRayDir.data());
230 
231 
232  double scale = -m_focalLength/camRayDir[2];
233  ossimDpt film (scale*camRayDir[0], scale*camRayDir[1]);
234  film.x /= m_pixelSize.x; // get into pixel coordinates
235  film.y /= m_pixelSize.y;
236 
237 
238  // now distort to find the true image coordinate location
239  if (m_lensDistortion.valid())
240  {
241  ossimDpt filmOut;
242  film.x /= m_norm; // normalize radial
243  film.y /= m_norm;
244  m_lensDistortion->distort(film, filmOut);
245  film = filmOut;//+m_lensDistortion->getCenter();
246  film.x *= m_norm;
247  film.y *= m_norm;
248  }
249 
250  // invert Y to get back to left handed image space
252 
253  image_point = f1;
254 }
255 
257 {
258  ossimGpt gpt;
259  ossimGpt wgs84Pt;
260  double metersPerDegree = wgs84Pt.metersPerDegree().x;
261  double degreePerMeter = 1.0/metersPerDegree;
262  double latShift = computeParameterOffset(1)*theMeanGSD*degreePerMeter;
263  double lonShift = computeParameterOffset(0)*theMeanGSD*degreePerMeter;
264 
266  double height = gpt.height();
267  gpt.height(height + computeParameterOffset(5));
268  gpt.latd(gpt.latd() + latShift);
269  gpt.lond(gpt.lond() + lonShift);
272 
276  ossimMatrix4x4 lsrMatrix(lsrSpace.lsrToEcefRotMatrix());
277  NEWMAT::Matrix orientation = heading*pitch*roll;//roll*pitch*heading;
278  m_compositeMatrix = (lsrMatrix.getData()*orientation);
280 
282  // ossim_float64 w = theImageClipRect.width()*2.0;
283  // ossim_float64 h = theImageClipRect.height()*2.0;
284  theExtrapolateImageFlag = false;
285  theExtrapolateGroundFlag = false;
286 
287 
288  lineSampleToWorld(theImageClipRect.ul(),gpt);//+ossimDpt(-w, -h), gpt);
289  theBoundGndPolygon[0] = gpt;
290  lineSampleToWorld(theImageClipRect.ur(),gpt);//+ossimDpt(w, -h), gpt);
291  theBoundGndPolygon[1] = gpt;
292  lineSampleToWorld(theImageClipRect.lr(),gpt);//+ossimDpt(w, h), gpt);
293  theBoundGndPolygon[2] = gpt;
294  lineSampleToWorld(theImageClipRect.ll(),gpt);//+ossimDpt(-w, h), gpt);
295  theBoundGndPolygon[3] = gpt;
296 }
297 
299 {
300 
302 
303  setAdjustableParameter(0, 0.0);
304  setParameterDescription(0, "x_offset");
305  setParameterUnit(0, "pixels");
306 
307  setAdjustableParameter(1, 0.0);
308  setParameterDescription(1, "y_offset");
309  setParameterUnit(1, "pixels");
310 
311  setAdjustableParameter(2, 0.0);
312  setParameterDescription(2, "roll");
313  setParameterUnit(2, "degrees");
314 
315  setAdjustableParameter(3, 0.0);
316  setParameterDescription(3, "pitch");
317  setParameterUnit(3, "degrees");
318 
319  setAdjustableParameter(4, 0.0);
320  setParameterDescription(4, "heading");
321  setParameterUnit(4, "degrees");
322 
323  setAdjustableParameter(5, 0.0);
324  setParameterDescription(5, "altitude");
325  setParameterUnit(5, "meters");
326 
327 
328  setParameterSigma(0, 50.0);
329  setParameterSigma(1, 50.0);
330  setParameterSigma(2, 1);
331  setParameterSigma(3, 1);
332  setParameterSigma(4, 10);
333  setParameterSigma(5, 50);
334 }
335 
337 {
338  m_principalPoint = principalPoint;
339 }
340 
342  double pitch,
343  double heading)
344 {
345  m_roll = roll;
346  m_pitch = pitch;
347  m_heading = heading;
348 
349  updateModel();
350 }
351 
353 {
354  m_pixelSize = pixelSize;
355 }
356 
358 {
359  theImageClipRect = rect;
360  theRefImgPt = rect.midPoint();
361 }
362 
364 {
365  m_focalLength = focalLength;
366 }
367 
369 {
370  theRefGndPt = gpt;
372  updateModel();
373 
374 }
375 
377  const char* prefix) const
378 {
379  ossimSensorModel::saveState(kwl, prefix);
380 
381  kwl.add(prefix, "type", "ossimSpectraboticsRedEdgeModel", true);
382 
383  kwl.add(prefix, "roll", m_roll, true);
384  kwl.add(prefix, "pitch", m_pitch, true);
385  kwl.add(prefix, "heading", m_heading, true);
386  kwl.add(prefix, "principal_point", ossimString::toString(m_principalPoint.x) + " " + ossimString::toString(m_principalPoint.y));
387  kwl.add(prefix, "pixel_size", ossimString::toString(m_pixelSize.x) + " " + ossimString::toString(m_pixelSize.y));
388  kwl.add(prefix, "focal_length", m_focalLength);
389  kwl.add(prefix, "field_of_view", m_fov);
390  kwl.add(prefix, "cx", m_calibratedCenter.x);
391  kwl.add(prefix, "cy", m_calibratedCenter.y);
392  kwl.add(prefix, "fx", m_focalX);
393  kwl.add(prefix, "fy", m_focalY);
394  kwl.add(prefix, "ecef_platform_position",
398 
399  if(m_lensDistortion.valid())
400  {
402  prefix);
403  }
404 
405  return true;
406 }
407 
409  const char* prefix)
410 {
411  if(traceDebug())
412  {
413  std::cout << "ossimSpectraboticsRedEdgeModel::loadState: ......... entered" << std::endl;
414  }
415  //ossimSensorModel::loadState(kwl,prefix);
416 
417  ossimSensorModel::loadState(kwl, prefix);
419  {
420 
422  }
423  m_ecefPlatformPosition = ossimGpt(0.0,0.0,1000.0);
424  m_adjEcefPlatformPosition = ossimGpt(0.0,0.0,1000.0);
425  m_roll = 0.0;
426  m_pitch = 0.0;
427  m_heading = 0.0;
428 
429 
430  // bool computeGsdFlag = false;
431  const char* roll = kwl.find(prefix, "Roll");
432  const char* pitch = kwl.find(prefix, "Pitch");
433  const char* heading = kwl.find(prefix, "Yaw");
434  const char* focalLength = kwl.find(prefix, "Focal Length");
435  const char* imageWidth = kwl.find(prefix, "Image Width");
436  const char* imageHeight = kwl.find(prefix, "Image Height");
437  const char* fov = kwl.find(prefix, "Field Of View");
438  const char* gpsPos = kwl.find(prefix, "GPS Position");
439  const char* gpsAlt = kwl.find(prefix, "GPS Altitude");
440  const char* imageCenter = kwl.find(prefix, "Image Center");
441  const char* fx = kwl.find(prefix, "fx");
442  const char* fy = kwl.find(prefix, "fy");
443  const char* cx = kwl.find(prefix, "cx");
444  const char* cy = kwl.find(prefix, "cy");
445  const char* k = kwl.find(prefix, "k");
446  const char* p = kwl.find(prefix, "p");
447 
448  bool result = true;
449 
450 #if 0
451  std::cout << "roll: " << roll << "\n";
452  std::cout << "pitch: " << pitch << "\n";
453  std::cout << "heading: " << heading << "\n";
454  std::cout << "focalLength: " << focalLength << "\n";
455  std::cout << "imageWidth: " << imageWidth << "\n";
456  std::cout << "imageHeight: " << imageHeight << "\n";
457  // std::cout << "fov: " << fov << "\n";
458  std::cout << "gpsPos: " << gpsPos << "\n";
459  std::cout << "gpsAlt: " << gpsAlt << "\n";
460  #endif
461  //
462  if(k&&p)
463  {
465  m_lensDistortion->loadState(kwl, prefix);
466  }
467 
468  if(roll&&
469  pitch&&
470  heading&&
471  focalLength&&
472  imageWidth&&
473  imageHeight&&
474  gpsPos&&
475  gpsAlt)
476  {
477  theSensorID = "MicaSense RedEdge";
478  m_roll = ossimString(roll).toDouble();
479  m_pitch = ossimString(pitch).toDouble();
480  m_heading = ossimString(heading).toDouble();
481  m_focalLength = ossimString(focalLength).toDouble();
482  m_fov = fov?ossimString(fov).toDouble():48.8;
483  theImageSize.x = ossimString(imageWidth).toDouble();
484  theImageSize.y = ossimString(imageHeight).toDouble();
485 
486 
489 
491  // now lets use the field of view and the focal length to
492  // calculate the pixel size on the ccd in millimeters
493  double d = tan((m_fov*0.5)*M_PI/180.0)*m_focalLength;
494  d*=2.0;
495  double tempRadiusPixel = theImageSize.length();
496  m_pixelSize.x = (d)/tempRadiusPixel;
498  if(imageCenter)
499  {
500  std::vector<ossimString> splitString;
501  ossimString tempString(imageCenter);
502  tempString.split(splitString, ossimString(" "));
503  if(splitString.size() == 2)
504  {
505  theRefImgPt = ossimDpt(splitString[0].toDouble(), splitString[1].toDouble());
506  }
507  }
508  else
509  {
510  if(traceDebug())
511  {
512  ossimNotify(ossimNotifyLevel_DEBUG) << "No Image Center found" << std::endl;
513  // result = false;
514  }
515  }
516 
517  // now extract the GPS position and shift it to the ellipsoidal height.
518  std::vector<ossimString> splitArray;
519 
520  ossimString(gpsPos).split(splitArray, ",");
521  splitArray[0] = splitArray[0].replaceAllThatMatch("deg", " ");
522  splitArray[1] = splitArray[1].replaceAllThatMatch("deg", " ");
523 
524  ossimDms dmsLat;
525  ossimDms dmsLon;
526  double h = ossimString(gpsAlt).toDouble();
527  dmsLat.setDegrees(splitArray[0]);
528  dmsLon.setDegrees(splitArray[1]);
529  double lat = dmsLat.getDegrees();
530  double lon = dmsLon.getDegrees();
531 
533  m_ecefPlatformPosition = ossimGpt(lat,lon,h);
534  // double height1 = ossimElevManager::instance()->getHeightAboveEllipsoid(ossimGpt(lat, lon));
535 
536 //std::cout << "PLATFORM HEIGHT: " << h << "\n"
537 // << "ELEVATION: " << height1 << "\n";
538  // std::cout << m_ecefPlatformPosition << std::endl;
539  // std::cout << "POINT: " << ossimGpt(lat,lon,h) << std::endl;
540  // std::cout << "MSL: " << height1 << "\n";
541 
543  theRefGndPt.height(0.0);
544 
545  m_norm = ossim::nan();
546 
547  // lens parameters
548  if(m_lensDistortion.valid()&&cx&&cy&&fx&&fy)
549  {
550  m_focalX = ossimString(fx).toDouble();
551  m_focalY = ossimString(fy).toDouble();
552 
553  // our lens distorion assume center point. So
554  // lets shift to center and then set calibrated relative to
555  // image center. We will then normalize.
556  //
557  ossimDpt focal(m_focalX,m_focalY);
558  m_norm = focal.length()*0.5; // convert from diameter to radial
559  m_calibratedCenter = ossimDpt(ossimString(cx).toDouble(), ossimString(cy).toDouble());
563 
564  // lets initialize the root to be about one pixel norm along the diagonal
565  // and the convergence will be approximately 100th of a pixel.
566  //
567  double temp = m_norm;
568  if(temp < FLT_EPSILON) temp = 1.0;
569  else temp = 1.0/temp;
571  m_lensDistortion->setDxDy(ossimDpt(temp,temp));
573  }
574  else
575  {
576  m_lensDistortion = 0;
578  m_norm = theImageSize.length()*0.5;
579  m_principalPoint = ossimDpt(0,0);
580  }
581  updateModel();
582  }
583  else // load from regular save state
584  {
585  const char* principal_point = kwl.find(prefix, "principal_point");
586  const char* pixel_size = kwl.find(prefix, "pixel_size");
587  const char* ecef_platform_position = kwl.find(prefix, "ecef_platform_position");
588  const char* latlonh_platform_position = kwl.find(prefix, "latlonh_platform_position");
589  // const char* compute_gsd_flag = kwl.find(prefix, "compute_gsd_flag");
590  roll = kwl.find(prefix, "roll");
591  pitch = kwl.find(prefix, "pitch");
592  heading = kwl.find(prefix, "heading");
593  fov = kwl.find(prefix, "field_of_view");
594  focalLength = kwl.find(prefix, "focal_length");
595 
596  if(roll)
597  {
598  m_roll = ossimString(roll).toDouble();
599  }
600  if(pitch)
601  {
602  m_pitch = ossimString(pitch).toDouble();
603  }
604  if(heading)
605  {
606  m_heading = ossimString(heading).toDouble();
607  }
608 
609  if(cx&&cy)
610  {
611  m_calibratedCenter = ossimDpt(ossimString(cx).toDouble(), ossimString(cy).toDouble());
612  }
613  if(principal_point)
614  {
615  std::vector<ossimString> splitString;
616  ossimString tempString(principal_point);
617  tempString.split(splitString, ossimString(" "));
618  if(splitString.size() == 2)
619  {
620  m_principalPoint.x = splitString[0].toDouble();
621  m_principalPoint.y = splitString[1].toDouble();
622  }
623  }
624  else
625  {
626  if(traceDebug())
627  {
628  ossimNotify(ossimNotifyLevel_DEBUG) << "No principal_point found" << std::endl;
629  // result = false;
630  }
631  }
632 
633  if(pixel_size)
634  {
635  std::vector<ossimString> splitString;
636  ossimString tempString(pixel_size);
637  tempString.split(splitString, ossimString(" "));
638  if(splitString.size() == 1)
639  {
640  m_pixelSize.x = splitString[0].toDouble();
642  }
643  else if(splitString.size() == 2)
644  {
645  m_pixelSize.x = splitString[0].toDouble();
646  m_pixelSize.y = splitString[1].toDouble();
647  }
648  }
649  else
650  {
651  if(traceDebug())
652  {
653  ossimNotify(ossimNotifyLevel_DEBUG) << "No pixel size found" << std::endl;
654  // result = false;
655  }
656  }
657  if(ecef_platform_position)
658  {
659  std::vector<ossimString> splitString;
660  ossimString tempString(ecef_platform_position);
661  tempString.split(splitString, ossimString(" "));
662  if(splitString.size() > 2)
663  {
664  m_ecefPlatformPosition = ossimEcefPoint(splitString[0].toDouble(),
665  splitString[1].toDouble(),
666  splitString[2].toDouble());
667  }
668  }
669  else if(latlonh_platform_position)
670  {
671  std::vector<ossimString> splitString;
672  ossimString tempString(latlonh_platform_position);
673  tempString.split(splitString, ossimString(" "));
674  std::string datumString;
675  double lat=0.0, lon=0.0, h=0.0;
676  if(splitString.size() > 2)
677  {
678  lat = splitString[0].toDouble();
679  lon = splitString[1].toDouble();
680  h = splitString[2].toDouble();
681  }
682 
683  m_ecefPlatformPosition = ossimGpt(lat,lon,h);
684  }
685  if(focalLength)
686  {
687  m_focalLength = ossimString(focalLength).toDouble();
688  }
689  else
690  {
691  if(traceDebug())
692  {
693  ossimNotify(ossimNotifyLevel_DEBUG) << "No focal length found" << std::endl;
694  result = false;
695  }
696  }
697  if(fov)
698  {
699  m_fov = ossimString(fov).toDouble();
700  }
701  else
702  {
703  if(traceDebug())
704  {
705  ossimNotify(ossimNotifyLevel_DEBUG) << "No field of view found" << std::endl;
706  result = false;
707  }
708  }
710  if(m_lensDistortion.valid()&&cx&&cy&&fx&&fy)
711  {
712  m_focalX = ossimString(fx).toDouble();
713  m_focalY = ossimString(fy).toDouble();
714 
715  // our lens distorion assume center point. So
716  // lets shift to center and then set calibrated relative to
717  // image center. We will then normalize.
718  //
719  ossimDpt focal(m_focalX,m_focalY);
720  m_norm = focal.length()*0.5;
721  m_calibratedCenter = ossimDpt(ossimString(cx).toDouble(), ossimString(cy).toDouble());
722  // m_principalPoint = m_calibratedCenter-theImageClipRect.midPoint();
723  // m_principalPoint.x /= m_norm;
724  // m_principalPoint.y /= m_norm;
725 
726  // lets initialize the root to be about one pixel norm along the diagonal
727  // and the convergence will be approximately 100th of a pixel.
728  //
729  double temp = m_norm;
730  if(temp < FLT_EPSILON) temp = 1.0;
731  else temp = 1.0/temp;
733  m_lensDistortion->setDxDy(ossimDpt(temp,temp));
735  }
736  else
737  {
738  m_lensDistortion = 0;
739  }
740  updateModel();
741  }
742  try
743  {
744  //---
745  // This will set theGSD and theMeanGSD. Method throws
746  // ossimException.
747  //---
748  computeGsd();
749  }
750  catch (const ossimException& e)
751  {
753  << "ossimSpectraboticsRedEdgeModel::loadState Caught Exception:\n"
754  << e.what() << std::endl;
755  }
756  // std::cout << "METERS PER PIXEL : " << getMetersPerPixel() << std::endl;
757  if(traceDebug())
758  {
759  ossimNotify(ossimNotifyLevel_DEBUG) << std::setprecision(15) << std::endl;
760  ossimNotify(ossimNotifyLevel_DEBUG) << "roll: " << m_roll << std::endl
761  << "pitch: " << m_pitch << std::endl
762  << "heading: " << m_heading << std::endl
763  << "platform: " << m_ecefPlatformPosition << std::endl
764  << "latlon Platform: " << ossimGpt(m_ecefPlatformPosition) << std::endl
765  << "focal len: " << m_focalLength << std::endl
766  << "FOV : " << m_fov << std::endl
767  << "principal: " << m_principalPoint << std::endl
768  << "Ground: " << ossimGpt(m_ecefPlatformPosition) << std::endl;
769  }
770 
771  // ossimGpt wpt;
772  // ossimDpt dpt(100,100);
773  // lineSampleToWorld(dpt, wpt);
774  // std::cout << "dpt: " << dpt << "\n"
775  // << "wpt: " << wpt << "\n";
776  // worldToLineSample(wpt,dpt);
777  // std::cout << "dpt: " << dpt << "\n"
778  // << "wpt: " << wpt << "\n";
779  return result;
780 }
781 
783 {
784  ossimKeywordlist kwl;
785  kwl.addFile(init_file.c_str());
786 
787  return loadState(kwl);
788 }
ossimString theSensorID
void setParameterDescription(ossim_uint32 idx, const ossimString &descrption)
void setConvergenceThreshold(const double &new_threshold)
virtual void worldToLineSample(const ossimGpt &world_point, ossimDpt &image_point) const
static NEWMAT::Matrix createRotationYMatrix(double angle, ossimCoordSysOrientMode orientationMode=OSSIM_RIGHT_HANDED)
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
double lond() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:97
ossimEcefPoint intersectAboveEarthEllipsoid(const double &heightAboveEllipsoid, const ossimDatum *aDatum=ossimDatumFactory::instance() ->wgs84()) const
Represents serializable keyword/value map.
bool addFile(const char *file)
bool intersectRay(const ossimEcefRay &ray, ossimGpt &gpt, double defaultElevValue=0.0)
METHOD: intersectRay()
bool valid() const
Definition: ossimRefPtr.h:75
const char * find(const char *key) const
double nan()
Method to return ieee floating point double precision NAN.
Definition: ossimCommon.h:135
virtual void undistort(const ossimDpt &input, ossimDpt &output) const
const ossimDpt & ul() const
Definition: ossimDrect.h:339
double y
Definition: ossimDpt.h:165
void lineSampleToWorld(const ossimDpt &image_point, ossimGpt &gpt) const
void setDxDy(const ossimDpt &dxdy)
void makeNan()
Definition: ossimGpt.h:130
static ossimString toString(bool aValue)
Numeric to string methods.
double x() const
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.
double magnitude() const
static ossimElevManager * instance()
METHOD: instance() Implements singelton pattern.
void setOrigin(const ossimEcefPoint &orig)
Definition: ossimEcefRay.h:81
double latd() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:87
ossimRefPtr< ossimTangentialRadialLensDistortion > m_lensDistortion
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
double length() const
Definition: ossimDpt.h:81
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
const NEWMAT::Matrix & lsrToEcefRotMatrix() const
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
void computeGsd()
This method computes the ground sample distance(gsd) and sets class attributes theGSD and theMeanGSD ...
#define M_PI
virtual const char * what() const
Returns the error message.
virtual bool setupOptimizer(const ossimString &init_file)
ground to image faster (you don&#39;t need DEM)
static NEWMAT::Matrix createRotationXMatrix(double angle, ossimCoordSysOrientMode orientationMode=OSSIM_RIGHT_HANDED)
#define FLT_EPSILON
static NEWMAT::Matrix createRotationZMatrix(double angle, ossimCoordSysOrientMode orientationMode=OSSIM_RIGHT_HANDED)
ossimPolygon theBoundGndPolygon
static ossimGeoidManager * instance()
Implements singelton pattern:
double height() const
Definition: ossimGpt.h:107
bool setDegrees(const std::string &value)
setDegrees(char*).
Definition: ossimDms.cpp:79
double toDouble() const
bool hasNans() const
will sequence through the polygon and check to see if any values are NAN
void setParameterUnit(ossim_uint32 idx, ossimUnitType unit)
double getDegrees() const
Definition: ossimDms.h:71
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
bool pointWithin(const ossimDpt &point) const
METHOD: pointWithin(ossimDpt) Returns TRUE if point is inside polygon.
bool hasNans() const
Definition: ossimDpt.h:67
ossim_uint32 getNumberOfVertices() const
ossimDrect theImageClipRect
void setRollPitchHeading(double roll, double pitch, double heading)
static NEWMAT::Matrix createIdentity()
void setCenter(const ossimDpt &center)
double y() const
ossimDpt midPoint() const
Definition: ossimDrect.h:817
virtual void setAdjustableParameter(ossim_uint32 idx, double value, bool notify=false)
ossim_int32 y
Definition: ossimIpt.h:142
const ossimDpt & ur() const
Definition: ossimDrect.h:340
double x
Definition: ossimDpt.h:164
void resizeAdjustableParameterArray(ossim_uint32 numberOfParameters)
virtual void lineSampleHeightToWorld(const ossimDpt &image_point, const double &heightEllipsoid, ossimGpt &worldPoint) const
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
const ossimColumnVector3d & data() const
ossimDpt metersPerDegree() const
Definition: ossimGpt.cpp:498
double length() const
Definition: ossimIpt.h:114
ossim_int32 x
Definition: ossimIpt.h:141
const ossimDpt & ll() const
Definition: ossimDrect.h:342
void resize(ossim_uint32 newSize)
virtual void imagingRay(const ossimDpt &image_point, ossimEcefRay &image_ray) const
void setDirection(const ossimEcefVector &d)
Definition: ossimEcefRay.h:82
virtual double offsetFromEllipsoid(const ossimGpt &gpt)
const ossimDpt & lr() const
Definition: ossimDrect.h:341
void setPixelSize(const ossimDpt &pixelSize)
virtual void distort(const ossimDpt &input, ossimDpt &output) const
RTTI_DEF1(ossimSpectraboticsRedEdgeModel, "ossimSpectraboticsRedEdgeModel", ossimSensorModel)
double z() const
void setPrincipalPoint(ossimDpt principalPoint)
void setParameterSigma(ossim_uint32 idx, double value, bool notify=false)
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
ossim_float64 theMeanGSD
NEWMAT::Matrix m_compositeMatrix
uses file path to init model