I’m a believer in the singular purpose of raw processors: process raw files to representative images. If I need to further manipulate an image, I fire up GIMP. Well mostly…
My first serious camera, the Nikon D7000, has a built-in flash. I used that flash extensively for family imaging, worked well except for the occasional red-eye. When it happened, it was pronounced, with particular attention to my poor niece, who looked like a demon in every picture. Since I wanted to make presentable proofs for others’ regard from rawproc, I capitulated to my principles and included a redeye tool, and put it to good use during that camera’s tenure.
Now, with the Nikon Z6, I’ve got a sort of dichotomous problem. It doesn’t have a built-in flash, and I haven’t yet bought one, so I find myself doing a lot of ambient light interior shots. All well and good if I set the white balance accordingly, but occasionally I run into a different problem. Here’s an illustration:
Yeah, the interior white balance is still a bit warm, but look out the window: yech. The frosted glass in the door shows the daylight color temperature in it’s full glory. Not nice.
We spent last weekend at a cabin in the mountains, and I shot a lot of interior images. And that pesky picture window is in a lot of them. I was about to power up GIMP and some @patdavid tutorials to do some layer masking, but I got to thinking about the situation: the regions of concern had a significant discriminator, that being a heavy bias in the blue channel. Bear-of-little-brain starts thinking, “how could I use that fact to segregate the ‘exterior pixels’ in a second application of white balance?”
Looking at the RGB values in the exterior pixels, I could reliably see a usable magnitude difference in the blue component from the next highest component. So I came up with a scheme that 1) builds a luminance from the mean of the three RGB values, then 2) divides the blue value by the luminance. That gives a magnitude that the blue is above the next highest value. Now I can use that to set a threshold in the white balance operator where, if that magnitude is greater than the threshold, apply the white balance multipliers.
Took about a half-hour to code that up enough to try it with the img command line processor. For expediency, I used that to process the above JPEG and lo, it works, albeit with a few artifacts. I am quite surprised, because I’ve tried to implement similar masked color manipulations for other purposes with horrible outcomes. Encouraged by the JPEG results, I incorporated the tool in rawproc, and found it gave an even better outcome when working from the raw starting point:
To get to this, I did the normal processing through the non-linear tone operator, with the camera-specified tungsten white balance. Then, I inserted another white balance tool and used the patch option on the frosted window to pick up the daylight multipliers. With that, I enabled the blue threshold checkbox and started dialing it up until the interior part of the image went back to the original white balance, in this case, about 1.2
This particular image shows a problem with this tool. Compare the stars on the nearest napkin in both the first and second renders. That leftmost star should be blue, but it gets caught up in the threshold for the exterior. If I dial up the threshold any more the star regains it’s proper color, but the exterior sky goes blue, which it definitely was not in the eastern sky twilight.
Yes, this is definitely a torx screwdriver sort of tool, made for a very specific purpose. I’m posting about it because 1) I can’t believe it works, and 2) wondering how such would be equivalently accomplished in the other FOSS processors we discuss here. In spite of it’s variance to my ‘singular purpose’ principle, I’m going to keep this tool. Well, at least until I buy a flash…
Edit: Images in this post are licensed Creative Commons, By-Attribution, Share-Alike.