Closed eroux closed 3 months ago
You can use the technique from here: https://github.com/letmaik/rawpy-notebooks/blob/master/colour-negative/colour-negative.ipynb
thanks! I actually implemented my own thing, admittedly not as clean but I just put it here for reference:
https://github.com/buda-base/scam/blob/c305c5f35ab0610be48ba7ddbedcc4fdb526bf60/raw_utils.py#L100
My use case is the following: I have a series of raw files (images of manuscripts) where the first image has a color card but not the following ones. I assume that the camera and settings are the same on all image and that the white balance factors for the first image should be applied to all other images.
dcraw
has a way to calculate the white balance based on pixel coordinates (through-A
in the command line). I suspect this is also something thatlibraw
has.My request is that there could be a new function like
get_wb(x, y, w, h)
that returns the list of 4 wb factors to use to get a white balance that would give a neutral color for the medial pixel in the area given in argument. I could then use that as theuser_wb
argument ofpostprocess
on all the images.I tried to get that through some linear interpolation after the postprocessing but unfortunately the result is pretty different (I'm not sure why yet). Being able to extract the wb factors would be the best way for me.