cars.applications.triangulation.line_of_sight_intersection

this module contains the LineOfSightIntersection application class.

Module Contents

Classes

LineOfSightIntersection

Triangulation

Functions

triangulation_wrapper(→ Dict[str, ...)

Compute point clouds from image objects and disparity objects.

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

Bases: cars.applications.triangulation.triangulation.Triangulation

Triangulation

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, intervals=None, save_output_coordinates=True, save_output_color=True, save_output_classification=False, save_output_mask=False, save_output_filling=False, save_output_performance_map=False)[source]

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”, “color”, “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

  • intervals (None or [str, str]) – Either None or a List of 2 intervals indicators

  • 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_mask (bool) – Save mask 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

fill_index(save_output_coordinates=True, save_output_color=True, save_output_classification=False, save_output_mask=False, save_output_filling=False, save_output_performance_map=False, pair_key='PAIR_0')[source]

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_mask (bool) – Save mask 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

  • 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, epipolar_image, grid_left, grid_right, epipolar_disparity_map, epsg, geometry_plugin, 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, intervals=None, depth_map_dir=None, point_cloud_dir=None, save_output_coordinates=False, save_output_color=False, save_output_classification=False, save_output_mask=False, save_output_filling=False, save_output_performance_map=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”, “color”, “geomodel”, “no_data”, “mask”. Paths must be absolutes

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

  • epipolar_image (CarsDataset) – tiled epipolar left image

  • grid_left

    left epipolar grid. Grid CarsDataset contains :

    • A single tile stored in [0,0], containing a (N, M, 2) shape array in xarray Dataset

    • Attributes containing: “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”, :type grid_left: CarsDataset

  • grid_right (CarsDataset) –

    right epipolar grid. Grid CarsDataset contains :

    • A single tile stored in [0,0], containing a (N, M, 2) shape

      array in xarray Dataset

    • Attributes containing: “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”,

  • 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”

  • 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

  • intervals (None or [str, str]) – Either None or a List of 2 intervals indicators

  • 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_mask (bool) – Save mask 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

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: “color”, “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.triangulation_wrapper(disparity_object: xarray.Dataset, sensor1, sensor2, geomodel1, geomodel2, grid1, grid2, geometry_plugin, epsg, geoid_path=None, denoising_overload_fun=None, cloud_id=None, intervals=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_COLOR

  • 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.

  • intervals – Either None or a List of 2 intervals indicators :type intervals: None or [str, str]

  • 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_COLOR

    • cst.Z_INF (optional)

    • cst.Z_SUP (optional)