cars.applications.grid_generation.grids

Grids module: contains functions used for epipolar grid creation and correction

Module Contents

Functions

get_new_path(path)

Check path, if exists, creates new one

write_grid(grid, fname, origin, spacing)

Write an epipolar rectification grid to file

generate_epipolar_grids(sensor1, sensor2, geomodel1, ...)

Computes the left and right epipolar grids

compute_epipolar_grid_min_max(geometry_plugin, grid, ...)

Compute ground terrain location of epipolar grids at disp_min and disp_max

terrain_region_to_epipolar(region, sensor1, sensor2, ...)

Transform terrain region to epipolar region

cars.applications.grid_generation.grids.get_new_path(path)

Check path, if exists, creates new one

Parameters

path (str) – path to check

:return : new path :rtype: str

cars.applications.grid_generation.grids.write_grid(grid, fname, origin, spacing)

Write an epipolar rectification grid to file

Parameters
  • grid (3D numpy array) – the grid to write

  • fname (string) – the filename to which the grid will be written

  • origin ((float, float)) – origin of the grid

  • spacing ((float, float)) – spacing of the grid

cars.applications.grid_generation.grids.generate_epipolar_grids(sensor1, sensor2, geomodel1, geomodel2, geometry_plugin, epipolar_step)

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

  • geometry_plugin (AbstractGeometry) – geometry plugin to use

  • dem – path to the dem folder

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

  • epipolar_step – step to use to construct the epipolar grids

  • geoid – path to the geoid file

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

cars.applications.grid_generation.grids.compute_epipolar_grid_min_max(geometry_plugin, grid, sensor1, sensor2, geomodel1, geomodel2, grid1, grid2, epsg, disp_min_tiling, disp_max_tiling)

Compute ground terrain location of epipolar grids at disp_min and disp_max

Parameters
  • geometry_plugin (AbstractGeometry) – geometry plugin to use

  • grid (np.ndarray of shape (N,M,2)) – The epipolar grid to project

  • sensor1 (str) – path to left sensor image

  • sensor2 (str) – path to right sensor image

  • geomodel1 (dict) – path and attributes for left geomodel

  • geomodel2 (dict) – path and attributes for right geomodel

  • grid1 (CarsDataset) – dataset of the reference image grid file

  • grid2 (CarsDataset) – dataset of the secondary image grid file

  • epsg (Int) – EPSG code of the terrain projection

  • disp_min_tiling (np ndarray or int) – Minimum disparity tiling

  • disp_max_tiling (np ndarray or int) – Maximum disparity tiling

Returns

a tuple of location grid at disp_min and disp_max

Return type

Tuple(np.ndarray, np.ndarray) same shape as grid param

cars.applications.grid_generation.grids.terrain_region_to_epipolar(region, sensor1, sensor2, geomodel1, geomodel2, grid_left, grid_right, geometry_plugin, epsg=4326, disp_min=0, disp_max=0, tile_size=100, epipolar_size_x=None, epipolar_size_y=None)

Transform terrain region to epipolar region

Parameters
  • region – terrain region to use

  • 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

  • grid1 – dataset of the reference image grid file

  • grid2 – dataset of the secondary image grid file

  • geometry_plugin – geometry plugin to use

  • epsg – epsg

  • disp_min – minimum disparity

  • disp_max – maximum disparity

  • tile_size – tile size for grid

  • epipolar_size_x – epipolar_size_x

  • epipolar_size_y – epipolar_size_y

Returns

epipolar region to use, with tile_size a sample