OTB  9.1.1
Orfeo Toolbox
otbSpot5SensorModel.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2024 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #ifndef otbSpot5SensorModel_h
22 #define otbSpot5SensorModel_h
23 
24 #include "otbImageMetadata.h"
25 #include "otbSpot5Metadata.h"
26 #include "otbGeocentricTransform.h"
27 #include "otbBilinearProjection.h"
28 #include "otbPolygon.h"
29 
30 
31 #include "itkPoint.h"
32 #include <itkMatrix.h>
33 #include "itkVector.h"
34 #include <itkVersor.h>
35 
36 namespace otb
37 {
38 
40 {
41 
46 public:
47 
48 
49  using Point2DType = itk::Point<double, 2>;
50  using Point3DType = itk::Point<double, 3>;
51  using MatrixType = itk::Matrix<double, 3, 3>;
52  using Vector3DType = itk::Vector<double, 3>;
57 
58  Spot5SensorModel(const std::string & productType, const Spot5Param & Spot5Param);
59 
60  Spot5SensorModel(const ImageMetadata & imd);
61  virtual ~Spot5SensorModel() = default;
62 
63  Spot5SensorModel(const Spot5SensorModel&) = delete; // non construction-copyable
64  Spot5SensorModel& operator=(const Spot5SensorModel&) = delete; // non copyable
65 
66 
73  Point2DType WorldToLineSample(const Point3DType& inGeoPoint) const;
74 
83  double heightAboveEllipsoid) const;
84 
92 
99  Ephemeris ImagingRay(Point2DType imPt) const;
100 
108  Point3DType NearestIntersection(const Ephemeris& imRay, double offset) const;
109 
116  Point3DType IntersectRay(const Ephemeris& imRay) const;
117 
126  Point3DType GetBilinearInterpolation(const double& time,
127  const std::vector<Point3DType>& V,
128  const std::vector<double>& T) const;
129 
138  Point3DType GetLagrangeInterpolation(const double& time,
139  const std::vector<Point3DType>& V,
140  const std::vector<double>& T) const;
141 
148  Point3DType GetPositionEcf(double time) const;
149 
156  Point3DType GetVelocityEcf(double time) const;
157 
165  void GetPixelLookAngleXY(unsigned int line, double& psiX, double& psiY) const;
166 
173  Point3DType GetAttitude(double time) const;
174 
181  MatrixType ComputeSatToOrbRotation(double t) const;
182 
183 
191 
192 
193 protected:
194 
195 private:
196 
197  void InitBilinearTransform();
198 
207  itk::Point<double, 3> EcefToWorld(const itk::Point<double, 3> & ecefPoint) const;
208 
209 
216  itk::Point<double, 3> WorldToEcef(const itk::Point<double, 3> & worldPoint) const;
217 
224  ContinuousIndexType Point2DToIndex(const itk::Point<double, 2> point) const;
225 
232  ContinuousIndexType Point3DToIndex(const itk::Point<double, 3> point) const;
233 
234 
243  virtual bool insideImage(const itk::Point<double, 2> point, double epsilon) const
244  {
245  return (point[0] >= -epsilon) &&
246  (point[0] <= (m_Spot5Param.ImageSize[0]+epsilon-1)) &&
247  (point[1] >= -epsilon) &&
248  (point[1] <= (m_Spot5Param.ImageSize[1]+epsilon-1));
249  }
250 
251  std::string m_ProductType;
253 
254  // Speed of light
255  static constexpr double C = 299792458;
256 
257  // Bilinear transform
259 
260  // Image and ground polygon
263 
266 };
267 
268 }
269 
270 #endif
otbSpot5Metadata.h
otb::Spot5SensorModel::Vector3DType
itk::Vector< double, 3 > Vector3DType
Definition: otbSpot5SensorModel.h:52
otb::Spot5SensorModel::Point2DType
itk::Point< double, 2 > Point2DType
SPOT5 sensor class, based on OSSIM Spot5SensorModel with ITK/GDAL implementation.
Definition: otbSpot5SensorModel.h:49
otb::Spot5SensorModel::m_EcefToWorldTransform
otb::GeocentricTransform< otb::TransformDirection::INVERSE, double >::Pointer m_EcefToWorldTransform
Definition: otbSpot5SensorModel.h:264
otb::Spot5SensorModel::MatrixType
itk::Matrix< double, 3, 3 > MatrixType
Definition: otbSpot5SensorModel.h:51
otb::BilinearProjection::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbBilinearProjection.h:45
otb::Spot5SensorModel::GetVelocityEcf
Point3DType GetVelocityEcf(double time) const
Get the 3D velocity of the sensor at time (interpolation of velocity samples vector from metadata).
otb::Spot5SensorModel::Point2DToIndex
ContinuousIndexType Point2DToIndex(const itk::Point< double, 2 > point) const
Convert 2Dpoint to 2DContinuousIndex.
otbPolygon.h
otbBilinearProjection.h
otb::Spot5SensorModel::GetAttitude
Point3DType GetAttitude(double time) const
Get the Attitude of the sensor at time (interpolation of attitude samples vector from metadata).
otb::Spot5SensorModel::InitBilinearTransform
void InitBilinearTransform()
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::Spot5SensorModel::m_WorldToEcefTransform
otb::GeocentricTransform< otb::TransformDirection::FORWARD, double >::Pointer m_WorldToEcefTransform
Definition: otbSpot5SensorModel.h:265
otb::Spot5SensorModel::m_BilinearProj
BilinearProjection::Pointer m_BilinearProj
Definition: otbSpot5SensorModel.h:258
otb::Spot5SensorModel::m_ImageRect
PolygonType::Pointer m_ImageRect
Definition: otbSpot5SensorModel.h:261
otb::Spot5SensorModel::~Spot5SensorModel
virtual ~Spot5SensorModel()=default
otb::Spot5SensorModel::insideImage
virtual bool insideImage(const itk::Point< double, 2 > point, double epsilon) const
Check if point is inside image.
Definition: otbSpot5SensorModel.h:243
otb::Spot5SensorModel::GetPixelLookAngleXY
void GetPixelLookAngleXY(unsigned int line, double &psiX, double &psiY) const
Get look angles on X and Y axis of the sensor at line (interpolation of angles samples vector from me...
otb::GeocentricTransform::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbGeocentricTransform.h:45
otb::Ephemeris
This structure is used to handle Ephemeris information.
Definition: otbSpot5Metadata.h:40
otb::Spot5SensorModel::m_Spot5Param
Spot5Param m_Spot5Param
Definition: otbSpot5SensorModel.h:252
otb::Spot5SensorModel::GetBilinearInterpolation
Point3DType GetBilinearInterpolation(const double &time, const std::vector< Point3DType > &V, const std::vector< double > &T) const
Compute the bilinear interpolation from a 3D point vector with a double time vector.
otb::Spot5SensorModel::LineSampleToWorld
Point3DType LineSampleToWorld(Point2DType imPt) const
Transform image point (col, row) to world point (lat,lon,hgt).
otb::Spot5SensorModel::Spot5SensorModel
Spot5SensorModel(const std::string &productType, const Spot5Param &Spot5Param)
otb::Polygon::ContinuousIndexType
Superclass::ContinuousIndexType ContinuousIndexType
Definition: otbPolygon.h:63
otb::Spot5SensorModel::ContinuousIndexType
PolygonType::ContinuousIndexType ContinuousIndexType
Definition: otbSpot5SensorModel.h:54
otb::Spot5SensorModel::WorldToEcef
itk::Point< double, 3 > WorldToEcef(const itk::Point< double, 3 > &worldPoint) const
Coordinate transformation from geographic to ECEF.
otb::Spot5SensorModel::EcefToWorld
itk::Point< double, 3 > EcefToWorld(const itk::Point< double, 3 > &ecefPoint) const
Coordinate transformation from ECEF to geographic.
otbGeocentricTransform.h
otb::Spot5SensorModel::operator=
Spot5SensorModel & operator=(const Spot5SensorModel &)=delete
otb::Spot5SensorModel::WorldToLineSample
Point2DType WorldToLineSample(const Point3DType &inGeoPoint) const
Transform world point (lat,lon,hgt) to image point (col,row).
otb::Spot5SensorModel::m_GroundRect
PolygonType::Pointer m_GroundRect
Definition: otbSpot5SensorModel.h:262
otb::Polygon::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbPolygon.h:50
otb::Spot5SensorModel::C
static constexpr double C
Definition: otbSpot5SensorModel.h:255
otb::Spot5SensorModel::NearestIntersection
Point3DType NearestIntersection(const Ephemeris &imRay, double offset) const
Compute the nearest intersection (world point) between the ray and the ellipsoid.
otb::Spot5SensorModel::LineSampleHeightToWorld
Point3DType LineSampleHeightToWorld(Point2DType imPt, double heightAboveEllipsoid) const
Transform image point (col, row) with a height to world point (lat,lon,hgt).
otb::Spot5SensorModel
Definition: otbSpot5SensorModel.h:39
otb::Spot5SensorModel::UpdateImageMetadata
void UpdateImageMetadata(ImageMetadata &imd)
Update a ImageMetadata object with the stored Spot5Param and GCPs, possibly modified from the origina...
otb::Spot5SensorModel::ComputeSatToOrbRotation
MatrixType ComputeSatToOrbRotation(double t) const
Compute SatToOrb matrix with an input time.
otb::Spot5SensorModel::GetLagrangeInterpolation
Point3DType GetLagrangeInterpolation(const double &time, const std::vector< Point3DType > &V, const std::vector< double > &T) const
Compute the lagrange interpolation from a 3D point vector with a double time vector.
otb::Spot5SensorModel::GetPositionEcf
Point3DType GetPositionEcf(double time) const
Get the 3D position of the sensor at time (interpolation of position samples vector from metadata).
otb::Polygon
This class represent a 2D polygon.
Definition: otbPolygon.h:44
otb::Spot5SensorModel::m_ProductType
std::string m_ProductType
Definition: otbSpot5SensorModel.h:251
otb::ImageMetadata
Generic class containing image metadata used in OTB.
Definition: otbImageMetadata.h:272
otb::Spot5SensorModel::IntersectRay
Point3DType IntersectRay(const Ephemeris &imRay) const
Compute world point intersected by image ray.
otb::MetaData::TimePoint
Represents a point in Time.
Definition: otbDateTime.h:94
otb::Spot5Param
Spot5 sensors parameters.
Definition: otbSpot5Metadata.h:68
otb::Spot5SensorModel::Point3DToIndex
ContinuousIndexType Point3DToIndex(const itk::Point< double, 3 > point) const
Convert 3Dpoint to 2DContinuousIndex.
otb::Spot5SensorModel::ImagingRay
Ephemeris ImagingRay(Point2DType imPt) const
Compute a ray from sensor position and image point.
otbImageMetadata.h
otb::Spot5SensorModel::Point3DType
itk::Point< double, 3 > Point3DType
Definition: otbSpot5SensorModel.h:50
otb::MetaData::Duration
Represents a duration.
Definition: otbDateTime.h:162
otb::Spot5Param::ImageSize
Point2DType ImageSize
Definition: otbSpot5Metadata.h:84