0

I have a stack of image tiles (taken from a drone) that I want to mosaic to a single image. I want to do exposure compensation to reduce the variation in illumination between the image tiles before mosaicking due to variations within each image. I have seen the following formula used for such a task: exposure compensation

where:

p' is the correct pixel

p is the original uncorrected pixel

k is the aperture F number

t is the exposure time

K is the ISO

From my EXIF metadata data I am getting the following values:

k = 2.200000078

t = 0.002007692122

K = 100

This gives me a correction factor of 24.1072836326 (based on the above equation), which if I use to multiple against all the pixels (p) in the image, results in a drastic change in pixel values (p'). Is there something I am doing incorrectly here? For example are my units correct?

  • 1
    I don't get this at all. The "correct" pixel? What does it mean to multiply a pixel? What are you multiplying? And if you have some multiplication factor that is calculated on a per-pixel basis...oh I don't know. In summary, what?! – osullic Dec 15 '17 at 16:08
  • Were all of the images taken under the same lighting conditions? Or at different times under different lighting? – Michael C Dec 15 '17 at 16:15
  • You might need to convert the shutter time from a decimal value (0.002007692122) to the denominator of a 1/x fractional value (500) – Michael C Dec 15 '17 at 16:17
  • Taken under varying lighting conditions; i.e. intermittent cloud, direct sunlight, varying solar elevation – Landini135 Dec 16 '17 at 12:19
1

Q: "How do I compensate the exposure of a bunch of photos so I can stitch them together?".

I too disagree with the formula, shouldn't it be: p' = p + (p * (k^2)/(t*k)) ? [Note: You would want to correct "t" as mentioned above in @Michael Clark 's comment.]

In any event, your "compensation method" is to simply make every pixel in a particular photo a bit darker or a bit brighter, evening them out, and then stitching them together.

Look at a block diagram for the OpenCV Stitching Demo:

Block Diagram of Stitching

See? (your method won't produce beautiful and perfect results, in it's current form).

  • First (well, I'll start there) you need Registration Data (yellow block in the middle).

  • The Registration Data goes to "Warp Images", one of which goes to "Estimate Exposure Errors", and then "Compensate Exposure Errors".

  • Then the warped and compensated images are blended.

You can view the source code to see how the formula is implemented.

You can simply download a Windows executable from SourceForge to save some reading, learning and compiling.

There are many other free Stitching Programs, most with source code available.

I suggest that your formula will produce this sort of result:

Stitching lines visible

Instead, you probably want this sort of result:

OpenCV Stitching Demo result

0

Is there something I am doing incorrectly here?

Yes. You are assuming the view in each image should have an equal average brightness. But when you point the camera in different directions under the same lighting conditions you are changing the compositions of the scene. You may be capturing less bright sky and more dark foreground. Or you may be capturing less light colored grass and more dark colored trees.You can't expect the entirety of each image to have the same average brightness when each image is taken pointed in different directions at different objects.

The most effective way to avoid this problem is to set exposure to the same value for all of the frames before you take the images (i.e. manual exposure or exposure lock). Since you did not do that, your best bet is to adjust the relative exposure of each frame to compensate for differences in exposure when the images were taken. That is, you need to select the exposure value in one frame and then normalize all of the other frames by compensating for the differences in ISO, shutter time, and aperture to the exposure value in your selected image.

  • isn't that exactly what the formula is supposed to do? for me it looks like it is normalizing for variations in exposure settings. – ths Dec 15 '17 at 16:25
  • No, because different things are different brightnesses. If you want everything to be the exact same brightness all you'll have is a solid gray image. – Michael C Dec 15 '17 at 16:26
  • the formula applies a constant exposure correction factor to all pixels of an image. the factor is only dependent on the exposure parameters. – ths Dec 15 '17 at 17:52
  • @ths the formula, if correct, would be useful for normalizing images of the exact same field of view shot at different exposures. But when the field of view is altered and the exposures are "averaged" to match, the same points that are included in both fields of view will almost certainly wind up with different brightnesses. A point with medium brightness with very bright things to one side and very dim things to the other will show up in a frame that mostly includes the dim things as very bright, but will show up as dim in a frame that includes mostly the brighter parts of the scene. – Michael C Dec 16 '17 at 9:06

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.