cars.extractroi =============== .. py:module:: cars.extractroi .. autoapi-nested-parse:: cars-extractroi: helper to extract region of interest from image product Functions --------- .. autoapisummary:: cars.extractroi.is_bbx_in_image cars.extractroi.get_slices_from_bbx cars.extractroi.process_image_file cars.extractroi.get_human_readable_bbox cars.extractroi.validate_bounding_box cars.extractroi.create_rpb_file cars.extractroi.main Module Contents --------------- .. py:function:: is_bbx_in_image(bbx, image_dataset) Checks if the bounding box is within the image. Parameters: bbx (array): The bounding box of the image. image_dataset (rio.DatasetReader): Opened image dataset. .. py:function:: get_slices_from_bbx(image_dataset, bbx, rpc_options, external_rpc=None) get slices from bounding box Parameters: image_dataset (rio.DatasetReader): Opened image dataset. bbx (array): The bounding box of the image. rpc_options (dict): Options for GDALCreateRPCTransformer. Returns: tuple: The slices from the bounding box. .. py:function:: process_image_file(bbx, input_image_path, output_image_path, rpb_file_path, rpc_options, external_rpc_file=None) Processes an image file by extracting a region based on the given geometry. Parameters: region_geometry (dict): GeoJSON-like dictionary defining the region. input_image_path (str): Path to the input image file. output_image_path (str): Path to save the output image. rpb_file_path (str): Path to save the .RPB file. rpc_options (dict): Options for GDALCreateRPCTransformer. .. py:function:: get_human_readable_bbox(image_dataset, rpc_options, external_rpc=None) Get the human-readable bounding box from an image dataset. Parameters: image_dataset (rio.DatasetReader): Opened image dataset. rpc_options (dict): Options for GDALCreateRPCTransformer. Returns: tuple: The human-readable bounding box in the format (min_x, max_x, min_y, max_y). .. py:function:: validate_bounding_box(bbx, image_dataset, rpc_options, external_rpc=None) Validate the bounding box coordinates. Parameters: bbx (array): The bounding box of the image. image_dataset (rio.DatasetReader): Opened image dataset. rpc_options (dict): Options for GDALCreateRPCTransformer. .. py:function:: create_rpb_file(image_dataset, rpb_filename) Create and save a .RPB file from a rasterio dataset Parameters: image_dataset (rio.DatasetReader): Opened image dataset. rpb_filename (str): Path to save the .RPB file. .. py:function:: main() Main cars-extractroi entrypoint