ptypy.utils.scripts.hdr_image#

ptypy.utils.scripts.hdr_image(img_list, exp_list, thresholds=[3000, 50000], dark_list=[], avg_type='highest', mask_list=[], ClipLongestExposure=False, ClipShortestExposure=False)#

Generate a high dynamic range image from a list of images img_list and corresponding exposure information in exp_list.

Parameters:
  • img_list (list) – Sequence of images (as 2d np.ndarray)

  • exp_list (list of float) – Associated exposures to each element of above sequence img_list

  • thresholds (list, 2-tuple) – Tuple of lower limit (noise floor) and upper limit (overexposure) in the images.

  • dark_list (list) – Single frame or sequence of dark images (as 2d np.array) of the same length as img_list. These frames are used for dark-field correction

  • avg_type (str) –

    Type of combining all valid pixels:

    • ’highest’, the next longest exposure is used to replace overexposed pixels.

    • <other_string>, overexposed pixels are replaced by the pixel average of all other images with valid pixel values for that pixel.

  • mask_list (list) – Single frame or sequence of 2d np.array. Provide additional masking (dead pixels, hot pixels)

  • ClipLongestExposure (bool) – If True, also mask the noise floor in the longest exposure.

  • ClipShortestExposure (bool) – if True, also mask the overexposed pixels in the shortest exposure.

Returns:

out – Combined hdr-image with shape of one of the frame in img_list

Return type:

ndarray

Examples

>>> from ptypy import io
>>> dark_list, meta = io.image_read('/path/to/dark/images/ccd*.raw')
>>> img_list, meta= io.image_read('/path/to/images/ccd*.raw')
>>> exp_list = [meta[j]['exposure_time__key'] for j in range(len(meta))]
>>> hdr, masks = hdr_image(img_list, exp_list, dark_list=dark_list)