cars.core.geometry.shareloc_geometry

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

Attributes

GRID_TYPE

RPC_TYPE

GEO_MODEL_PATH_TAG

GEO_MODEL_TYPE_TAG

Classes

SharelocGeometry

Shareloc geometry class

Module Contents

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_conf, dem=None, geoid=None, default_alt=None, pairs_for_roi=None, scaling_coeff=1, output_dem_dir=None)[source]

Bases: cars.core.geometry.abstract_geometry.AbstractGeometry

Shareloc geometry class

check_conf(conf)[source]

Check configuration

Parameters:

conf (str or dict) – configuration to check

Returns:

full dict

Return type:

dict

get_roi(pairs_for_roi, epsg, z_min=0, z_max=0, linear_margin=0, constant_margin=0.012)[source]

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

  • linear_margin (float) – margin for ROI (factor of initial ROI size)

  • constant_margin (float) – margin for ROI in degrees

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

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[source]

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[source]

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 ?)

Parameters:
  • sensor – path to sensor image

  • geomodel – path and attributes for geometrical model

Returns:

sensor path and overloaded geomodel dict

triangulate(sensor1, sensor2, geomodel1, geomodel2, mode: str, matches: xarray.Dataset | numpy.ndarray, grid1: dict | shareloc.geofunctions.rectification_grid.RectificationGrid, grid2: dict | shareloc.geofunctions.rectification_grid.RectificationGrid, roi_key: None | str = None, interpolation_method=None) numpy.ndarray[source]

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: dict or RectificationGrid for epipolar grid of sensor1 :param grid2: dict or RectificationGrid 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][source]

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[source]

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[source]

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