API¶
Main Function for Exposure Merging¶
-
rawhdr.merge.
merge_exposures
(exposures, mask_width=None, blend_width=None, blend_cap=None, target_gamma=None, weight_first=True)¶ Merge multiple LDR images into a HDR image.
- Parameters
exposures (iterable of array_like) – Floating point input images in linear color space.
mask_width (float) – Size of the mask in gamma-corrected color space.
blend_width (float) – Width of the blended regions at both ends of the brightness range.
blend_cap (float) – Cap of dark and bright regions.
target_gamma (float) – Target gamma used for the masking computations.
weight_first (bool) – If False, the first given image is treated specially and not blended in dark and bright areas. Can be used if the first image is already an HDR image.
- Returns
merged – Merged HDR image width same exposure as the first image in the exposures input list.
- Return type
numpy.ndarray
Helper Functions for Exposure Merging¶
-
rawhdr.merge.
compute_scaling
(image, base_image, mask_width=None, target_gamma=None)¶ Exposure scaling computation.
Computes the scaling required for image such that its brightness/exposure is equal to base_image.
Only the central part of the brightness distribution of both images is used to perform the calculation. Very bright (possibly saturated) and dark (possibly noisy) pixels are ignored.
Masking of the center part can be controlled by mask_width and target_gamma, in most cases the default parameters should work reasonaly well.
- Parameters
image (array_like) – Image for which the scaling factor is computed.
base_image (array_like) – Image with reference brightness/exposure.
mask_width (float) – Size of the mask in gamma-corrected color space.
target_gamma (float) – Target gamma used for the masking computations.
- Returns
scaling – Scaling factor such that scaling * image is approximately equal to base_image.
- Return type
float
-
rawhdr.merge.
compute_weight
(image, blend_low=True, blend_high=True, blend_width=None, blend_cap=None, target_gamma=None)¶ Compute per-pixel blending weights.
- Parameters
image (array_like) – Image for which the blending weights are computed.
blend_low (bool) – Enables blending of the lower (dark) part of the image brightness.
blend_high (bool) – Enabled blending of the higher (dark) part of the image brightness.
blend_width (float) – Width of the blended regions at both ends of the brightness range.
blend_cap (float) – Cap of dark and bright regions.
target_gamma (float) – Gamma at which the blending is performed.
- Returns
mask – Mask with the same shape as image.
- Return type
numpy.ndarray