cars.core.geometry.otb_geometry

this module contains the otb geometry class

Module Contents

Classes

OTBGeometry

OTB geometry class

class cars.core.geometry.otb_geometry.OTBGeometry

Bases: cars.core.geometry.AbstractGeometry

OTB geometry class

property conf_schema

Returns the input configuration fields required by the geometry loader as a json checker schema. The available fields are defined in the cars/conf/input_parameters.py file

Returns

the geo configuration schema

static check_products_consistency(cars_conf) bool

Test if the product is readable by the OTB

Param

cars_conf: cars input configuration dictionary

Returns

True if the products are readable, False otherwise

static check_geom_consistency(img: str) bool

Check if the image have RPC information readable by the OTB

Parameters

img – path to the image

Returns

True if the RPC are readable, False otherwise

static triangulate(cars_conf, mode: str, matches: Union[xarray.Dataset, numpy.ndarray], grid1: str, grid2: str, roi_key: Union[None, str] = None) numpy.ndarray

Performs triangulation from cars disparity or matches dataset

Parameters
  • cars_conf – cars input configuration dictionary

  • mode – triangulation mode (cst.DISP_MODE or cst.MATCHES)

  • matches – cars disparity dataset or matches as numpy array

  • grid1 – path to epipolar grid of image 1

  • grid2 – path to epipolar grid of image 2

  • roi_key – dataset roi to use (can be cst.ROI or cst.ROI_WITH_MARGINS)

Returns

the long/lat/height numpy array in output of the triangulation

static generate_epipolar_grids(cars_conf, dem: Union[None, str] = None, geoid: Union[None, str] = None, default_alt: Union[None, float] = None, epipolar_step: int = 30) Tuple[numpy.ndarray, numpy.ndarray, List[float], List[float], List[int], float]

Computes the left and right epipolar grids

Parameters
  • cars_conf – cars input configuration dictionary

  • dem – path to the dem folder

  • geoid – path to the geoid file

  • default_alt – default altitude to use in the missing dem regions

  • epipolar_step – step to use to construct the epipolar grids

Returns

Tuple composed of :

  • the left epipolar grid as a numpy array

  • the right epipolar grid as a numpy array

  • the left grid origin as a list of float

  • the left grid spacing as a list of float

  • the epipolar image size as a list of int (x-axis size is given with the index 0, y-axis size with index 1)

  • the disparity to altitude ratio as a float

static direct_loc(cars_conf, product_key: str, x_coord: float, y_coord: float, z_coord: float = None, dem: str = None, geoid: str = None, default_elevation: float = None) numpy.ndarray

For a given image point, compute the latitude, longitude, altitude

Be careful: When SRTM is used, the default elevation (altitude) doesn’t work anymore (OTB function) when ConvertSensorToGeoPointFast is called again. Check the values.

Advice: to be sure, use x,y,z inputs only

Parameters
  • cars_conf – cars input configuration dictionary

  • product_key – input_parameters.PRODUCT1_KEY or input_parameters.PRODUCT2_KEY to identify which geometric model shall be taken to perform the method

  • x_coord – X Coordinate in input image sensor

  • y_coord – Y Coordinate in input image sensor

  • z_coord – Z Altitude coordinate to take the image

  • dem – if z not defined, take this DEM directory input

  • geoid – if z and dem not defined, take GEOID directory input

  • default_elevation – if z, dem, geoid not defined, take default elevation

Returns

Latitude, Longitude, Altitude coordinates as a numpy array

image_envelope(conf, product_key: str, shp, dem=None, default_alt=None, geoid=None)

Export the image footprint to a shapefile

Parameters
  • conf – cars input configuration dictionary

  • product_key – input_parameters.PRODUCT1_KEY or input_parameters.PRODUCT2_KEY to identify which geometric model shall be taken to perform the method

  • shp – Path to the output shapefile

  • dem – Directory containing DEM tiles

  • default_alt – Default altitude above ellipsoid

  • geoid – path to geoid file