Tuesday, July 26, 2016

OpenCV Matching Exposure across images

Leave a Comment

I was wondering if its possible to match the exposure across a set of images.

For example, lets say you have 5 images that were taken at different angles. Images 1-3,5 are taken with the same exposure whilst the 4th image have a slightly darker exposure. When I then try to combine these into a cylindrical panorama using (seamFinder with: gc_color, surf detection, MULTI_BAND blending,Wave correction, etc.) the result turns out with a big shadow in the middle due to the darkness from image 4.

I've also tried using exposureCompensator without luck.

Since I'm taking the pictures in iOS, I maybe could increase exposure manually when needed? But this doesn't seem optimal..

Have anyone else dealt with this problem?

2 Answers

Answers 1

This method is probably overkill (and not just a little) but the current state-of-the-art method for ensuring color consistency between different images is presented in this article from HaCohen et al.

Their algorithm can correct a wide range of errors in image sets. I have implemented and tested it on datasets with large errors and it performs very well.

But, once again, I suppose this is way overkill for panorama stitching.

Answers 2

Sunreef has provided a very good paper, but it does seem overkill because of the complexity of a possible implementation.

What you want to do is to equalize the exposure not on the entire images, but on the overlapping zones. If the histograms of the overlapped zones match, it is a good indicator that the images have similar brightness and exposure conditions. Since you are doing more than 1 stitch, you may require a global equalization in order to make all the images look similar, and then only equalize them using either a weighted equalization on the overlapped region or a quadratic optimiser (which is again overkill if you are not a professional photographer). OpenCV has a simple implmentation of a simple equalization compensation algorithm.

The detail::ExposureCompensator class of OpenCV (sample implementation of such a stitiching is here) would be ideal for you to use.

  1. Just create a compensator (try the 2 different types of compensation: GAIN and GAIN_BLOCKS)
  2. Feed the images into the compensator, based on where their top-left cornes lie (in the stitched image) along with a mask (which can be either completely white or white only in the overlapped region).
  3. Apply compensation on each individual image and iteratively check the results.

I don't know any way to do this in iOS, just OpenCV.

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment