Batch processing module#

Batch processing of MarsImages for photogrammetry.

These functions are work in progress and subject to change in a future release!

marsimage.batch_processing.filter_photogrammetry(img)[source]#

Determine if an image should be used for photogrammetry based on its metadata.

Parameters:

img (MarsImage) – The image to be filtered.

Returns:

True if the image should be used for photogrammetry, False otherwise.

Return type:

bool

marsimage.batch_processing.filter_ecam_photogrammetry(img)[source]#

Filter ECAM images that are not suitable for photogrammetry.

marsimage.batch_processing.filter_mcam_photogrammetry(img)[source]#

Filter Mastcam images that are not suitable for photogrammetry.

marsimage.batch_processing.filter_mahli_photogrammetry(img)[source]#

Filter MAHLI images that are not suitable for photogrammetry.

marsimage.batch_processing.process_image(image_path, output_dir=None, uncrop=True, image_filter=<function filter_photogrammetry>, group='cam_id', apply_mask=True)[source]#

Process a single image file.

Parameters:
  • image_path (Path) – The path to the image file to be processed.

  • output_dir (Path, optional) – The directory to save the converted images. If None, the converted images will be saved in a subdirectory of the original images.

  • image_filter (callable, optional) – A function to filter that returns True if the image should be processed. If the image_filter argument is set to None, all images will be processed. See filter_photogrammetry for an example.

  • group (str, optional) – The method to group the converted images. If β€˜cam_id’, the images will be grouped by camera id. If None, the images will not be grouped.

  • apply_mask (bool, optional) – If True, apply the mask to the converted images as an alpha channel.

  • num_threads (int, optional) – The number of threads to use for parallel processing

marsimage.batch_processing.process_images(image_list, output_dir=None, uncrop=True, group='cam_id', apply_mask=True, image_filter=<function filter_photogrammetry>, num_threads=None)[source]#

Process a list of images in parallel.

Parameters:
  • image_list (list of Path) – A list of paths to the image files to be processed.

  • output_dir (Path, optional) – The directory to save the converted images. If None, the converted images will be saved in a subdirectory of the original images.

  • group (str, optional) – The method to group the converted images. If β€˜cam_id’, the images will be grouped by camera id. If None, the images will not be grouped.

  • image_filter (callable, optional) – A function to filter that returns True if the image should be processed. See filter_photogrammetry for an example.

  • apply_mask (bool, optional) – If True, apply the mask to the converted images as an alpha channel.

  • num_threads (int, optional) – The number of threads to use for parallel processing. By default, the number of threads is set to the number of CPU cores.