cars.applications.triangulation.line_of_sight_intersection_app

this module contains the LineOfSightIntersection application class.

Classes

LineOfSightIntersection

Triangulation

Functions

triangulation_wrapper(→ Dict[str, ...)

Compute point clouds from image objects and disparity objects.

triangulation_wrapper_matches(matches, sensor1, ...)

Module Contents

class cars.applications.triangulation.line_of_sight_intersection_app.LineOfSightIntersection(conf=None)[source]

Bases: cars.applications.triangulation.abstract_triangulation_app.Triangulation

Triangulation

used_method
snap_to_img1
save_intermediate_data
z_inf_sup_bh_approximation
ref_left_img = None
orchestrator = None
check_conf(conf)[source]

Check configuration

Parameters:

conf (dict) – configuration to check

Returns:

overloaded configuration

Return type:

dict

save_triangulation_output(epipolar_point_cloud, sensor_image_left, output_dir, dump_dir=None, performance_maps_to_generate=None, save_output_coordinates=True, save_output_color=True, save_output_classification=False, save_output_filling=False, save_output_performance_map=False, save_output_ambiguity=False, save_output_edges=False)

Save the triangulation output. The different TIFs composing the depth map are written to the output directory. Auxiliary products can be requested or not using the parameters. A dump directory can also be provided to write any additionnal files that have not been written to the output directory (because they are not part of the depth map definition, or because they have not been requested).

Parameters:
  • epipolar_point_cloud (CarsDataset) – tiled epipolar left image

  • sensor_image_left (CarsDataset) – tiled sensor left image Dict Must contain keys : “image”, “texture”, “geomodel”, “no_data”, “mask”. Paths must be absolutes

  • output_dir (None or str) – directory to write triangulation output depth map.

  • dump_dir (str) – folder used as dump directory for current pair, None to deactivate intermediate data writing

  • performance_maps_to_generate (None or list containing "risk" or "intervals") – None or list containing “risk” or “intervals”

  • save_output_coordinates (bool) – Save X, Y and Z coords in output_dir

  • save_output_color (bool) – Save color depth map in output_dir

  • save_output_classification (bool) – Save classification depth map in output_dir

  • save_output_filling (bool) – Save filling depth map in output_dir

  • save_output_performance_map (bool) – Save performance map in output_dir

  • save_output_ambiguity (bool) – Save ambiguity in output_dir

  • save_output_edges (bool) – Save edges in output_dir

fill_index(save_output_coordinates=True, save_output_color=True, save_output_classification=False, save_output_filling=False, save_output_performance_map=False, save_output_ambiguity=False, save_output_edges=False, pair_key='PAIR_0')

Fill depth map index for current pair, according to which product should be saved

Parameters:
  • save_output_coordinates (bool) – Save X, Y and Z coords in output_dir

  • save_output_color (bool) – Save color depth map in output_dir

  • save_output_classification (bool) – Save classification depth map in output_dir

  • save_output_filling (bool) – Save filling depth map in output_dir

  • save_output_performance_map (bool) – Save performance map in output_dir

  • save_output_ambiguity (bool) – Save ambiguity in output_dir

  • pair_key (str) – name of the current pair

create_point_cloud_directories(pair_dump_dir, point_cloud_dir, point_cloud)[source]

Set and create directories for point cloud disk output (laz and csv) The function return None path if the point cloud should not be saved

Parameters:
  • pair_dump_dir (str) – folder used as dump directory for current pair

  • point_cloud_dir (str) – folder used for laz official product directory

  • point_cloud (Dataset) – input point cloud (for orchestrator registration)

run(sensor_image_left, sensor_image_right, grid_left, grid_right, epipolar_disparity_map, geometry_plugin, epipolar_image, epsg=None, denoising_overload_fun=None, source_pc_names=None, orchestrator=None, pair_dump_dir=None, pair_key='PAIR_0', uncorrected_grid_right=None, geoid_path=None, cloud_id=None, performance_maps_param=None, depth_map_dir=None, point_cloud_dir=None, save_output_coordinates=False, save_output_color=False, save_output_classification=False, save_output_filling=False, save_output_performance_map=False, save_output_ambiguity=False, save_output_edges=False)[source]

Run Triangulation application.

Created left and right CarsDataset filled with xarray.Dataset, corresponding to 3D point clouds, stored on epipolar geometry grid.

Parameters:
  • sensor_image_left (CarsDataset) – tiled sensor left image Dict Must contain keys : “image”, “texture”, “geomodel”, “no_data”, “mask”. Paths must be absolutes

  • sensor_image_right (CarsDataset) – tiled sensor right image Dict Must contain keys : “image”, “texture”, “geomodel”, “no_data”, “mask”. Paths must be absolutes

  • grid_left (dict) – left epipolar grid. Grid dict contains : - “grid_spacing”, “grid_origin”, “epipolar_size_x”, epipolar_size_y”, “epipolar_origin_x”, “epipolar_origin_y”,”epipolar_spacing_x”, “epipolar_spacing”, “disp_to_alt_ratio”, “path”

  • grid_right (dict) – right epipolar grid. Grid dict contains : - “grid_spacing”, “grid_origin”, “epipolar_size_x”, epipolar_size_y”, “epipolar_origin_x”, “epipolar_origin_y”,”epipolar_spacing_x”, “epipolar_spacing”, “disp_to_alt_ratio”, “path”

  • epipolar_disparity_map (CarsDataset) –

    tiled left disparity map or sparse matches:

    • if CarsDataset is instance of “arrays”, CarsDataset contains:

      • N x M Delayed tiles Each tile will be a future xarray Dataset containing:

        • data with keys : “disp”, “disp_msk”

        • attrs with keys: profile, window, overlaps

      • attributes containing:”largest_epipolar_region” “opt_epipolar_tile_size”

    • if CarsDataset is instance of “points”, CarsDataset contains:

      • N x M Delayed tiles Each tile will be a future pandas DataFrame containing:

        • data : (L, 4) shape matches

      • attributes containing:”disp_lower_bound”,”disp_upper_bound”, “elevation_delta_lower_bound”,”elevation_delta_upper_bound”

  • epipolar_image (CarsDataset) – tiled epipolar left image

  • denoising_overload_fun (fun) – function to overload dataset

  • source_pc_names (list[str]) – source pc names

  • orchestrator – orchestrator used

  • pair_dump_dir (str) – folder used as dump directory for current pair

  • pair_key (str) – pair key id

  • uncorrected_grid_right (CarsDataset) – not corrected right epipolar grid used if self.snap_to_img1

  • geoid_path (str) – geoid path

  • performance_maps_param (dict or None) – parameters used to generate performance map

  • depth_map_dir (None or str) – directory to write triangulation output depth map.

  • save_output_coordinates (bool) – Save X, Y, Z coords in depth_map_dir

  • save_output_color (bool) – Save color depth map in depth_map_dir

  • save_output_classification (bool) – Save classification depth map in depth_map_dir

  • save_output_filling (bool) – Save filling depth map in depth_map_dir

  • save_output_performance_map (bool) – Save performance map in depth_map_dir

  • save_output_ambiguity (bool) – Save ambiguity in depth_map_dir

  • save_output_edges (bool) – Save edges in depth_map_dir

Returns:

point cloud The CarsDataset contains:

  • N x M Delayed tiles Each tile will be a future xarray Dataset containing:

    • data : with keys : “x”, “y”, “z”, “corr_msk” optional: “texture”, “msk”, “z_inf”, “z_sup”

    • attrs with keys: “margins”, “epi_full_size”, “epsg”

  • attributes containing: “disp_lower_bound”, “disp_upper_bound”, “elevation_delta_lower_bound”,”elevation_delta_upper_bound”

Return type:

Tuple(CarsDataset, CarsDataset)

cars.applications.triangulation.line_of_sight_intersection_app.triangulation_wrapper(disparity_object: xarray.Dataset, sensor1, sensor2, geomodel1, geomodel2, grid1, grid2, geometry_plugin, epsg, z_inf_sup_bh_approximation, disp_to_alt_ratio, geoid_path=None, denoising_overload_fun=None, cloud_id=None, performance_maps_to_generate=None, performance_maps_parameters=None, point_cloud_csv_file_name=None, point_cloud_laz_file_name=None, saving_info_epipolar=None, saving_info_flatten=None) Dict[str, Tuple[xarray.Dataset, xarray.Dataset]][source]

Compute point clouds from image objects and disparity objects.

Parameters:
  • disparity_object (xr.Dataset) – Left disparity map dataset with : - cst_disp.MAP - cst_disp.VALID - cst.EPI_TEXTURE

  • 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

  • geometry_plugin (AbstractGeometry) – geometry plugin to use

  • geoid_path (str) – Geoid used for altimetric reference. Defaults to None for using ellipsoid as altimetric reference.

  • performance_maps_to_generate – None or list containing “risk” or “intervals”

  • performance_maps_parameters (dict or None) – parameters used to generate performance map

  • denoising_overload_fun (fun) – function to overload dataset

Returns:

Left disparity object

Returned object is composed of :
  • dataset with :
    • cst.X

    • cst.Y

    • cst.Z

    • cst.EPI_TEXTURE

    • cst.Z_INF (optional)

    • cst.Z_SUP (optional)

cars.applications.triangulation.line_of_sight_intersection_app.triangulation_wrapper_matches(matches, sensor1, sensor2, geomodel1, geomodel2, grid1, grid2, geometry_plugin, full_saving_info_matches, epsg)[source]
Parameters:
  • matches (cars_dataset) – matches

  • sensor1 (str) – path to left sensor image

  • sensor2 (str) – path to right sensor image

  • interpolated_grid1 (shareloc.rectificationGrid) – rectification grid left

  • interpolated_grid2 (shareloc.rectificationGrid) – rectification grid right

  • geometry_plugin (AbstractGeometry) – geometry plugin to use

  • epsg (int) – ground epsg