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?

  • 3
    This sounds like an X-Y problem. Given that the camera attempts to make a shot taken in bright sunlight have the same approximate tonal range as one taken on a cloudy day under the forest canopy, the end result images are far more similar than the original views. Exposure is the amount of adjustment your camera makes in shutter speed, signal amplification (ISO) and aperture to achieve that end. As such, if you really want to know the difference in exposure, the metadata is probably where you want to start, as analyzing the images themselves will be misleading at best. – twalberg Jan 9 '19 at 21:11
  • The images are all shot in raw using manual settings, so the files are generally consistent to the scene. The important changes are those to ambient light, which aren't expressed in a file's metadata. – James V Jan 9 '19 at 21:18
  • To clarify: you're attempting to use the image to figure out how bright the scene was, so as to compare the scene brightness between images? I'm genuinely curious, why does it even matter? – OnBreak. Jan 10 '19 at 0:32
  • The intention is to exactly match the exposure between two images. Eventually the frames would be used in a video, so any error would be very visible as flickering. – James V Jan 10 '19 at 0:41
  • 6
    You're not trying to match exposure. You're trying to match image brightness. Those are two very different things. Exposure is strictly the value of the combinations of sensitivity (ISO), aperture (Av), and exposure time/shutter speed (Tv). A given exposure value has nothing to do with how bright the scene is or how bright the result is.You can shoot under bright sunlight at ISO 100, f/2.8, 1/2 second and in a very dark cave at ISO 100, f/2.8, 1/2 second. One image will be pure white, the other will be solid black. Both were shot at EV 4. Both have the same exposure. – Michael C Jan 10 '19 at 4:01

Given the average luminance value of each frame L1 and L2, you can calculate the ratio of the exposure values EV1 and EV2 as

EV1/EV2 = log2(L1)/log2(L2)

And to convert that to "number of stops", use

nStops = log2(EV1/EV2)

And see Wikipedia for more details on this formulation.


If its film you can evaluate using an instrument called a densitometer. This device passes light through film and measures light loss due to absorption. These devices normally read out in logarithmic notation base 10. Whereas a 0.30 reading is 10 elevated to 0.3 power. This translates to a delta of 2x = 1 f-stop. A delta of 0.60 = 4X and 0.90 = 8X. Thus 0.05 = 1/6 f-stop --- 0.10 = 1/3 f-stop --- 0.20 = 2/3 f-stop --- 0.30 = 1 f-top --- 0.40 = 1 1/3 f-stops etc. For less accuracy, you can use an incident light meter to get data.

The above DD or density differences must be factored by the gamma of the film. The above values are based on a gamma of 1 = 45° slope angle of the straight line portion of the characteristic curve. Films normally sport a gamma of 0.8 thus the slope angle is generally only 38° thus 1 f-stop = 0.30 X 0.8 = 0.24 density delta per 1 f-stop. (typical pictorial film).

Speculating --- if this is a digital image, you might try displaying the image on screen and using an incident light meter, take a reading. The meter reads in f-stops. You need to experiment to find out how to interpolate the data.


There is no "exact number of stops between two given exposures" when "much of the difference will be due to ambient light changing". A change in ambient lighting cannot be expressed as a single scalar exposure difference. If it could, there would be no need to bother with things like white balance or most of metering strategies. Ambient light does not change in uniform manner. If it did, you could just work with a single image.

  • To further amplify: The brightest parts of the scene and the darkest parts of the scene probably will not change by the same number of stops when the ambient lighting changes. – Michael C Feb 20 at 8:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.