I am building an android app which provides the user with some image processing functionalities. But before applying any image transformation function I would like to do gamma correction to improve the image. I know how to perform the gamma correction but I don't know what gamma value to use as the image itself doesn't have the gamma value with which the image was created. Any information regarding how to select a gamma value for a particular image will be very helpful.
Asked
Active
Viewed 2,482 times
3
-
Most images are already created with the standard gamma of 2.2, because they'd look too light or dark if they weren't. Any application of gamma beyond that is purely subjective. Why do you think your images could be improved with a gamma function? – Mark Ransom Oct 02 '12 at 16:17
-
1If the exposure is low the captured image will be dark and the details won't be visible if I apply a gamma lower than 1 then it will make the image brighter with details visible and for very brighter image a gamma value greater than 1 will help...but i donot want the user to do these adjustments. The application should do it for the user as it happens in most of the digital cameras. Now selecting gamma value is the issue? – karn Oct 02 '12 at 17:34
1 Answers
2
It appears that what you really want is to lighten or darken the average brightness of an image to match some optimum value. Yes, the gamma function can do that. It might not be the best choice, in fact for under or over exposure a simple linear multiplication might be better. But let's stick with gamma for now.
Measure the average brightness of the image and call it a
, with values from 0-255. You have a target for the optimum brightness, let's call that t
. If the unknown gamma is g
then you get:
t/255 = (a/255)^g
Solving for g
gives:
g = log(t/255) / log(a/255)

Mark Ransom
- 299,747
- 42
- 398
- 622
-
-
@karn, you'll have to experiment and find that for yourself. I'd start at 186 which is the middle value. – Mark Ransom Oct 03 '12 at 13:41
-
yes a littl bit of play around with the values is be required to obtain the optimum value for this..by the way brightness is subjective so there could not be a perfect unique value for this.. Your answer gave me a start...thanks... – karn Oct 03 '12 at 17:45