Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Balancing contrast and brightness between stitched images

I'm working on an image stitching project, and I understand there's different approaches on dealing with contrast and brightness of an image. I could of course deal with this issue before I even stitched the image, but yet the result is not as consistent as I would hope. So my question is if it's possible by any chance to "balance" or rather "equalize" the contrast and brightness in color pictures after the stitching has taken place?

like image 501
JavaCake Avatar asked Dec 20 '12 18:12

JavaCake


2 Answers

You want to determine the histogram equalization function not from the entire images, but on the zone where they will touch or overlap. You obviously want to have identical histograms in the overlap area, so this is where you calculate the functions. You then apply the equalization functions that accomplish this on the entire images. If you have more than two stitches, you still want to have global equalization beforehand, and then use a weighted application of the overlap-equalizing functions that decreases the impact as you move away from the stitched edge.

Apologies if this is all obvious to you already, but your general question leads me to a general answer.

like image 101
dvhamme Avatar answered Oct 20 '22 20:10

dvhamme


You may want to have a look at the Exposure Compensator class provided by OpenCV.

Exposure compensation is done in 3 steps:

  1. Create your exposure compensator

    Ptr<ExposureCompensator> compensator = ExposureCompensator::createDefault(expos_comp_type);

  2. You input all of your images along with the top left corners of each of them. You can leave the masks completely white by default unless you want to specify certain parts of the image to work on.

    compensator->feed(corners, images, masks);

  3. Now it has all the information of how the images overlap, you can compensate each image individually

    compensator->apply(image_index, corners[image_index], image, mask);

The compensated image will be stored in image

like image 34
DevGoldm Avatar answered Oct 20 '22 19:10

DevGoldm