开发者

How to adjust the Brightness , contrast of an image?

How to adjust the Brightness , contrast of an image?

  • how to adjust the image brightness Normally for ex: it ranges from -255 to 255.

Now I want to increase the brightness by +100. By using the below formula I could able to find the b开发者_Python百科rightness of an image, but how to adjust/change

Brightness = (0.2126*nRed) + (0.7152*nGreen) + (0.0722*nBlue);

How should I approach further to achieve this?


Supposing you have your image as an array of pixel values (usually 0-255 in each of Red, Green and Blue), you could apply a simple scaling to each channel of each pixel in turn and see if this worked well enough. Be careful, you must be sure to catch overflowing values and clamp them to the highest possible brightness (and perhaps underflowing to lowest brightness as well, depending on how your pixels are represented).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜