# Contrast Enhancement for subjects under Flash

For a machine vision application, we take short duration (50uSec) monochrome pictures with IR flash. The images we get are decent quality however the light color subjects (light blue, light green, yellow) are all lost or become less visible.

We convert these 10 bit images to 8 bit and look at them that way which already contributes to the problem. This is something we can probably solve with a non-linear 10-8 bit companding, so I am not worried about this part. If I look at the images on a display that supports 10 bit I still see them very very weak. My objective is to boost them.

In the raw data when I look at them, assuming surface average is 800 (pretty white), these light color subjects are 760-780 range, so the info is there but not visible. (A side note, if I take a picture of the same object under normal light with very long exposure time, 1msec, I see all details, so flash is also contributing to the problem).

What is the best way to gain these lost info back? We still have access to the 10 bit raw image data, what type of algorithm I can use to gain them back.

• Have you considered tone mapping? You can use it before quantization to 8 bits to keep most information retained. I think gradient domain or local contrast method gives strong enhancements. Another option is global adjustment using nonlinear mapping (contrast curve). – Libor Aug 25 '12 at 8:03
• @Libor I didn't but I am less concerned about the 10-8 bit mapping. I will implement some sort of non linear mapping that doesn't kill the least significant bits. My worry is even after this operation, the info will be weak or lost. My objective is to boost original 10 bit data. – Ktuncer Aug 25 '12 at 9:52
• Well this is what both remapping and tone mapping does. It will reorder the values in original image such that when quantized to 8 bits, most details are preserved. It can be done in 8 bits as well, but it why to cut off data prior to enhancement. The mapping and quantization can be also brought into a single step. If you post a sample image, I can try few algorithms to recover your data. – Libor Aug 25 '12 at 9:59
• @Libor is there a look up table I can use for 10-8 bit tone mapping. Or a ready made algorithm? I will post the image monday. – Ktuncer Aug 26 '12 at 4:26
• I have added the answer because it was too long for a comment. I will add images if supply them. – Libor Aug 26 '12 at 10:48

You can perform tone mapping on the source image and then convert the result to 8 bits.

Global tone mapping

Depends just on pixel values, i.e.

H[x,y] = G(I[x,y])


The output image pixel H[x,y] is just processed input pixel value using tone mapping operator G. This allows making lookup table holding all possible values (i.e. 0 - 1023 in 10-bit images).

Local tone mapping

Works on pixel values and their neighborhood, i.e.

H[x,y] = G(I, x, y)


These operators are more complex in nature, but yield more details in the resulting image.

Conversion

After applying tone mapping, the image can be converted to 8-bits easily:

O[x,y] = H[x,y] >> 2


Where (>> 2) is shift by two bits, or division by 4.

The conversion can be incorporated in tone mapping step, for example and entry for the look-up table in global tone mapping can be defined this way:

g[i] = (log2(i + 1) * 102.3) >> 1


Note that the operator is a log curve adjusted for range of input values to 0-1023. The operator also contains conversion to 8-bits.

Samples