Hi,
I have RAW images that I want to put into the XYZ linear space to then add them together and make sense of it.
At some point, I need to get a map of which pixels are saturated, but with my actual setup it doesn’t look right.
I would like advice on what you think should be right.
I tried 2 things on my DNG files:
-
applying a treshold before the processing on the raw image (not processed in any way), but this treshold depends on the white level in the DNG tags. (I then align the mask shape with the halfsize process from rawpy) and sometimes I have a lot of pixels that seem to saturate but not at this white level:
with rawpy.imread(str(path)) as raw:
black = np.mean(raw.black_level_per_channel)
wl = raw.white_level #clip_level(raw, min_pixels=64)
bayer = raw.raw_image_visible
sat_b = bayer >= black + 0.98 * (wl - black)
cam = raw.postprocess(
gamma=(1, 1),
no_auto_bright=True,
adjust_maximum_thr=0,
output_bps=16,
use_camera_wb=False, # whether to use the as-shot white balance values
use_auto_wb=False, # whether to try automatically calculating the white balance
user_wb=[1.0, 1.0, 1.0, 1.0],
output_color=rawpy.ColorSpace.raw, # RGB captor
half_size=half_size, # outputs image in half size by reducing each 2x2 block to one pixel instead of interpolating (linear)
) -
Doing a treshold after the processing in the XYZ space:
saturation = (cam/65535).max(axis=-1) >= 0.98