views:

325

answers:

1

I have a grayscale image from a photograph. I've determined that certain parts of the image are underilluminated, and that a pixel with luminance Y = 0.8 should actually be adjusted to 90% grey, i.e., that pixel should be given luminance 0.9. My question is how do I scale the other pixels nearby? I'm pretty sure multiplying all the luminances by 9/8 is wrong, because I vaguely remember hearing that in order to look uniform, the scaling has to be nonlinear. But I'm having trouble finding an equation that would enable me to make progress. (Of course I am actually writing a program to make this adjustment to a great many photographs.)

The source of my pixels is the pbmplus PGM format, about which the man page says:

Each gray value is a number proportional to the intensity of the pixel, adjusted by the CIE Rec. 709 gamma transfer function. (That transfer function specifies a gamma number of 2.2 and has a linear section for small intensities). A value of zero is therefore black. A value of Maxval represents CIE D65 white and the most intense value in the image and any other image to which the image might be compared.

If I understood this better I would probably have a better idea how to proceed.

I found a related question on making an image of uniform brightness.


Thanks Shmoopty for getting me on track. I accepted your answer then added some info to it.

+1  A: 
Shmoopty
Choosing what value for gamma? And does it matter that the pixels I have are already gamma-encoded?
Norman Ramsey