This question regards exposure. I have a project I am working on where I need to be able to calculate the exact number of stops between two given exposures, with the end goal being to match the exposure of the two frames. Using metadata to match exposures isn't possible as much of the difference will be due to ambient light changing.
I initially tried calculating average luminosity across each of the two frames, but due to the fact that exposure is a effectively multiplier on each individual pixel (and thus summing the pixels and multiplying from that value is not equivalent), this technique led to very significant error.
I can adjust one of the images using trial and error visually to approximate the value (just fiddling a slider in RawTherapee), but that's neither accurate enough, nor fast enough (hundreds of frames will be processed). If an intelligent (i.e. not brute forced) method of achieving the same goal does exist, I will be able to run it automatically through a small script.
Does anyone know an accurate mathematical way to calculate the difference in exposure in stops between two frames?