cars.core.geometry.shareloc_geometry

Shareloc geometry sub class : CARS geometry wrappers functions to shareloc ones

Module Contents

Classes

SharelocGeometry

shareloc geometry class

Attributes

GRID_TYPE

RPC_TYPE

cars.core.geometry.shareloc_geometry.GRID_TYPE = 'GRID'
cars.core.geometry.shareloc_geometry.RPC_TYPE = 'RPC'
class cars.core.geometry.shareloc_geometry.SharelocGeometry

Bases: cars.core.geometry.AbstractGeometry

shareloc geometry class

property conf_schema: Dict[str, str]

Defines shareloc loader user configuration specificities

TODO: not needed To remove, with abstract geometry class evolution and with CARS former configuration update (with OTB evolution)

static load_geom_model(model: str, model_type: str) Union[shareloc.geomodels.grid.Grid, shareloc.geomodels.rpc.RPC]

Load geometric model and returns it as a shareloc object

TODO: evolve with CARS new API with CARS conf clean

Parameters
  • model – Path to the model file

  • model_type – model type (RPC or Grid)

Returns

geometric model as a shareloc object (Grid or RPC)

static load_image(img: str) shareloc.image.Image

Load the image using the Image class of Shareloc

Parameters

img – path to the image

Returns

The Image object

static check_products_consistency(cars_conf) bool

Test if the product is readable by the shareloc loader

TODO: not used - to evolve and use in CARS configuration early in pipeline process (new early check input common application ?) - update with former cars clean with otb evolution.

Parameters

cars_conf – cars input configuration dictionary

Returns

True if the products 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

TODO: evolve with CARS new API with CARS conf clean

Parameters
  • cars_conf – cars input configuration dictionary

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

  • matches – cars disparity dataset or matches as numpy array

  • grid1 – path to epipolar grid of img1

  • 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

TODO: evolve with CARS new API with CARS conf clean

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

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

TODO: evolve with CARS new API with CARS conf clean

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