Increasing Brightness/Contrast of an Image

Hi I was wondering how could I increase the brightness of a picture.

I would like to create the same effect as the image below.

Also is there some way to perhaps only have pixels that are above/below a certain grey level be brightened?

I’m quite new to OpenGL and so don’t really have any idea what I could use to do this. Any and all help is very welcome.

Thank you.

kiock,
Once you got the pixel data from the source image, you can modify each pixel by yourself.

The brightness is shifting the value of each pixel:
out[i] = in[i] + offset;

and contrast is modulation(scaling up/down the value):
out[i] = in[i] * scale;

Probably, you may need histogram streching or histogram equaliztion to enhance the input image.
This is a screenshot that I did before:

Thank you very much song!

I don’t completely understand this but I’ll have a look at my resources.

Do you suggest anywhere that has information on subjects such as this?

Thank you again.

kiock,
If you want to know about histogram method, please search “contrast(histogram) stretching” and “histogram equaliztion”. You will have many resources from the net.

Adjusting brightness and contrast is very easy as I described in the previous post, so you can easily implement into your program. Just watch out min and max values of the data type.

I can give you the source code of above example. Let me know if you are interested in.

Programs like Paint Shop Pro have a tool to increase the gamma. This is much better than
just increasing the brightness of every pixel. I think it is very easy to do. A gamma
table (256 values for each R,G,B component, so 256*3 total entries) is first calculated
for some given gamma value, say, 1.5, then every pixel is replaced with its gamma
table value entry. You can probably find some code on Google.

Hi,
I have created shader for brightness in QT, also I have draw an Image on shader but actualy my problem is how i will update the brightness value in Image??
Iam new User Of OpenGl Shader so rely Iam not getting any idea…
Please Reply me soon…

Thanks In Advance…

You felt the need to resurrect a 4-year-old thread to ask this question?