asi_core.image.hdr.merge

This module provides functionality of merging exposure series of all-sky images for high-dynamic range imaging.

Functions

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[, ...])

Merge a series of differently exposed images into a single HDR image.

reconstruct_hdr_from_response(images, exposure_times, ...)

Debevec-style HDR radiance reconstruction using a precomputed response curve.

Module Contents

asi_core.image.hdr.merge.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.image.hdr.merge.merge_exposure_series(img_series, exposure_times, algorithm='debevec', response=None, saturation=255, low_clip=5, high_clip=250, weight_type='triangle', lnE_range=None, apply_tonemapping=True, gamma=2.2, filetype='.jpg')

Merge a series of differently exposed images into a single HDR image.

Parameters:
  • img_series (list[numpy.ndarray]) – Sequence of input images as NumPy arrays (HxWxC, 8-bit or float32).

  • exposure_times (list[float]) – Exposure times corresponding to each image (in seconds).

  • algorithm (str) – HDR merging algorithm to use: 'mertens' (exposure fusion), 'debevec' (calibrated HDR), or 'debevec_custom' (uses pre-computed response and custom processing). Default is 'debevec'.

  • response (numpy.ndarray | None) – Optional pre-computed camera response function.

  • saturation (int) – Pixel value above which intensities are considered saturated. Used only for Debevec methods. Default is 255.

  • low_clip (int) – Lower intensity threshold to discard unreliable low values. Default is 5.

  • high_clip (int) – Upper intensity threshold to discard unreliable high values. Default is 250.

  • weight_type (str) – Weighting function for Debevec reconstruction, either 'triangle' (default) or 'sine'.

  • lnE_range (tuple[float, float] | None) – Optional global log-irradiance range (min_lnE, max_lnE) for consistent scaling.

  • apply_tonemapping (bool) – Whether to apply tone mapping to the final HDR image. Default is True.

  • gamma (float) – Gamma applied to tone-map the HDR result for display. Default is 2.2.

  • filetype (str) – Output file type ('.jpg', '.jp2', or '.png'). Default '.jpg'.

Returns:

Merged HDR image as a NumPy float32 array.

Return type:

numpy.ndarray

asi_core.image.hdr.merge.reconstruct_hdr_from_response(images, exposure_times, response, weight_type: str = 'triangle', lnE_range: tuple | None = None)

Debevec-style HDR radiance reconstruction using a precomputed response curve.

Parameters:
  • images (list[numpy.ndarray] or numpy.ndarray) – List or array of HxWxC uint8/float images in 0..255 scale.

  • exposure_times (array-like) – Array-like of length N containing exposure times for each image.

  • response (numpy.ndarray) – Per-channel response g(z) in log domain (shape: (256, C)).

  • weight_type (str) – Weighting function for Debevec reconstruction, either 'triangle' (default) or 'sine'.

  • lnE_range (tuple[float, float] | None) – Optional global log-irradiance range (min_lnE, max_lnE) for consistent scaling.

Returns:

Reconstructed HDR image as a NumPy float32 array in [0, 1] range.

Return type:

numpy.ndarray