asi_core.hdr_creation

This module provides functionality for all-sky imagers.

Functions

process_directory(directory, save_dir)

Processes a directory of images by grouping them into short time intervals and creating HDR images.

rescale_0_1(image[, min_val, max_val])

Rescales an image to the range [0,1].

correction_oversatured_regions(images[, saturation])

Corrects oversaturated regions in a series of images by setting all channels to maximum intensity.

merge_exposure_series(img_series, exposure_times[, ...])

Merges a series of images with different exposures into an HDR image.

create_and_save_hdr(img_series, exposure_times, ...)

Creates an HDR image from a series of exposures and saves it to a file.

process_timestamp(timestamp_group, root_dir, target_dir)

Process all images corresponding to a single timestamp.

process_hdr_series(asi_files, root_dir, target_dir[, ...])

Process a multi-index Pandas Series containing image paths in parallel to generate HDR images.

Module Contents

asi_core.hdr_creation.process_directory(directory, save_dir)

Processes a directory of images by grouping them into short time intervals and creating HDR images.

Parameters:
  • directory – Path to the directory containing images.

  • save_dir – Path to the directory where HDR images will be saved.

asi_core.hdr_creation.rescale_0_1(image, min_val=None, max_val=None)

Rescales an image to the range [0,1].

Parameters:
  • image – Input image as a NumPy array.

  • min_val – Minimum value for rescaling (optional).

  • max_val – Maximum value for rescaling (optional).

Returns:

Rescaled image with values between 0 and 1.

asi_core.hdr_creation.correction_oversatured_regions(images, saturation=255)

Corrects oversaturated regions in a series of images by setting all channels to maximum intensity.

Parameters:
  • images – List of images as NumPy arrays.

  • saturation – Saturation threshold (default: 255).

Returns:

Tuple of corrected images and a mask indicating non-oversaturated regions.

asi_core.hdr_creation.merge_exposure_series(img_series, exposure_times, algorithm='mertens', saturation=255, filetype='.jpg')

Merges a series of images with different exposures into an HDR image.

Parameters:
  • img_series – List of images as NumPy arrays.

  • exposure_times – List of exposure times corresponding to the images.

  • algorithm – HDR merging algorithm (‘mertens’ or ‘debevec’, default: ‘mertens’).

  • saturation – Saturation threshold for correction (default: 255).

  • filetype – Output file format (‘.jpg’, ‘.jp2’, or ‘.png’).

Returns:

Merged HDR image as a NumPy array.

asi_core.hdr_creation.create_and_save_hdr(img_series, exposure_times, output_path, **kwargs_merging)

Creates an HDR image from a series of exposures and saves it to a file.

Parameters:
  • img_series – List of images as NumPy arrays.

  • exposure_times – List of exposure times corresponding to the images.

  • output_path – Path where the HDR image will be saved.

  • kwargs_merging – Additional parameters for the merging function.

asi_core.hdr_creation.process_timestamp(timestamp_group, root_dir, target_dir)

Process all images corresponding to a single timestamp.

asi_core.hdr_creation.process_hdr_series(asi_files: pandas.Series, root_dir: str, target_dir: str, n_workers=0)

Process a multi-index Pandas Series containing image paths in parallel to generate HDR images.

Parameters:
  • asi_files (pandas.Series) – A multi-index Pandas Series where the index consists of timestamps and exposure times, and the values contain relative image paths.

  • root_dir (str) – The root directory containing the source images.

  • target_dir (str) – The target directory where the generated HDR images will be stored.

  • n_workers (int, optional) – The number of parallel workers to use for processing. Defaults to 0 (no parallelism).

Returns:

A Pandas Series with timestamps as the index and generated HDR file paths as values.

Return type:

pandas.Series