cars.externals.otb_pipelines

OTB Pipelines module: contains functions that builds Orfeo ToolBox pipelines used by CARS Refacto: Split function in generic externals calls through functional steps interfaces (epipolar rectification, …)

Module Contents

Functions

build_extract_roi_application(img, region)

This function builds a ready to use instance of the ExtractROI application

build_mask_pipeline(input_img, input_mask, ...)

This function builds a pipeline that computes and

build_image_resampling_pipeline(img, grid, ...[, ...])

This function builds a pipeline that resamples images in epipolar geometry

get_utm_zone_as_epsg_code(lon, lat)

Returns the EPSG code of the UTM zone where the lat, lon point falls in

read_lowres_dem(startx, starty, sizex, sizey[, dem, ...])

Read an extract of the low resolution input DSM and return it as an Array

cars.externals.otb_pipelines.build_extract_roi_application(img, region)

This function builds a ready to use instance of the ExtractROI application

Parameters
  • img (otb::Image pointer) – Pointer to the OTB image to extract

  • region (list of 4 int (xmin, ymin, xmax, ymax)) – Extraction region

Returns

(extracted image, roi application) tuple

Return type

ready to use instance of the ExtractROI application

cars.externals.otb_pipelines.build_mask_pipeline(input_img, input_mask, input_nodata, out_nodata, out_valid_value, grid, epipolar_size_x, epipolar_size_y, roi)

This function builds a pipeline that computes and resampled image mask in epipolar geometry

Parameters
  • input_img – Path to the left input image

  • input_mask – Path to left image mask or None

  • input_nodata (float) – Pixel value to be treated as nodata in image or None

  • out_nodata (float) – Pixel value used for the output

  • out_valid_value – Pixel value for valid points in mask

  • grid (otb::Image pointer or string) – The stereo-rectification rectification grid

  • epipolar_size_x (int) – Size of stereo-rectified images in x

  • epipolar_size_y (int) – Size of stereo-rectified images in y

  • roi (list of 4 int (xmin, ymin, xmax, ymax)) – Region over which to compute epipolar mask or None

Typ out_valid_value

float

Returns

mask

Return type

resampled mask as numpy array

cars.externals.otb_pipelines.build_image_resampling_pipeline(img, grid, epipolar_size_x, epipolar_size_y, roi, interpolator=None)

This function builds a pipeline that resamples images in epipolar geometry

Parameters
  • img (string) – Path to the left image

  • grid (otb::Image pointer or string) – The stereo-rectification rectification grid

  • epipolar_size_x (int) – Size of stereo-rectified images in x

  • epipolar_size_y (int) – Size of stereo-rectified images in y

  • roi (list of 4 int (xmin, ymin, xmax, ymax)) – Region over which to compute epipolar images, or None

  • interpolator (str ("nn" "linear" "bco")) – interpolator type according with otb option (bco is default value)

Returns

resampled image

Return type

resampled image as numpy array

cars.externals.otb_pipelines.get_utm_zone_as_epsg_code(lon, lat)

Returns the EPSG code of the UTM zone where the lat, lon point falls in TODO: refacto with externals (OTB)

Parameters
  • lon (float) – longitude of the point

  • lat (float) – latitude of the point

Returns

The EPSG code corresponding to the UTM zone

Return type

int

cars.externals.otb_pipelines.read_lowres_dem(startx, starty, sizex, sizey, dem=None, default_alt=None, geoid=None, resolution=0.000277777777778)

Read an extract of the low resolution input DSM and return it as an Array

Parameters
  • startx (float) – Upper left x coordinate for grid in WGS84

  • starty (float) – Upper left y coordinate for grid in WGS84 (remember that values are decreasing in y axis)

  • sizex (int) – Size of grid in x direction

  • sizey (int) – Size of grid in y direction

  • dem (string) – DEM directory

  • default_alt (float) – Default altitude above ellipsoid

  • geoid (str) – path to geoid file

  • resolution (float) – Resolution (in degrees) of output raster

Returns

The extract of the lowres DEM as an xarray.Dataset

Return type

xarray.Dataset