The
Gamma value is represented by a curve, which is an inductive curve of the human eye to light, including physical quantity, body sense, and mental perception.
1///<summary>
2///gamma correction
3///</summary>
4///<param name= "BMP" > Input Bitmap</param>
5///<param name= "val" >[0 <--1-Dark-> 2]</param>
6///<returns > Output BITMAP</RETURNS>
7 public static Bitmap Kigamma (Bitmap bmp, float val)
8 {
9 if (bmp = = NULL)
Ten {
return null;
14}
1 = no change, no
if (val = 1.00 00f) return BMP;
Try
{
Bitmap b = new Bitmap (BMP. Width, BMP. Height);
Graphics g = graphics.fromimage (b);
ImageAttributes attr = new ImageAttributes ();
attr. SetGamma (Val, Coloradjusttype.bitmap);
G.drawimage (BMP, New Rectangle (0, 0, BMP.) Width, BMP. Height), 0, 0, BMP. Width, BMP. Height, GraphicsUnit.Pixel, attr);
G.dispose ();
return B;
27}
Catch
29 {
return null;
31}
}