OTB
9.0.0
Orfeo Toolbox
|
#include <otbGDALRPCTransformer.h>
Public Types | |
using | PointType = itk::Point< double, 3 > |
Public Member Functions | |
bool | ForwardTransform (double *x, double *y, double *z, int nPointCount) |
PointType | ForwardTransform (PointType p) |
GDALRPCTransformer (const Projection::RPCParam &, bool useDEM) | |
GDALRPCTransformer (double LineOffset, double SampleOffset, double LatOffset, double LonOffset, double HeightOffset, double LineScale, double SampleScale, double LatScale, double LonScale, double HeightScale, const double(&LineNum)[20], const double(&LineDen)[20], const double(&SampleNum)[20], const double(&SampleDen)[20], bool useDEM) | |
bool | InverseTransform (double *x, double *y, double *z, int nPointCount) |
PointType | InverseTransform (PointType p) |
void | SetOption (const std::string &Name, const std::string &Value) |
void | SetPixErrThreshold (double PixErrThreshold) |
~GDALRPCTransformer () | |
Protected Member Functions | |
void | Update () final |
Protected Member Functions inherited from otb::DEMObserverInterface | |
DEMObserverInterface ()=default | |
DEMObserverInterface (DEMObserverInterface const &)=delete | |
DEMObserverInterface & | operator= (DEMObserverInterface const &)=delete |
~DEMObserverInterface ()=default | |
Private Attributes | |
GDALRPCInfo | m_GDALRPCInfo |
bool | m_Modified = true |
std::mutex | m_Mutex |
char ** | m_Options = nullptr |
double | m_PixErrThreshold = 0.1 |
void * | m_TransformArg = nullptr |
bool | m_UseDEM = true |
This class is a wrapper around GDALCreateRPCTransformer and GDALRPCTransform.
This class aims at manipulating RPC transformations within OTB, in a safe and easy way.
To use this wrapper, one needs to call the constructor with the correct parameters. Then, one can set the options, and the threshold. Finally, one can call ForwardTransform or BackwardTransform, depending in the desired result.
The parameters provided to the constructor are those found in the RPCParam structure defined in the otbGeometryMetadata.h file. They are quite similar to what can be found in GDALRPCInfo.
Definition at line 52 of file otbGDALRPCTransformer.h.
using otb::GDALRPCTransformer::PointType = itk::Point<double, 3> |
Definition at line 56 of file otbGDALRPCTransformer.h.
otb::GDALRPCTransformer::GDALRPCTransformer | ( | double | LineOffset, |
double | SampleOffset, | ||
double | LatOffset, | ||
double | LonOffset, | ||
double | HeightOffset, | ||
double | LineScale, | ||
double | SampleScale, | ||
double | LatScale, | ||
double | LonScale, | ||
double | HeightScale, | ||
const double(&) | LineNum[20], | ||
const double(&) | LineDen[20], | ||
const double(&) | SampleNum[20], | ||
const double(&) | SampleDen[20], | ||
bool | useDEM | ||
) |
Build a GDALRPCTransformer
The parameters describe the RPC model. They can be found in the RPCParam structure defined in the otbGeometryMetadata.h file. They are quite similar to what can be found in GDALRPCInfo. See also http://geotiff.maptools.org/rpc_prop.html
otb::GDALRPCTransformer::GDALRPCTransformer | ( | const Projection::RPCParam & | , |
bool | useDEM | ||
) |
otb::GDALRPCTransformer::~GDALRPCTransformer | ( | ) |
bool otb::GDALRPCTransformer::ForwardTransform | ( | double * | x, |
double * | y, | ||
double * | z, | ||
int | nPointCount | ||
) |
Compute a forward transformation
This method performs a transformation from column/row to long/lat/height space. It can work with an arbitrary number of points.
[in,out] | x | array of the X coordinate of the points to convert |
[in,out] | y | array of the Y coordinate of the points to convert |
[in,out] | z | array of the Z coordinate of the points to convert |
[in] | nPointCount | the number of points to convert |
x, y, z != nullptr
Compute an forward transformation
This method performs a transformation from column/row to long/lat/height space. It works with only one point.
[in] | p | coordinates of the point to convert |
bool otb::GDALRPCTransformer::InverseTransform | ( | double * | x, |
double * | y, | ||
double * | z, | ||
int | nPointCount | ||
) |
Compute an inverse transformation
This method performs a transformation from long/lat/height to column/row space. It can work with an arbitrary number of points.
[in,out] | x | array of the X coordinate of the points to convert |
[in,out] | y | array of the Y coordinate of the points to convert |
[in,out] | z | array of the Z coordinate of the points to convert |
[in] | nPointCount | the number of points to convert |
x, y, z != nullptr
Compute an inverse transformation
This method performs a transformation from long/lat/height to column/row space. It works with only one point.
[in] | p | coordinates of the point to convert |
void otb::GDALRPCTransformer::SetOption | ( | const std::string & | Name, |
const std::string & | Value | ||
) |
Set additional options to the transformer
RPC_HEIGHT: a fixed height offset to be applied to all points passed in. In this situation the Z passed into the transformation function is assumed to be height above ground, and the RPC_HEIGHT is assumed to be an average height above sea level for ground in the target scene.
RPC_HEIGHT_SCALE: a factor used to multiply heights above ground. Useful when elevation offsets of the DEM are not expressed in meters.
RPC_DEM: the name of a GDAL dataset (a DEM file typically) used to extract elevation offsets from. In this situation the Z passed into the transformation function is assumed to be height above ground. This option should be used in replacement of RPC_HEIGHT to provide a way of defining a non uniform ground for the target scene
RPC_DEMINTERPOLATION: the DEM interpolation ("near", "bilinear" or "cubic"). Default is "bilinear".
RPC_DEM_MISSING_VALUE: value of DEM height that must be used in case the DEM has nodata value at the sampling point, or if its extent does not cover the requested coordinate. When not specified, missing values will cause a failed transform.
RPC_DEM_SRS: (GDAL >= 3.2) WKT SRS, or any string recognized by OGRSpatialReference::SetFromUserInput(), to be used as an override for DEM SRS. Useful if DEM SRS does not have an explicit vertical component.
RPC_DEM_APPLY_VDATUM_SHIFT: whether the vertical component of a compound SRS for the DEM should be used (when it is present). This is useful so as to be able to transform the "raw" values from the DEM expressed with respect to a geoid to the heights with respect to the WGS84 ellipsoid. When this is enabled, the GTIFF_REPORT_COMPD_CS configuration option will be also set temporarily so as to get the vertical information from GeoTIFF files. Defaults to TRUE. (GDAL >= 2.1.0)
RPC_PIXEL_ERROR_THRESHOLD: overrides the dfPixErrThreshold parameter, ie the error (measured in pixels) allowed in the iterative solution of pixel/line to lat/long computations (the other way is always exact given the equations). (GDAL >= 2.1.0)
RPC_MAX_ITERATIONS: maximum number of iterations allowed in the iterative solution of pixel/line to lat/long computations. Default value is 10 in the absence of a DEM, or 20 if there is a DEM. (GDAL >= 2.1.0)
[in] | Name | a string containing the name of the option |
[in] | Value | a string containing the value of the option |
void otb::GDALRPCTransformer::SetPixErrThreshold | ( | double | PixErrThreshold | ) |
Set the error (measured in pixels) allowed in the iterative solution of pixel/line to lat/long computations (the other way is always exact given the equations). Starting with GDAL 2.1, this may also be set through the RPC_PIXEL_ERROR_THRESHOLD transformer option. If a negative or null value is provided, then this defaults to 0.1 pixel.
[in] | PixErrThreshold | the new value of the error |
|
finalprotectedvirtual |
Regenerate the transformer
Called when performing a transformation and some options were modified.
Implements otb::DEMObserverInterface.
|
private |
The RPC model
Definition at line 216 of file otbGDALRPCTransformer.h.
|
private |
Used to know if Update is required after a change in the options
Definition at line 213 of file otbGDALRPCTransformer.h.
|
private |
Lock threads when instantiating the GDAL RPC transformer
Definition at line 228 of file otbGDALRPCTransformer.h.
|
private |
The options
Definition at line 219 of file otbGDALRPCTransformer.h.
|
private |
The error allowed in the iterative solution
Definition at line 222 of file otbGDALRPCTransformer.h.
|
private |
The transformer arguments
Definition at line 225 of file otbGDALRPCTransformer.h.
|
private |
Use the DEM singleton in DEM computations
Definition at line 231 of file otbGDALRPCTransformer.h.