enhance module

rawpy.enhance.find_bad_pixels(paths, find_hot=True, find_dead=True, confirm_ratio=0.9)

Find and return coordinates of hot/dead pixels in the given RAW images.

The probability that a detected bad pixel is really a bad pixel gets higher the more input images are given. The images should be taken around the same time, that is, each image must contain the same bad pixels. Also, there should be movement between the images to avoid the false detection of bad pixels in non-moving high-contrast areas.

Parameters:
  • paths (iterable of str) – paths to RAW images shot with the same camera

  • find_hot (bool) – whether to find hot pixels

  • find_dead (bool) – whether to find dead pixels

  • confirm_ratio (float) – ratio of how many out of all given images must contain a bad pixel to confirm it as such

Returns:

coordinates of confirmed bad pixels

Return type:

ndarray of shape (n,2) with y,x coordinates relative to visible RAW size

rawpy.enhance.repair_bad_pixels(raw, coords, method='median')

Repair bad pixels in the given RAW image.

Note that the function works in-place on the RAW image data. It has to be called before postprocessing the image.

Parameters:
  • raw (rawpy.RawPy) – the RAW image to repair

  • coords (array-like) – coordinates of bad pixels to repair, array of shape (n,2) with y,x coordinates relative to visible RAW size

  • method (str) – currently only ‘median’ is supported

rawpy.enhance.save_dcraw_bad_pixels(path, bad_pixels)

Save the given bad pixel coordinates in dcraw file format.

Note that timestamps cannot be set and will be written as zero.

Parameters:
  • path (str) – path of the badpixels file that will be written

  • bad_pixels (array-like) – array of shape (n,2) with y,x coordinates relative to visible image area