asi_core.image.hdr.calibration

This module provides calibration procedure for merging all-sky images for high-dynamic range imaging.

Functions

_make_mesh(sizeX, sizeY)

Create a regular meshgrid of x and y coordinates.

_make_round_mesh(sizeX, sizeY, max_radius)

Generate coordinates of points that lie within a circular region of the

calibrate_response_debevec(samples, exposure_times[, ...])

Calibrate camera response function using the Debevec method.

get_sample_positions(image[, samples_per_image, ...])

Generate sample positions within a circular region of an image.

Module Contents

asi_core.image.hdr.calibration._make_mesh(sizeX, sizeY)

Create a regular meshgrid of x and y coordinates.

Parameters:
  • sizeX (int) – Number of points along the x‑axis.

  • sizeY (int) – Number of points along the y‑axis.

Returns:

Tuple (xv, yv) where each element is a 2‑D array of shape (sizeX, sizeY) containing the x‑ or y‑coordinates for every point in the grid.

Return type:

tuple(numpy.ndarray, numpy.ndarray)

asi_core.image.hdr.calibration._make_round_mesh(sizeX, sizeY, max_radius)

Generate coordinates of points that lie within a circular region of the image domain.

The circular region is centred at the image centre and its radius is defined as max_radius (a fraction of the distance from the centre to the closest image border).

Parameters:
  • sizeX (int) – Width of the image (number of columns).

  • sizeY (int) – Height of the image (number of rows).

  • max_radius (float) – Fraction of the smallest half‑dimension that defines the radius of the circular mask. Must be within (0, 1].

Returns:

Two 1‑D arrays (xs, ys) containing the x‑ and y‑coordinates of the points that fall inside the circular mask.

Return type:

tuple(numpy.ndarray, numpy.ndarray)

asi_core.image.hdr.calibration.calibrate_response_debevec(samples, exposure_times, smoothing: float = 50.0, weight_type: str = 'triangle')

Calibrate camera response function using the Debevec method.

This function estimates the camera response function in logarithmic domain from multiple exposures of the same scene. It uses a least squares approach to solve for the response function that best fits the measured intensities.

Parameters:
  • samples – List of arrays, each with shape (P_i, N_i, C), where: - P_i is the number of pixels in the sample, - N_i is the number of exposures for the sample, - C is the number of color channels.

  • exposure_times – List of arrays, each with shape (N_i,), containing the exposure times corresponding to each sample in samples.

  • smoothing – Smoothing factor used in the smoothness constraint term. Default is 50.0.

  • weight_type – Type of weighting function to use ('triangle' (default) | 'sine').

Returns:

Response function in logarithmic domain, shape (256, 1, C).

asi_core.image.hdr.calibration.get_sample_positions(image, samples_per_image=100, max_radius=0.97, sample_technique='random')

Generate sample positions within a circular region of an image.

This function selects pixel coordinates from within a specified circular area of the input image, using either random sampling or histogram-based sampling.

Parameters:
  • image (numpy.ndarray) – Input image array of shape (H, W, C).

  • samples_per_image (int) – Number of sample positions to generate. Default is 100.

  • max_radius (float) – Fraction of the smaller dimension to define the maximum radius. Default is 0.97.

  • sample_technique (str) – Sampling method, either ‘random’ or ‘histogram’. Default is ‘random’.

Returns:

Tuple of arrays containing x and y coordinates of sampled points.

Return type:

Tuple[numpy.ndarray, numpy.ndarray]