Balancing contrast and brightness between stitched images
Asked Answered
M

2

7

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?

Mohamedmohammad answered 20/12, 2012 at 18:57 Comment(0)
C
4

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.

Cardoza answered 21/12, 2012 at 13:47 Comment(1)
Can you by any chance show me an practical example? I understand the concepts, but implementationwise in OpenCV im a bit lost.Mohamedmohammad
F
4

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

Flee answered 9/1, 2013 at 15:54 Comment(3)
Could you share the code. I have tried this and couldn't manage it to work!Gillum
I'm also trying to get this done. Fore more info it is implemented in the stitching_detailed.cpp example from the cpp sample projects.Penang
I wonder the corners could always be (0,0) or something else.Vitiate

© 2022 - 2024 — McMap. All rights reserved.