Combine Two Different Images With Different Gain Values

8 views (last 30 days)
Say you are given two images, both taken at the same time from the same detector.
Both images have 11 bit resolution (yes, its odd but that is the case here). The difference between the two images is that one image as been amplified by a factor of 1 and the other has been amplified by a factor of 10.
How can I take these two 11 bit images, and combine their pixel values to get a single 16 bit image? Basically, this increases the dynamic range of the final image.
I am fairly new to image processing. I know there is a solution for this, since other systems do this on the fly pixel-by-pixel in an FPGA. I was just hoping to be able to do this in Matlab post processing instead of live. I know doing bitwise operations in Matlab can be kinda difficult, but we do have an educational license with every toolbox available.
Thanks for the help!

Accepted Answer

Geoff on 11 Jun 2012
Here's what I'd do...
Convert all your images to 16-bit. Then take the factor-1 image, multiply it by 10. Then take the factor-10 mod it by 10 and add it to the scaled factor-1 image. This is assuming that your amplification power translates directly to pixel intensity.
result = factor1 * 10 + mod( factor10, 10 );
Note that scaling by a 10 will increase your maximum signal from 11 bits to about 14 bits (15 for saturated signals).
I've assumed that your factor-1 image has the best signal-to-noise ratio so you keep that, ditch the high end of the gained signal, and just add in the lower bits of it to get the extra precision. You might want to do it the other way and only keep only a few of the most significant bits from your ungained image, or you may want to take half of each or even average the overlapping segments. Start simple, and see if that's good enough before you make your life difficult.
PS: If your amplification was a power of 2, you might consider using bitshifts, bitwise & and |, instead of multiplication and modulo... But it's arguable whether, even then, you would get a performance benefit in MatLab.
Zach Dischner
Zach Dischner on 22 Jun 2012
Hi Geoff, yes your idea worked great. I'll be playing with it continually to tweak it just right.

Sign in to comment.

More Answers (0)


Find more on Image Processing and Computer Vision in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!