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

GEO_MODEL_PATH_TAG

GEO_MODEL_TYPE_TAG

cars.core.geometry.shareloc_geometry.GRID_TYPE = 'GRID'
cars.core.geometry.shareloc_geometry.RPC_TYPE = 'RPC'
cars.core.geometry.shareloc_geometry.GEO_MODEL_PATH_TAG = 'path'
cars.core.geometry.shareloc_geometry.GEO_MODEL_TYPE_TAG = 'model_type'
class cars.core.geometry.shareloc_geometry.SharelocGeometry(geometry_plugin, dem=None, geoid=None, default_alt=None, pairs_for_roi=None)

Bases: cars.core.geometry.abstract_geometry.AbstractGeometry

Shareloc geometry class

get_roi(pairs_for_roi, epsg, margin=0.006)

Compute region of interest for intersection of DEM

Parameters
  • pairs_for_roi (List[(str, dict, str, dict)]) – list of pairs of images and geomodels

  • dem_epsg (int) – output EPSG code for ROI

  • margin (float) – margin for ROI in degrees

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

Load geometric model and returns it as a shareloc object

Parameters

model (dict with keys "path" and "model_type") – Path and attributes for geometrical model

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_product_consistency(sensor: str, geomodel: dict) bool

Test if the product is readable by the shareloc plugin

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
  • sensor – path to sensor image

  • geomodel – path and attributes for geometrical model

Returns

sensor path and overloaded geomodel dict

static triangulate(sensor1, sensor2, geomodel1, geomodel2, 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 :param sensor1: path to left sensor image :param sensor2: path to right sensor image :param geomodel1: path and attributes for left geomodel :param geomodel2: path and attributes for right geomodel :param mode: triangulation mode (constants.DISP_MODE or constants.MATCHES) :param matches: cars disparity dataset or matches as numpy array :param grid1: path or dataset for epipolar grid of sensor1 :param grid2: path or dataset for epipolar grid of sensor2 :param 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

generate_epipolar_grids(sensor1, sensor2, geomodel1, geomodel2, epipolar_step: int = 30) Tuple[numpy.ndarray, numpy.ndarray, List[float], List[float], List[int], float]

Computes the left and right epipolar grids

Parameters
  • sensor1 – path to left sensor image

  • sensor2 – path to right sensor image

  • geomodel1 – path and attributes for left geomodel

  • geomodel2 – path and attributes for right geomodel

  • 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

direct_loc(sensor, geomodel, x_coord: numpy.array, y_coord: numpy.array, z_coord: numpy.array = None) numpy.ndarray

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

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

Parameters
  • sensor – path to sensor image

  • geomodel – path and attributes for geomodel

  • 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

Returns

Latitude, Longitude, Altitude coordinates as a numpy array

inverse_loc(sensor, geomodel, lat_coord: numpy.array, lon_coord: numpy.array, z_coord: numpy.array = None) numpy.ndarray

For a given image points list, compute the latitudes, longitudes, altitudes

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

Parameters
  • sensor – path to sensor image

  • geomodel – path and attributes for geomodel

  • lat_coord – latitute Coordinate list

  • lon_coord – longitude Coordinates list

  • z_coord – Z Altitude list

Returns

X / Y / Z Coordinates list in input image as a numpy array