cars.core.preprocessing ======================= .. py:module:: cars.core.preprocessing .. autoapi-nested-parse:: Preprocessing contains function used in pipelines Attributes ---------- .. autoapisummary:: cars.core.preprocessing.PREPROCESSING_TAG cars.core.preprocessing.LEFT_ENVELOPE_TAG cars.core.preprocessing.RIGHT_ENVELOPE_TAG cars.core.preprocessing.ENVELOPES_INTERSECTION_TAG cars.core.preprocessing.ENVELOPES_INTERSECTION_BB_TAG Functions --------- .. autoapisummary:: cars.core.preprocessing.get_utm_zone_as_epsg_code cars.core.preprocessing.compute_terrain_bbox cars.core.preprocessing.compute_roi_poly cars.core.preprocessing.compute_epsg cars.core.preprocessing.crop_terrain_bounds_with_roi cars.core.preprocessing.compute_terrain_bounds cars.core.preprocessing.get_conversion_factor cars.core.preprocessing.convert_optimal_tile_size_with_epsg cars.core.preprocessing.compute_epipolar_roi Module Contents --------------- .. py:data:: PREPROCESSING_TAG :value: 'pair_preprocessing' .. py:data:: LEFT_ENVELOPE_TAG :value: 'left_envelope' .. py:data:: RIGHT_ENVELOPE_TAG :value: 'right_envelope' .. py:data:: ENVELOPES_INTERSECTION_TAG :value: 'envelopes_intersection' .. py:data:: ENVELOPES_INTERSECTION_BB_TAG :value: 'envelopes_intersection_bounding_box' .. py:function:: get_utm_zone_as_epsg_code(lon, lat) Returns the EPSG code of the UTM zone where the lat, lon point falls in :param lon: longitude of the point :type lon: float :param lat: latitude of the point :type lat: float :return: The EPSG code corresponding to the UTM zone :rtype: int .. py:function:: compute_terrain_bbox(sensor_image_left, sensor_image_right, epipolar_image_left, grid_left, grid_right, epsg, geometry_plugin, disp_min=-10, disp_max=10, resolution=0.5, roi_poly=None, pair_key='PAIR_0', pair_folder=None, orchestrator=None, check_inputs=False) Compute terrain bounding box of current pair :param srtm_dir: srtm directory :type srtm_dir: str :param default_alt: default altitude :type default_alt: int :param geoid: geoid path :type geoid: str :param sensor_image_left: left image Dict Must contain keys : "image", "texture", "geomodel", "no_data", "mask". Paths must be absolutes :type sensor_image_left: dict :param sensor_image_right: right image Dict Must contain keys : "image", "texture", "geomodel", "no_data", "mask". Paths must be absolutes :type sensor_image_right: dict :param grid_left: left 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" :type grid_left: dict :param grid_right: right 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" :type grid_right: dict :param epsg: epsg to use :type epsg: str :param geometry_plugin: geometry plugin to use :type geometry_plugin: AbstractGeometry :param disp_min: minimum disparity :type disp_min: int :param disp_max: maximum disparity :type disp_max: int :param resolution: resolution :type resolution: float :param roi_poly: roi polygon :type roi_poly: Polygon :param pair_key: pair key id :type pair_key: str :param pair_folder: pair folder to save data to :type pair_folder: str :param orchestrator: orchestrator :type orchestrator: Orchestrator :param check_inputs: true if user wants to check inputs :type check_inputs: bool :return: former post prepare configuration :rtype: dict .. py:function:: compute_roi_poly(input_roi_poly, input_roi_epsg, epsg) Compute roi polygon from input roi :param input_roi_poly: roi polygon :type input_roi_poly: shapely Polygon :param input_roi_epsg: epsg of roi :type input_roi_epsg: str :param epsg: epsg to use :type epsg: str :return: polygon of roi with right epsg :rtype: Polygon .. py:function:: compute_epsg(sensor_image_left, sensor_image_right, grid_left, grid_right, geometry_plugin, disp_min=-10, disp_max=10) Compute epsg to use :param sensor_image_left: left image Dict Must contain keys : "image", "texture", "geomodel", "no_data", "mask". Paths must be absolutes :type sensor_image_left: dict :param sensor_image_right: right image Dict Must contain keys : "image", "texture", "geomodel", "no_data", "mask". Paths must be absolutes :type sensor_image_right: dict :param grid_left: left grid. Grid dict contains : - 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", "path" :type grid_left: dict :param grid_right: right grid. Grid dict contains : - 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", "path" :type grid_right: dict :param geometry_plugin: geometry plugin to use :type geometry_plugin: AbstractGeometry :param srtm_dir: srtm directory :type srtm_dir: str :param default_alt: default altitude :type default_alt: int :param disp_min: minimum disparity :type disp_min: int :param disp_max: maximum disparity :type disp_max: int :return: epsg :rtype: str .. py:function:: crop_terrain_bounds_with_roi(roi_poly, xmin, ymin, xmax, ymax) Crop current terrain bounds with roi :param roi_poly: Polygon of ROI :type roi_poly: Shapely Polygon :param xmin: xmin :type xmin: float :param ymin: ymin :type ymin: float :param xmax: xmax :type xmax: float :param ymax: ymax :type ymax: float :return: new xmin, ymin, xmax, ymax :rtype: (float, float, float, float) .. py:function:: compute_terrain_bounds(list_of_terrain_roi, roi_poly=None, resolution=0.5) Compute Terrain bounds of merged pairs :param list_of_terrain_roi: list of terrain roi list of (terrain bbox, terrain epi_tile_size) :type list_of_terrain_roi: list :param roi_poly: terrain roi of given roi :type roi_poly: Polygon :param resolution: list of terrain roi :type resolution: float :return: bounds, optimal_terrain_tile_width_average .. py:function:: get_conversion_factor(bounds, epsg, epsg_cloud) Conmpute conversion factor :param bounds: terrain bounds :type bounds: list :param epsg: epsg of bounds :type epsg: int :param epsg_cloud: epsg of the input cloud :type epsg_cloud: int :return: conversion factor :rtype: float .. py:function:: convert_optimal_tile_size_with_epsg(bounds, optimal_terrain_tile_width, epsg, epsg_cloud) Convert optimal_tile_size according to epsg. Only if epsg_cloud is different of the output epsg. :param bounds: terrain bounds :type bounds: list :param optimal_terrain_tile_width: initial optimal_terrain_tile_width :type optimal_terrain_tile_width: float :param epsg: target epsg :type epsg: int :param epsg_cloud: epsg of the input cloud :type epsg_cloud: int :return: converted optimal tile size :rtype: float .. py:function:: compute_epipolar_roi(terrain_roi_poly, terrain_roi_epsg, geometry_plugin, sensor_image_left, sensor_image_right, grid_left, grid_right, output_path, disp_min=0, disp_max=0) Compute epipolar roi to use :param terrain_roi_poly: terrain roi polygon :param terrain_roi_epsg: terrain roi epsg :param geometry_plugin: geometry plugin to use :param epsg: epsg :param disp_min: minimum disparity :param disp_max: maximum disparity :return: epipolar region to use, with tile_size a sample