cars.core.otb_adapters

this module contains the data adapters to use the otb

Module Contents

Functions

encode_to_otb(data_array, largest_size, roi[, origin, ...])

This function encodes a numpy array with metadata

rigid_transform_resample(img, scale_x, scale_y, ...)

Execute RigidTransformResample OTB application

cars.core.otb_adapters.encode_to_otb(data_array, largest_size, roi, origin=None, spacing=None)

This function encodes a numpy array with metadata so that it can be used by the ImportImage method of otb applications

Parameters
  • data_array (numpy array) – The numpy data array to encode

  • largest_size (list of two int) – The size of the full image (data_array can be a part of a bigger image)

  • roi (list of four int) – Region encoded in data array ([x_min,y_min,x_max,y_max])

  • origin (list of two int) – Origin of full image (default origin: (0, 0))

  • spacing (list of two int) – Spacing of full image (default spacing: (1,1))

Returns

A dictionary of attributes ready to be imported by ImportImage

Return type

dict

cars.core.otb_adapters.rigid_transform_resample(img: str, scale_x: float, scale_y: float, img_transformed: str)

Execute RigidTransformResample OTB application

Parameters
  • img – path to the image to transform

  • scale_x – scale factor to apply along x axis

  • scale_y – scale factor to apply along y axis

  • img_transformed – output image path