Yesterday to the customer to test, the need to start, so very simple, is to test if you can accept the video or pictures, and then save it, the site customers said brightness is not enough, and then learn a C # adjust the brightness of the picture, record
Learn the post in this: http://blog.csdn.net/kenkao/article/details/3148091
/// <summary> ///Image Brightness Adjustment/// </summary> /// <param name= "B" >Original Diagram</param> /// <param name= "degree" >brightness [ -255, 255]</param> /// <returns></returns> Public StaticBitmap Kilighten (Bitmap B,intdegree) { if(b = =NULL) { return NULL; } if(Degree <-255) degree =-255; if(Degree >255) degree =255; Try { intwidth =B.width; intHeight =B.height; intPIX =0; BitmapData Data= B.lockbits (NewRectangle (0,0, width, height), imagelockmode.readwrite, Pixelformat.format24bpprgb); unsafe { byte* p = (byte*) data. Scan0; intoffset = data. Stride-width *3; for(inty =0; Y < height; y++) { for(intx =0; x < width; X + +) { //handles the brightness of pixels at the specified position for(inti =0; I <3; i++) {pix= P[i] +degree; if(Degree <0) P[i] = (byte) Math.max (0, pix); if(Degree >0) P[i] = (byte) Math.min (255, pix); } //Ip + =3; } //xp + =offset; } //y} b.unlockbits (data); returnb; } Catch { return NULL; } } //End of LightenView Code
and then call
string @" C:\Users\wjr\Desktop\ for Business \1.png " ; New Bitmap (@ "C:\Users\wjr\Desktop\ for Business \windowsformsapplication1\windowsformsapplication1\ windowsformsapplication1\bin\release\capture\20170417 025826019.png"); - ); A.save (Savepath);
Bitmap a = Kilighten (img, +);
I set here is 20, the range is -255~255, so 0 is the original picture brightness, I set the 20, so the picture brightness thought to show not obvious, I get a 100, look at the effect
C # adjusts picture brightness