ShowCameraControl.cs 66 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Drawing;
  5. using System.Data;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using PaintDotNet.Base.SettingModel;
  11. using System.Collections;
  12. using PaintDotNet.ImageCollect.CameraManager;
  13. using TUCAMAPI;
  14. using TUCamera;
  15. using OpenCvSharp;
  16. namespace PaintDotNet.Setting.LabelComponent
  17. {
  18. /// <summary>
  19. /// 相机设置,调节界面
  20. /// </summary>
  21. public class ShowCameraControl : UserControl
  22. {
  23. #region 控件
  24. /// <summary>
  25. /// 增益值下拉选
  26. /// </summary>
  27. string[] gainArray = new string[] { "高增益", "低增益"};
  28. /// <summary>
  29. /// 相机参数的Model
  30. /// </summary>
  31. private CameraParamModel m_cameraParamModel;
  32. private bool m_immediately;
  33. private TUCamera.TUCamera m_camera;
  34. public PictureBox pictureBox1;
  35. private CustomControl.SelectButton logButton;
  36. private CustomControl.SelectButton skipButton;
  37. private GroupBox groupBox5;
  38. private Button button2;
  39. private Button button3;
  40. private Button button4;
  41. private Button button5;
  42. private CheckBox xianshiColourCheckBox;
  43. private TrackBar redChannelTB;
  44. private Label label7;
  45. private TrackBar greenChannelTB;
  46. private Label label8;
  47. private Label label9;
  48. private TrackBar blueChannelTB;
  49. private Label label10;
  50. private Label label11;
  51. private Label label12;
  52. private PictureBox lanlvpictureBox;
  53. private PictureBox hongsepictureBox;
  54. private PictureBox yanghongsepictureBox;
  55. private PictureBox lvsepictureBox;
  56. private PictureBox huangsepictureBox;
  57. private PictureBox lansepictureBox;
  58. private GroupBox groupBox3;
  59. private TrackBar trbGain;
  60. private Label lblGainMax;
  61. private Label lblGainMin;
  62. private TextBox txtGain;
  63. private GroupBox groupBox2;
  64. private Label label6;
  65. private Label lblBaoGuangMinVal;
  66. private Label lblBaoGuangMaxVal;
  67. private Label label4;
  68. private Label label3;
  69. private TextBox baoGuangPertBox;
  70. private TextBox baoGuangTBox;
  71. private Label unitLabel;
  72. private Label unitPerLabel1;
  73. private CheckBox checkBoxAutoExposure;
  74. private GroupBox groupBox1;
  75. private Label label5;
  76. private TrackBar baoGuangPerTBar;
  77. private TrackBar baoGuangTBar;
  78. private TrackBar baoheduTBar;
  79. private Label lblSaturationMaxVal;
  80. private Label label13;
  81. private TextBox baoheduTBox;
  82. private Label lblSaturationMinVal;
  83. private GroupBox groupBox4;
  84. private System.Timers.Timer m_aeTimer;
  85. #endregion
  86. public ShowCameraControl(CameraParamModel model, bool immediately)
  87. {
  88. m_cameraParamModel = model;
  89. m_immediately = immediately;
  90. m_camera = TUCameraManager.GetInstance().GetCurrentCamera();
  91. InitializeComponent();
  92. }
  93. public void ResetCameraParamModel(CameraParamModel model)
  94. {
  95. m_cameraParamModel = model;
  96. }
  97. int resolution_width = 2448;
  98. int resolution_height = 2048;
  99. TUCameraIFrameProcess m_process = null;
  100. //#17904
  101. private OpenCvSharp.Mat m_mat;
  102. /// <summary>
  103. /// 一个矩阵数组,用来接收直方图,记得全部初始化
  104. /// </summary>
  105. Mat[] oldHists = new Mat[] { new Mat(), new Mat(), new Mat() };
  106. /// <summary>
  107. /// 灰度图
  108. /// </summary>
  109. private bool isGray = true;
  110. /// <summary>
  111. /// BGR线条颜色
  112. /// </summary>
  113. private Scalar[] color = new Scalar[] { new Scalar(255, 0, 0, 255), new Scalar(0, 255, 0, 255), new Scalar(0, 0, 255, 255) };
  114. /// <summary>
  115. /// skip按钮
  116. /// 显示直方图时,忽略黑色的灰度或颜色值。
  117. /// 这使您可以为背景为黑色的图像实现有意义的直方图显示。
  118. /// </summary>
  119. /// <param name="sender"></param>
  120. /// <param name="e"></param>
  121. private void skipButton_Click(object sender, EventArgs e)
  122. {
  123. if (m_mat == null)
  124. {
  125. //MessageBox.Show("请打开图片");
  126. return;
  127. }
  128. //设置按钮的选中/非选择的状态
  129. skipButton.BtnSelect = !skipButton.BtnSelect;
  130. //this.AppWorkspace.ActiveDocumentWorkspace.HistogramSkipEnabled = skipButton.BtnSelect;
  131. updateHistImg(null);
  132. }
  133. /// <summary>
  134. /// log按钮
  135. /// 以对数比例显示直方图
  136. /// </summary>
  137. /// <param name="sender"></param>
  138. /// <param name="e"></param>
  139. private void logButton_Click(object sender, EventArgs e)
  140. {
  141. if (m_mat == null)
  142. {
  143. //MessageBox.Show("请打开图片");
  144. return;
  145. }
  146. //设置按钮的选中/非选择的状态
  147. logButton.BtnSelect = !logButton.BtnSelect;
  148. //this.AppWorkspace.ActiveDocumentWorkspace.HistogramLogEnabled = logButton.BtnSelect;
  149. updateHistImg(null);
  150. }
  151. /// <summary>
  152. /// 绘制
  153. /// </summary>
  154. /// <param name="pBuf"></param>
  155. /// <param name="obj"></param>
  156. public void CallbackDraw(byte[] pBuf, object obj, int channel)
  157. {
  158. lock (obj)
  159. {
  160. //m_isWaiting = false;
  161. Console.WriteLine("接收全图buf");
  162. m_camera.m_drawAllHandler -= new DrawAllHandler(CallbackDraw);
  163. OpenCvSharp.Mat mat;
  164. if (channel == 1)
  165. {
  166. mat = new OpenCvSharp.Mat(resolution_height, resolution_width/*m_resolution.Height, m_resolution.Width*/, OpenCvSharp.MatType.CV_8UC1, pBuf);
  167. }
  168. else
  169. {
  170. mat = new OpenCvSharp.Mat(resolution_height, resolution_width/*m_resolution.Height, m_resolution.Width*/, OpenCvSharp.MatType.CV_8UC3, pBuf);
  171. }
  172. OpenCvSharp.Cv2.Flip(mat, mat, 0);
  173. if (m_mat != null)
  174. {
  175. m_mat.Dispose();
  176. }
  177. m_mat = mat.Clone();
  178. //this.pictureBox1.Image = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(mat);
  179. stopDrawing();
  180. if (mat != null)
  181. {
  182. mat.Dispose();
  183. }
  184. this.showHistImg(m_mat);
  185. }
  186. }
  187. private void showHistImg(Mat BoxMat)
  188. {
  189. Mat[] mats = Cv2.Split(BoxMat);//一张图片,将panda拆分成3个图片装进mat
  190. if (mats.Count() == 1)
  191. {
  192. isGray = true;
  193. }
  194. else
  195. {
  196. isGray = false;
  197. }
  198. if (isGray)
  199. {
  200. Mat[] mats011 = new Mat[] { mats[0] };//panda的第一个通道,也就是B
  201. int[] channels011 = new int[] { 0 };//一个通道,初始化为通道0,这些东西可以共用设置一个就行
  202. int[] histsize11 = new int[] { 256 };//一个通道,初始化为256箱子
  203. Rangef[] range11 = new Rangef[1];//一个通道,范围
  204. range11[0].Start = 0.0F;//从0开始(含)
  205. range11[0].End = 256.0F;//到256结束(不含)
  206. Mat mask11 = new Mat();//不做掩码
  207. Cv2.CalcHist(mats011, channels011, mask11, oldHists[0], 1, histsize11, range11);//对被拆分的图片单独进行计算
  208. updateHistImgGray(oldHists);
  209. return;
  210. }
  211. Mat[] mats0 = new Mat[] { mats[0] };//panda的第一个通道,也就是B
  212. Mat[] mats1 = new Mat[] { mats[1] };//panda的第二个通道,也就是G
  213. Mat[] mats2 = new Mat[] { mats[2] };//panda的第三个通道,也就是R
  214. int[] channels0 = new int[] { 0 };//一个通道,初始化为通道0,这些东西可以共用设置一个就行
  215. int[] channels1 = new int[] { 0 };
  216. int[] channels2 = new int[] { 0 };
  217. int[] histsize = new int[] { 256 };//一个通道,初始化为256箱子
  218. Rangef[] range = new Rangef[1];//一个通道,范围
  219. range[0].Start = 0.0F;//从0开始(含)
  220. range[0].End = 256.0F;//到256结束(不含)
  221. Mat mask = new Mat();//不做掩码
  222. Cv2.CalcHist(mats0, channels0, mask, oldHists[0], 1, histsize, range);//对被拆分的图片单独进行计算
  223. Cv2.CalcHist(mats1, channels1, mask, oldHists[1], 1, histsize, range);//对被拆分的图片单独进行计算
  224. Cv2.CalcHist(mats2, channels2, mask, oldHists[2], 1, histsize, range);//对被拆分的图片单独进行计算
  225. for (int h = 0; h < oldHists[0].Rows; h++)
  226. {
  227. for (int j = oldHists.Length - 1; j >= 1; j--)
  228. {
  229. if (oldHists[j].At<float>(h) != oldHists[0].At<float>(h))
  230. {
  231. isGray = false;
  232. break;
  233. }
  234. }
  235. if (!isGray)
  236. break;
  237. }
  238. updateHistImg(oldHists);
  239. }
  240. /// <summary>
  241. /// 绘制直方图-单通道
  242. /// </summary>
  243. /// <param name="hist"></param>
  244. /// <returns></returns>
  245. private unsafe void updateHistImgGray(Mat[] hists)
  246. {
  247. if (m_mat == null)
  248. {
  249. return;
  250. }
  251. Mat[] mats = Cv2.Split(m_mat);//一张图片,将panda拆分成3个图片装进mat
  252. //if (mats.Count() == 1)
  253. //{
  254. // isGray = true;
  255. //}
  256. //else
  257. //{
  258. // isGray = false;
  259. //}
  260. Mat[] mats0 = new Mat[] { mats[0] };//panda的第一个通道,也就是B
  261. //Mat[] mats1 = new Mat[] { mats[1] };//panda的第二个通道,也就是G
  262. //Mat[] mats2 = new Mat[] { mats[2] };//panda的第三个通道,也就是R
  263. if (hists == null)
  264. {
  265. hists = new Mat[] { new Mat()/*, new Mat(), new Mat()*/ };//一个矩阵数组,用来接收直方图,记得全部初始化
  266. int[] channels0 = new int[] { 0 };//一个通道,初始化为通道0,这些东西可以共用设置一个就行
  267. //int[] channels1 = new int[] { 0 };
  268. //int[] channels2 = new int[] { 0 };
  269. int[] histsize = new int[] { 256 };//一个通道,初始化为256箱子
  270. Rangef[] range = new Rangef[1];//一个通道,范围
  271. range[0].Start = 0.0F;//从0开始(含)
  272. range[0].End = 256.0F;//到256结束(不含)
  273. Mat mask = new Mat();//不做掩码
  274. Cv2.CalcHist(mats0, channels0, mask, hists[0], 1, histsize, range);//对被拆分的图片单独进行计算
  275. //Cv2.CalcHist(mats1, channels1, mask, hists[1], 1, histsize, range);//对被拆分的图片单独进行计算
  276. //Cv2.CalcHist(mats2, channels2, mask, hists[2], 1, histsize, range);//对被拆分的图片单独进行计算
  277. if (logButton.BtnSelect)
  278. {
  279. //取对数
  280. for (int j = 0; j < hists.Length; j++)
  281. {
  282. List<float> ProbPixel = new List<float>();
  283. for (int i = 0; i < hists[j].Rows; i++)
  284. {
  285. if (((float*)hists[j].Ptr(0))[i] == 0)
  286. {
  287. ((float*)hists[j].Ptr(0))[i] = ((float*)hists[j].Ptr(0))[i];
  288. ProbPixel.Add(0);
  289. }
  290. else
  291. {
  292. ((float*)hists[j].Ptr(0))[i] = (float)Math.Log10(((float*)hists[j].Ptr(0))[i]/* + 9*/);
  293. ProbPixel.Add(1);
  294. }
  295. }
  296. double max1jVal = 0;
  297. double min1jVal = 0;
  298. //找到直方图中的最大值和最小值
  299. Cv2.MinMaxLoc(hists[j], out min1jVal, out max1jVal);
  300. if (min1jVal >= max1jVal)
  301. {
  302. continue;
  303. }
  304. //归一化到0~255,并根据AxioVision添加偏置值
  305. for (int i = 0; i < hists[j].Rows; i++)
  306. {
  307. ((float*)hists[j].Ptr(0))[i] = (float)((((float*)hists[j].Ptr(0))[i] - 0) * 255.0 / (max1jVal - 0)) + (float)(min1jVal > 0 ? (ProbPixel[i] * min1jVal * 255.0 / max1jVal) : ProbPixel[i] * 5);
  308. }
  309. }
  310. }
  311. if (skipButton.BtnSelect)
  312. {
  313. //去掉黑色部分 和 白色部分
  314. for (int j = 0; j < hists.Length; j++)
  315. {
  316. ((float*)hists[j].Ptr(0))[0] = 0;
  317. ((float*)hists[j].Ptr(0))[255] = 0;
  318. }
  319. }
  320. }
  321. //double max2Val = 0;
  322. //double max1Val = 0;
  323. double max0Val = 0;
  324. double minVal = 0;
  325. //为了更好显示直方图细节,使用4倍尺寸绘制直方图
  326. int histSize = hists[0].Rows * 4;
  327. Mat histImg = new Mat(histSize, histSize, MatType.CV_8UC3, new Scalar(255, 255, 255));
  328. //找到直方图中的最大值和最小值
  329. //Cv2.MinMaxLoc(hists[2], out minVal, out max2Val);
  330. //Cv2.MinMaxLoc(hists[1], out minVal, out max1Val);
  331. Cv2.MinMaxLoc(hists[0], out minVal, out max0Val);
  332. double maxVal = max0Val;// Math.Max(max2Val, Math.Max(max0Val, max1Val));
  333. if (maxVal < 1)
  334. return;
  335. // 设置最大峰值为图像高度的90%
  336. double hpt = 0.9 * histSize;
  337. //灰度图的显示直方图较为简单,显示一个通道即可
  338. if (isGray)
  339. {
  340. Mat hist = hists[0];
  341. int lastY2 = histSize - 1;
  342. for (int h = 0; h < hists[0].Rows; h++)
  343. {
  344. int intensity = (int)(hist.At<float>(h) * hpt / maxVal);
  345. int lastY1 = lastY2;
  346. lastY2 = histSize - intensity - 1 - (hist.At<float>(h) > 0 ? 4 : 0);
  347. if (lastY2 < lastY1)
  348. {
  349. Cv2.Line(histImg, new OpenCvSharp.Point(h * 4, lastY1), new OpenCvSharp.Point(h * 4, Math.Min(lastY2, lastY1 - 2)), new Scalar(0, 0, 0, 255), 2, LineTypes.Link4);
  350. }
  351. else
  352. {
  353. Cv2.Line(histImg, new OpenCvSharp.Point(h * 4, lastY1), new OpenCvSharp.Point(h * 4, Math.Max(lastY2, lastY1 + 2)), new Scalar(0, 0, 0, 255), 2, LineTypes.Link4);
  354. }
  355. }
  356. }
  357. //彩度图显示BGR三个通道的直方图
  358. else
  359. {
  360. int lineWidth = 2;
  361. for (int j = hists.Length - 1; j >= 0; j--)
  362. {
  363. Mat hist = hists[j];
  364. int lastY2 = histSize - 1;
  365. for (int h = 0; h < hists[0].Rows; h++)
  366. {
  367. int intensity = (int)(hist.At<float>(h) * hpt / maxVal);
  368. int lastY1 = lastY2;
  369. lastY2 = histSize - intensity - 1 - (hist.At<float>(h) > 0 ? 4 : 0);
  370. if (h > 0)
  371. {
  372. //显示0.5位置的直方图,这样与AxioVision效果更加近似
  373. int lasty12 = (lastY1 + lastY2) / 2;
  374. if (lasty12 < lastY1)
  375. {
  376. Cv2.Line(histImg, new OpenCvSharp.Point(h * 4 - 2, lastY1), new OpenCvSharp.Point(h * 4 - 2, Math.Min(lasty12, lastY1 - 2)), color[j], lineWidth, LineTypes.Link4);
  377. }
  378. else
  379. {
  380. Cv2.Line(histImg, new OpenCvSharp.Point(h * 4 - 2, lastY1), new OpenCvSharp.Point(h * 4 - 2, Math.Max(lasty12, lastY1 + 2)), color[j], lineWidth, LineTypes.Link4/*AntiAlias*/);
  381. }
  382. if (lastY2 < lasty12)
  383. {
  384. Cv2.Line(histImg, new OpenCvSharp.Point(h * 4, lasty12), new OpenCvSharp.Point(h * 4, Math.Min(lastY2, lasty12 - 2)), color[j], lineWidth, LineTypes.Link4);
  385. }
  386. else
  387. {
  388. Cv2.Line(histImg, new OpenCvSharp.Point(h * 4, lasty12), new OpenCvSharp.Point(h * 4, Math.Max(lastY2, lasty12 + 2)), color[j], lineWidth, LineTypes.Link4/*AntiAlias*/);
  389. }
  390. }
  391. else
  392. {
  393. //灰度值为0的线的绘制
  394. if (lastY2 < lastY1)
  395. {
  396. Cv2.Line(histImg, new OpenCvSharp.Point(h * 4, lastY1), new OpenCvSharp.Point(h * 4, Math.Min(lastY2, lastY1 - 2)), color[j], lineWidth, LineTypes.Link4);
  397. }
  398. else
  399. {
  400. Cv2.Line(histImg, new OpenCvSharp.Point(h * 4, lastY1), new OpenCvSharp.Point(h * 4, Math.Max(lastY2, lastY1 + 2)), color[j], lineWidth, LineTypes.Link4/*AntiAlias*/);
  401. }
  402. }
  403. }
  404. }
  405. }
  406. this.pictureBox1.BackgroundImage/*Image*/ = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(histImg);
  407. }
  408. /// <summary>
  409. /// 绘制直方图
  410. /// </summary>
  411. /// <param name="hist"></param>
  412. /// <returns></returns>
  413. private unsafe void updateHistImg(Mat[] hists)
  414. {
  415. if (m_mat == null)
  416. {
  417. return;
  418. }
  419. Mat[] mats = Cv2.Split(m_mat);//一张图片,将panda拆分成3个图片装进mat
  420. if (mats.Count() == 1)
  421. {
  422. isGray = true;
  423. }
  424. else
  425. {
  426. isGray = false;
  427. }
  428. if (isGray)
  429. {
  430. updateHistImgGray(hists);
  431. return;
  432. }
  433. Mat[] mats0 = new Mat[] { mats[0] };//panda的第一个通道,也就是B
  434. Mat[] mats1 = new Mat[] { mats[1] };//panda的第二个通道,也就是G
  435. Mat[] mats2 = new Mat[] { mats[2] };//panda的第三个通道,也就是R
  436. if (hists == null)
  437. {
  438. hists = new Mat[] { new Mat(), new Mat(), new Mat() };//一个矩阵数组,用来接收直方图,记得全部初始化
  439. int[] channels0 = new int[] { 0 };//一个通道,初始化为通道0,这些东西可以共用设置一个就行
  440. int[] channels1 = new int[] { 0 };
  441. int[] channels2 = new int[] { 0 };
  442. int[] histsize = new int[] { 256 };//一个通道,初始化为256箱子
  443. Rangef[] range = new Rangef[1];//一个通道,范围
  444. range[0].Start = 0.0F;//从0开始(含)
  445. range[0].End = 256.0F;//到256结束(不含)
  446. Mat mask = new Mat();//不做掩码
  447. Cv2.CalcHist(mats0, channels0, mask, hists[0], 1, histsize, range);//对被拆分的图片单独进行计算
  448. Cv2.CalcHist(mats1, channels1, mask, hists[1], 1, histsize, range);//对被拆分的图片单独进行计算
  449. Cv2.CalcHist(mats2, channels2, mask, hists[2], 1, histsize, range);//对被拆分的图片单独进行计算
  450. if (logButton.BtnSelect)
  451. {
  452. //取对数
  453. for (int j = 0; j < hists.Length; j++)
  454. {
  455. List<float> ProbPixel = new List<float>();
  456. for (int i = 0; i < hists[j].Rows; i++)
  457. {
  458. if (((float*)hists[j].Ptr(0))[i] == 0)
  459. {
  460. ((float*)hists[j].Ptr(0))[i] = ((float*)hists[j].Ptr(0))[i];
  461. ProbPixel.Add(0);
  462. }
  463. else
  464. {
  465. ((float*)hists[j].Ptr(0))[i] = (float)Math.Log10(((float*)hists[j].Ptr(0))[i]/* + 9*/);
  466. ProbPixel.Add(1);
  467. }
  468. }
  469. double max1jVal = 0;
  470. double min1jVal = 0;
  471. //找到直方图中的最大值和最小值
  472. Cv2.MinMaxLoc(hists[j], out min1jVal, out max1jVal);
  473. if (min1jVal >= max1jVal)
  474. {
  475. continue;
  476. }
  477. //归一化到0~255,并根据AxioVision添加偏置值
  478. for (int i = 0; i < hists[j].Rows; i++)
  479. {
  480. ((float*)hists[j].Ptr(0))[i] = (float)((((float*)hists[j].Ptr(0))[i] - 0) * 255.0 / (max1jVal - 0)) + (float)(min1jVal > 0 ? (ProbPixel[i] * min1jVal * 255.0 / max1jVal) : ProbPixel[i] * 5);
  481. }
  482. }
  483. }
  484. if (skipButton.BtnSelect)
  485. {
  486. //去掉黑色部分 和 白色部分
  487. for (int j = 0; j < hists.Length; j++)
  488. {
  489. ((float*)hists[j].Ptr(0))[0] = 0;
  490. ((float*)hists[j].Ptr(0))[255] = 0;
  491. }
  492. }
  493. }
  494. double max2Val = 0;
  495. double max1Val = 0;
  496. double max0Val = 0;
  497. double minVal = 0;
  498. //为了更好显示直方图细节,使用4倍尺寸绘制直方图
  499. int histSize = hists[0].Rows * 4;
  500. Mat histImg = new Mat(histSize, histSize, MatType.CV_8UC3, new Scalar(255, 255, 255));
  501. //找到直方图中的最大值和最小值
  502. Cv2.MinMaxLoc(hists[2], out minVal, out max2Val);
  503. Cv2.MinMaxLoc(hists[1], out minVal, out max1Val);
  504. Cv2.MinMaxLoc(hists[0], out minVal, out max0Val);
  505. double maxVal = Math.Max(max2Val, Math.Max(max0Val, max1Val));
  506. if (maxVal < 1)
  507. return;
  508. // 设置最大峰值为图像高度的90%
  509. double hpt = 0.9 * histSize;
  510. //灰度图的显示直方图较为简单,显示一个通道即可
  511. if (isGray)
  512. {
  513. Mat hist = hists[0];
  514. int lastY2 = histSize - 1;
  515. for (int h = 0; h < hists[0].Rows; h++)
  516. {
  517. int intensity = (int)(hist.At<float>(h) * hpt / maxVal);
  518. int lastY1 = lastY2;
  519. lastY2 = histSize - intensity - 1 - (hist.At<float>(h) > 0 ? 4 : 0);
  520. if (lastY2 < lastY1)
  521. {
  522. Cv2.Line(histImg, new OpenCvSharp.Point(h * 4, lastY1), new OpenCvSharp.Point(h * 4, Math.Min(lastY2, lastY1 - 2)), new Scalar(0, 0, 0, 255), 2, LineTypes.Link4);
  523. }
  524. else
  525. {
  526. Cv2.Line(histImg, new OpenCvSharp.Point(h * 4, lastY1), new OpenCvSharp.Point(h * 4, Math.Max(lastY2, lastY1 + 2)), new Scalar(0, 0, 0, 255), 2, LineTypes.Link4);
  527. }
  528. }
  529. }
  530. //彩度图显示BGR三个通道的直方图
  531. else
  532. {
  533. int lineWidth = 2;
  534. for (int j = hists.Length - 1; j >= 0; j--)
  535. {
  536. Mat hist = hists[j];
  537. int lastY2 = histSize - 1;
  538. for (int h = 0; h < hists[0].Rows; h++)
  539. {
  540. int intensity = (int)(hist.At<float>(h) * hpt / maxVal);
  541. int lastY1 = lastY2;
  542. lastY2 = histSize - intensity - 1 - (hist.At<float>(h) > 0 ? 4 : 0);
  543. if (h > 0)
  544. {
  545. //显示0.5位置的直方图,这样与AxioVision效果更加近似
  546. int lasty12 = (lastY1 + lastY2) / 2;
  547. if (lasty12 < lastY1)
  548. {
  549. Cv2.Line(histImg, new OpenCvSharp.Point(h * 4 - 2, lastY1), new OpenCvSharp.Point(h * 4 - 2, Math.Min(lasty12, lastY1 - 2)), color[j], lineWidth, LineTypes.Link4);
  550. }
  551. else
  552. {
  553. Cv2.Line(histImg, new OpenCvSharp.Point(h * 4 - 2, lastY1), new OpenCvSharp.Point(h * 4 - 2, Math.Max(lasty12, lastY1 + 2)), color[j], lineWidth, LineTypes.Link4/*AntiAlias*/);
  554. }
  555. if (lastY2 < lasty12)
  556. {
  557. Cv2.Line(histImg, new OpenCvSharp.Point(h * 4, lasty12), new OpenCvSharp.Point(h * 4, Math.Min(lastY2, lasty12 - 2)), color[j], lineWidth, LineTypes.Link4);
  558. }
  559. else
  560. {
  561. Cv2.Line(histImg, new OpenCvSharp.Point(h * 4, lasty12), new OpenCvSharp.Point(h * 4, Math.Max(lastY2, lasty12 + 2)), color[j], lineWidth, LineTypes.Link4/*AntiAlias*/);
  562. }
  563. }
  564. else
  565. {
  566. //灰度值为0的线的绘制
  567. if (lastY2 < lastY1)
  568. {
  569. Cv2.Line(histImg, new OpenCvSharp.Point(h * 4, lastY1), new OpenCvSharp.Point(h * 4, Math.Min(lastY2, lastY1 - 2)), color[j], lineWidth, LineTypes.Link4);
  570. }
  571. else
  572. {
  573. Cv2.Line(histImg, new OpenCvSharp.Point(h * 4, lastY1), new OpenCvSharp.Point(h * 4, Math.Max(lastY2, lastY1 + 2)), color[j], lineWidth, LineTypes.Link4/*AntiAlias*/);
  574. }
  575. }
  576. }
  577. }
  578. }
  579. this.pictureBox1.BackgroundImage/*Image*/ = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(histImg);
  580. }
  581. private void stopDrawing()
  582. {
  583. //创建一个委托,用于封装一个方法,在这里是封装了 控制更新控件 的方法
  584. Action invokeAction = new Action(stopDrawing);
  585. //判断操作控件的线程是否创建控件的线程
  586. //调用方调用方位于创建控件所在的线程以外的线程中,如果在其他线程则对控件进行方法调用时必须调用 Invoke 方法
  587. if (this.InvokeRequired)
  588. {
  589. //与调用线程不同的线程上创建(说明您必须通过 Invoke 方法对控件进行调用)
  590. this.Invoke(invokeAction);
  591. }
  592. else
  593. {
  594. m_camera.StopDrawing(m_process);
  595. m_camera.StopWaitForFrame();
  596. ////窗体线程,即主线程
  597. //shuaxinButton.Enabled = true;
  598. }
  599. }
  600. private string UpdateExposureTime(UInt64 exposureTime)
  601. {
  602. string str = "";
  603. int sec = 0;
  604. int msec = 0;
  605. int usec = 0;
  606. m_camera.UpdateExposureTime(ref sec, ref msec, ref usec, exposureTime);
  607. if (sec > 0)
  608. {
  609. str += sec + "s";
  610. }
  611. else if (msec > 0)
  612. {
  613. str += msec + "ms";
  614. }
  615. else if (usec > 0)
  616. {
  617. str += usec + "μs";
  618. }
  619. return str;
  620. }
  621. private void UpdateExposureUI(int autoExposure)
  622. {
  623. }
  624. private void InitializeComponent()
  625. {
  626. this.pictureBox1 = new System.Windows.Forms.PictureBox();
  627. this.logButton = new PaintDotNet.CustomControl.SelectButton();
  628. this.skipButton = new PaintDotNet.CustomControl.SelectButton();
  629. this.groupBox5 = new System.Windows.Forms.GroupBox();
  630. this.button2 = new System.Windows.Forms.Button();
  631. this.button3 = new System.Windows.Forms.Button();
  632. this.button4 = new System.Windows.Forms.Button();
  633. this.button5 = new System.Windows.Forms.Button();
  634. this.xianshiColourCheckBox = new System.Windows.Forms.CheckBox();
  635. this.redChannelTB = new System.Windows.Forms.TrackBar();
  636. this.label7 = new System.Windows.Forms.Label();
  637. this.greenChannelTB = new System.Windows.Forms.TrackBar();
  638. this.label8 = new System.Windows.Forms.Label();
  639. this.label9 = new System.Windows.Forms.Label();
  640. this.blueChannelTB = new System.Windows.Forms.TrackBar();
  641. this.label10 = new System.Windows.Forms.Label();
  642. this.label11 = new System.Windows.Forms.Label();
  643. this.label12 = new System.Windows.Forms.Label();
  644. this.lanlvpictureBox = new System.Windows.Forms.PictureBox();
  645. this.hongsepictureBox = new System.Windows.Forms.PictureBox();
  646. this.yanghongsepictureBox = new System.Windows.Forms.PictureBox();
  647. this.lvsepictureBox = new System.Windows.Forms.PictureBox();
  648. this.huangsepictureBox = new System.Windows.Forms.PictureBox();
  649. this.lansepictureBox = new System.Windows.Forms.PictureBox();
  650. this.groupBox3 = new System.Windows.Forms.GroupBox();
  651. this.trbGain = new System.Windows.Forms.TrackBar();
  652. this.lblGainMax = new System.Windows.Forms.Label();
  653. this.lblGainMin = new System.Windows.Forms.Label();
  654. this.txtGain = new System.Windows.Forms.TextBox();
  655. this.groupBox2 = new System.Windows.Forms.GroupBox();
  656. this.label6 = new System.Windows.Forms.Label();
  657. this.lblBaoGuangMinVal = new System.Windows.Forms.Label();
  658. this.lblBaoGuangMaxVal = new System.Windows.Forms.Label();
  659. this.label4 = new System.Windows.Forms.Label();
  660. this.label3 = new System.Windows.Forms.Label();
  661. this.baoGuangPertBox = new System.Windows.Forms.TextBox();
  662. this.baoGuangTBox = new System.Windows.Forms.TextBox();
  663. this.unitLabel = new System.Windows.Forms.Label();
  664. this.unitPerLabel1 = new System.Windows.Forms.Label();
  665. this.checkBoxAutoExposure = new System.Windows.Forms.CheckBox();
  666. this.groupBox1 = new System.Windows.Forms.GroupBox();
  667. this.baoGuangTBar = new System.Windows.Forms.TrackBar();
  668. this.baoGuangPerTBar = new System.Windows.Forms.TrackBar();
  669. this.label5 = new System.Windows.Forms.Label();
  670. this.baoheduTBar = new System.Windows.Forms.TrackBar();
  671. this.lblSaturationMaxVal = new System.Windows.Forms.Label();
  672. this.label13 = new System.Windows.Forms.Label();
  673. this.baoheduTBox = new System.Windows.Forms.TextBox();
  674. this.lblSaturationMinVal = new System.Windows.Forms.Label();
  675. this.groupBox4 = new System.Windows.Forms.GroupBox();
  676. ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
  677. this.groupBox5.SuspendLayout();
  678. ((System.ComponentModel.ISupportInitialize)(this.redChannelTB)).BeginInit();
  679. ((System.ComponentModel.ISupportInitialize)(this.greenChannelTB)).BeginInit();
  680. ((System.ComponentModel.ISupportInitialize)(this.blueChannelTB)).BeginInit();
  681. ((System.ComponentModel.ISupportInitialize)(this.lanlvpictureBox)).BeginInit();
  682. ((System.ComponentModel.ISupportInitialize)(this.hongsepictureBox)).BeginInit();
  683. ((System.ComponentModel.ISupportInitialize)(this.yanghongsepictureBox)).BeginInit();
  684. ((System.ComponentModel.ISupportInitialize)(this.lvsepictureBox)).BeginInit();
  685. ((System.ComponentModel.ISupportInitialize)(this.huangsepictureBox)).BeginInit();
  686. ((System.ComponentModel.ISupportInitialize)(this.lansepictureBox)).BeginInit();
  687. this.groupBox3.SuspendLayout();
  688. ((System.ComponentModel.ISupportInitialize)(this.trbGain)).BeginInit();
  689. this.groupBox2.SuspendLayout();
  690. this.groupBox1.SuspendLayout();
  691. ((System.ComponentModel.ISupportInitialize)(this.baoGuangTBar)).BeginInit();
  692. ((System.ComponentModel.ISupportInitialize)(this.baoGuangPerTBar)).BeginInit();
  693. ((System.ComponentModel.ISupportInitialize)(this.baoheduTBar)).BeginInit();
  694. this.groupBox4.SuspendLayout();
  695. this.SuspendLayout();
  696. //
  697. // pictureBox1
  698. //
  699. this.pictureBox1.BackColor = System.Drawing.Color.White;
  700. this.pictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
  701. this.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  702. this.pictureBox1.Location = new System.Drawing.Point(9, 20);
  703. this.pictureBox1.Name = "pictureBox1";
  704. this.pictureBox1.Size = new System.Drawing.Size(348, 168);
  705. this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
  706. this.pictureBox1.TabIndex = 0;
  707. this.pictureBox1.TabStop = false;
  708. //
  709. // logButton
  710. //
  711. this.logButton.BackColor = System.Drawing.SystemColors.ControlDark;
  712. this.logButton.BtnSelect = false;
  713. this.logButton.BtnText = "log";
  714. this.logButton.Location = new System.Drawing.Point(363, 63);
  715. this.logButton.Name = "logButton";
  716. this.logButton.Size = new System.Drawing.Size(75, 23);
  717. this.logButton.TabIndex = 31;
  718. this.logButton.Click += new System.EventHandler(this.logButton_Click);
  719. //
  720. // skipButton
  721. //
  722. this.skipButton.BackColor = System.Drawing.SystemColors.ControlDark;
  723. this.skipButton.BtnSelect = false;
  724. this.skipButton.BtnText = "skip";
  725. this.skipButton.Location = new System.Drawing.Point(363, 110);
  726. this.skipButton.Name = "skipButton";
  727. this.skipButton.Size = new System.Drawing.Size(75, 23);
  728. this.skipButton.TabIndex = 32;
  729. this.skipButton.Click += new System.EventHandler(this.skipButton_Click);
  730. //
  731. // groupBox5
  732. //
  733. this.groupBox5.Controls.Add(this.skipButton);
  734. this.groupBox5.Controls.Add(this.logButton);
  735. this.groupBox5.Controls.Add(this.pictureBox1);
  736. this.groupBox5.Location = new System.Drawing.Point(13, 586);
  737. this.groupBox5.Name = "groupBox5";
  738. this.groupBox5.Size = new System.Drawing.Size(464, 194);
  739. this.groupBox5.TabIndex = 19;
  740. this.groupBox5.TabStop = false;
  741. this.groupBox5.Text = "直方图";
  742. //
  743. // button2
  744. //
  745. this.button2.Location = new System.Drawing.Point(20, 29);
  746. this.button2.Name = "button2";
  747. this.button2.Size = new System.Drawing.Size(75, 23);
  748. this.button2.TabIndex = 17;
  749. this.button2.Text = "手动";
  750. this.button2.UseVisualStyleBackColor = true;
  751. this.button2.Click += new System.EventHandler(this.button2_Click);
  752. //
  753. // button3
  754. //
  755. this.button3.Location = new System.Drawing.Point(134, 29);
  756. this.button3.Name = "button3";
  757. this.button3.Size = new System.Drawing.Size(75, 23);
  758. this.button3.TabIndex = 18;
  759. this.button3.Text = "自动";
  760. this.button3.UseVisualStyleBackColor = true;
  761. this.button3.Click += new System.EventHandler(this.button3_Click);
  762. //
  763. // button4
  764. //
  765. this.button4.Location = new System.Drawing.Point(248, 29);
  766. this.button4.Name = "button4";
  767. this.button4.Size = new System.Drawing.Size(75, 23);
  768. this.button4.TabIndex = 19;
  769. this.button4.Text = "3200K";
  770. this.button4.UseVisualStyleBackColor = true;
  771. this.button4.Click += new System.EventHandler(this.button4_Click);
  772. //
  773. // button5
  774. //
  775. this.button5.Location = new System.Drawing.Point(362, 29);
  776. this.button5.Name = "button5";
  777. this.button5.Size = new System.Drawing.Size(75, 23);
  778. this.button5.TabIndex = 20;
  779. this.button5.Text = "5500K";
  780. this.button5.UseVisualStyleBackColor = true;
  781. this.button5.Click += new System.EventHandler(this.button5_Click);
  782. //
  783. // xianshiColourCheckBox
  784. //
  785. this.xianshiColourCheckBox.AutoSize = true;
  786. this.xianshiColourCheckBox.Checked = true;
  787. this.xianshiColourCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
  788. this.xianshiColourCheckBox.Location = new System.Drawing.Point(20, 67);
  789. this.xianshiColourCheckBox.Name = "xianshiColourCheckBox";
  790. this.xianshiColourCheckBox.Size = new System.Drawing.Size(108, 16);
  791. this.xianshiColourCheckBox.TabIndex = 21;
  792. this.xianshiColourCheckBox.Text = "显示颜色值通道";
  793. this.xianshiColourCheckBox.UseVisualStyleBackColor = true;
  794. this.xianshiColourCheckBox.CheckedChanged += new System.EventHandler(this.xianshiColourCheckBox_CheckedChanged);
  795. //
  796. // redChannelTB
  797. //
  798. this.redChannelTB.Location = new System.Drawing.Point(104, 96);
  799. this.redChannelTB.Maximum = 1366;
  800. this.redChannelTB.Name = "redChannelTB";
  801. this.redChannelTB.Size = new System.Drawing.Size(246, 45);
  802. this.redChannelTB.TabIndex = 22;
  803. this.redChannelTB.TickStyle = System.Windows.Forms.TickStyle.None;
  804. this.redChannelTB.ValueChanged += new System.EventHandler(this.redChannelTB_ValueChanged);
  805. //
  806. // label7
  807. //
  808. this.label7.AutoSize = true;
  809. this.label7.Location = new System.Drawing.Point(58, 96);
  810. this.label7.Name = "label7";
  811. this.label7.Size = new System.Drawing.Size(41, 12);
  812. this.label7.TabIndex = 23;
  813. this.label7.Text = "蓝绿色";
  814. //
  815. // greenChannelTB
  816. //
  817. this.greenChannelTB.Location = new System.Drawing.Point(104, 125);
  818. this.greenChannelTB.Maximum = 1366;
  819. this.greenChannelTB.Name = "greenChannelTB";
  820. this.greenChannelTB.Size = new System.Drawing.Size(246, 45);
  821. this.greenChannelTB.TabIndex = 24;
  822. this.greenChannelTB.TickStyle = System.Windows.Forms.TickStyle.None;
  823. this.greenChannelTB.Scroll += new System.EventHandler(this.greenChannelTB_Scroll);
  824. //
  825. // label8
  826. //
  827. this.label8.AutoSize = true;
  828. this.label8.Location = new System.Drawing.Point(58, 125);
  829. this.label8.Name = "label8";
  830. this.label8.Size = new System.Drawing.Size(41, 12);
  831. this.label8.TabIndex = 25;
  832. this.label8.Text = "洋红色";
  833. //
  834. // label9
  835. //
  836. this.label9.AutoSize = true;
  837. this.label9.Location = new System.Drawing.Point(58, 155);
  838. this.label9.Name = "label9";
  839. this.label9.Size = new System.Drawing.Size(29, 12);
  840. this.label9.TabIndex = 26;
  841. this.label9.Text = "黄色";
  842. //
  843. // blueChannelTB
  844. //
  845. this.blueChannelTB.Location = new System.Drawing.Point(104, 155);
  846. this.blueChannelTB.Maximum = 1366;
  847. this.blueChannelTB.Name = "blueChannelTB";
  848. this.blueChannelTB.Size = new System.Drawing.Size(246, 45);
  849. this.blueChannelTB.TabIndex = 27;
  850. this.blueChannelTB.TickStyle = System.Windows.Forms.TickStyle.None;
  851. this.blueChannelTB.ValueChanged += new System.EventHandler(this.blueChannelTB_ValueChanged);
  852. //
  853. // label10
  854. //
  855. this.label10.AutoSize = true;
  856. this.label10.Location = new System.Drawing.Point(368, 96);
  857. this.label10.Name = "label10";
  858. this.label10.Size = new System.Drawing.Size(29, 12);
  859. this.label10.TabIndex = 28;
  860. this.label10.Text = "红色";
  861. //
  862. // label11
  863. //
  864. this.label11.AutoSize = true;
  865. this.label11.Location = new System.Drawing.Point(368, 125);
  866. this.label11.Name = "label11";
  867. this.label11.Size = new System.Drawing.Size(29, 12);
  868. this.label11.TabIndex = 29;
  869. this.label11.Text = "绿色";
  870. //
  871. // label12
  872. //
  873. this.label12.AutoSize = true;
  874. this.label12.Location = new System.Drawing.Point(368, 155);
  875. this.label12.Name = "label12";
  876. this.label12.Size = new System.Drawing.Size(29, 12);
  877. this.label12.TabIndex = 30;
  878. this.label12.Text = "蓝色";
  879. //
  880. // lanlvpictureBox
  881. //
  882. this.lanlvpictureBox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
  883. this.lanlvpictureBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  884. this.lanlvpictureBox.Location = new System.Drawing.Point(33, 96);
  885. this.lanlvpictureBox.Name = "lanlvpictureBox";
  886. this.lanlvpictureBox.Size = new System.Drawing.Size(12, 12);
  887. this.lanlvpictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
  888. this.lanlvpictureBox.TabIndex = 31;
  889. this.lanlvpictureBox.TabStop = false;
  890. //
  891. // hongsepictureBox
  892. //
  893. this.hongsepictureBox.BackColor = System.Drawing.Color.Red;
  894. this.hongsepictureBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  895. this.hongsepictureBox.Location = new System.Drawing.Point(412, 96);
  896. this.hongsepictureBox.Name = "hongsepictureBox";
  897. this.hongsepictureBox.Size = new System.Drawing.Size(12, 12);
  898. this.hongsepictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
  899. this.hongsepictureBox.TabIndex = 32;
  900. this.hongsepictureBox.TabStop = false;
  901. //
  902. // yanghongsepictureBox
  903. //
  904. this.yanghongsepictureBox.BackColor = System.Drawing.Color.Fuchsia;
  905. this.yanghongsepictureBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  906. this.yanghongsepictureBox.Location = new System.Drawing.Point(33, 125);
  907. this.yanghongsepictureBox.Name = "yanghongsepictureBox";
  908. this.yanghongsepictureBox.Size = new System.Drawing.Size(12, 12);
  909. this.yanghongsepictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
  910. this.yanghongsepictureBox.TabIndex = 33;
  911. this.yanghongsepictureBox.TabStop = false;
  912. //
  913. // lvsepictureBox
  914. //
  915. this.lvsepictureBox.BackColor = System.Drawing.Color.Lime;
  916. this.lvsepictureBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  917. this.lvsepictureBox.Location = new System.Drawing.Point(412, 125);
  918. this.lvsepictureBox.Name = "lvsepictureBox";
  919. this.lvsepictureBox.Size = new System.Drawing.Size(12, 12);
  920. this.lvsepictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
  921. this.lvsepictureBox.TabIndex = 34;
  922. this.lvsepictureBox.TabStop = false;
  923. //
  924. // huangsepictureBox
  925. //
  926. this.huangsepictureBox.BackColor = System.Drawing.Color.Yellow;
  927. this.huangsepictureBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  928. this.huangsepictureBox.Location = new System.Drawing.Point(33, 155);
  929. this.huangsepictureBox.Name = "huangsepictureBox";
  930. this.huangsepictureBox.Size = new System.Drawing.Size(12, 12);
  931. this.huangsepictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
  932. this.huangsepictureBox.TabIndex = 35;
  933. this.huangsepictureBox.TabStop = false;
  934. //
  935. // lansepictureBox
  936. //
  937. this.lansepictureBox.BackColor = System.Drawing.Color.Blue;
  938. this.lansepictureBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  939. this.lansepictureBox.Location = new System.Drawing.Point(412, 155);
  940. this.lansepictureBox.Name = "lansepictureBox";
  941. this.lansepictureBox.Size = new System.Drawing.Size(12, 12);
  942. this.lansepictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
  943. this.lansepictureBox.TabIndex = 36;
  944. this.lansepictureBox.TabStop = false;
  945. //
  946. // groupBox3
  947. //
  948. this.groupBox3.Controls.Add(this.lansepictureBox);
  949. this.groupBox3.Controls.Add(this.huangsepictureBox);
  950. this.groupBox3.Controls.Add(this.lvsepictureBox);
  951. this.groupBox3.Controls.Add(this.yanghongsepictureBox);
  952. this.groupBox3.Controls.Add(this.hongsepictureBox);
  953. this.groupBox3.Controls.Add(this.lanlvpictureBox);
  954. this.groupBox3.Controls.Add(this.label12);
  955. this.groupBox3.Controls.Add(this.label11);
  956. this.groupBox3.Controls.Add(this.label10);
  957. this.groupBox3.Controls.Add(this.blueChannelTB);
  958. this.groupBox3.Controls.Add(this.label9);
  959. this.groupBox3.Controls.Add(this.label8);
  960. this.groupBox3.Controls.Add(this.greenChannelTB);
  961. this.groupBox3.Controls.Add(this.label7);
  962. this.groupBox3.Controls.Add(this.redChannelTB);
  963. this.groupBox3.Controls.Add(this.xianshiColourCheckBox);
  964. this.groupBox3.Controls.Add(this.button5);
  965. this.groupBox3.Controls.Add(this.button4);
  966. this.groupBox3.Controls.Add(this.button3);
  967. this.groupBox3.Controls.Add(this.button2);
  968. this.groupBox3.Location = new System.Drawing.Point(13, 283);
  969. this.groupBox3.Name = "groupBox3";
  970. this.groupBox3.Size = new System.Drawing.Size(464, 191);
  971. this.groupBox3.TabIndex = 17;
  972. this.groupBox3.TabStop = false;
  973. this.groupBox3.Text = "白平衡";
  974. //
  975. // trbGain
  976. //
  977. this.trbGain.Location = new System.Drawing.Point(89, 21);
  978. this.trbGain.Maximum = 255;
  979. this.trbGain.Name = "trbGain";
  980. this.trbGain.Size = new System.Drawing.Size(280, 45);
  981. this.trbGain.TabIndex = 15;
  982. this.trbGain.TickStyle = System.Windows.Forms.TickStyle.None;
  983. this.trbGain.Value = 10;
  984. this.trbGain.ValueChanged += new System.EventHandler(this.trbGain_ValueChanged);
  985. //
  986. // lblGainMax
  987. //
  988. this.lblGainMax.AutoSize = true;
  989. this.lblGainMax.Location = new System.Drawing.Point(340, 54);
  990. this.lblGainMax.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
  991. this.lblGainMax.Name = "lblGainMax";
  992. this.lblGainMax.Size = new System.Drawing.Size(23, 12);
  993. this.lblGainMax.TabIndex = 16;
  994. this.lblGainMax.Text = "255";
  995. //
  996. // lblGainMin
  997. //
  998. this.lblGainMin.AutoSize = true;
  999. this.lblGainMin.Location = new System.Drawing.Point(97, 54);
  1000. this.lblGainMin.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
  1001. this.lblGainMin.Name = "lblGainMin";
  1002. this.lblGainMin.Size = new System.Drawing.Size(11, 12);
  1003. this.lblGainMin.TabIndex = 17;
  1004. this.lblGainMin.Text = "0";
  1005. //
  1006. // txtGain
  1007. //
  1008. this.txtGain.Location = new System.Drawing.Point(369, 21);
  1009. this.txtGain.Name = "txtGain";
  1010. this.txtGain.Size = new System.Drawing.Size(55, 21);
  1011. this.txtGain.TabIndex = 36;
  1012. this.txtGain.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtGain_KeyPress);
  1013. //
  1014. // groupBox2
  1015. //
  1016. this.groupBox2.Controls.Add(this.txtGain);
  1017. this.groupBox2.Controls.Add(this.lblGainMin);
  1018. this.groupBox2.Controls.Add(this.lblGainMax);
  1019. this.groupBox2.Controls.Add(this.trbGain);
  1020. this.groupBox2.Location = new System.Drawing.Point(13, 182);
  1021. this.groupBox2.Name = "groupBox2";
  1022. this.groupBox2.Size = new System.Drawing.Size(464, 84);
  1023. this.groupBox2.TabIndex = 16;
  1024. this.groupBox2.TabStop = false;
  1025. this.groupBox2.Text = "增益值调整";
  1026. //
  1027. // label6
  1028. //
  1029. this.label6.AutoSize = true;
  1030. this.label6.Location = new System.Drawing.Point(18, 66);
  1031. this.label6.Name = "label6";
  1032. this.label6.Size = new System.Drawing.Size(71, 12);
  1033. this.label6.TabIndex = 15;
  1034. this.label6.Text = "曝光百分比:";
  1035. //
  1036. // lblBaoGuangMinVal
  1037. //
  1038. this.lblBaoGuangMinVal.AutoSize = true;
  1039. this.lblBaoGuangMinVal.Location = new System.Drawing.Point(93, 53);
  1040. this.lblBaoGuangMinVal.Name = "lblBaoGuangMinVal";
  1041. this.lblBaoGuangMinVal.Size = new System.Drawing.Size(41, 12);
  1042. this.lblBaoGuangMinVal.TabIndex = 19;
  1043. this.lblBaoGuangMinVal.Text = "250μs";
  1044. //
  1045. // lblBaoGuangMaxVal
  1046. //
  1047. this.lblBaoGuangMaxVal.AutoSize = true;
  1048. this.lblBaoGuangMaxVal.Location = new System.Drawing.Point(321, 53);
  1049. this.lblBaoGuangMaxVal.Name = "lblBaoGuangMaxVal";
  1050. this.lblBaoGuangMaxVal.Size = new System.Drawing.Size(35, 12);
  1051. this.lblBaoGuangMaxVal.TabIndex = 20;
  1052. this.lblBaoGuangMaxVal.Text = "1000s";
  1053. //
  1054. // label4
  1055. //
  1056. this.label4.AutoSize = true;
  1057. this.label4.Location = new System.Drawing.Point(93, 91);
  1058. this.label4.Name = "label4";
  1059. this.label4.Size = new System.Drawing.Size(17, 12);
  1060. this.label4.TabIndex = 21;
  1061. this.label4.Text = "5%";
  1062. //
  1063. // label3
  1064. //
  1065. this.label3.AutoSize = true;
  1066. this.label3.Location = new System.Drawing.Point(327, 91);
  1067. this.label3.Name = "label3";
  1068. this.label3.Size = new System.Drawing.Size(29, 12);
  1069. this.label3.TabIndex = 22;
  1070. this.label3.Text = "200%";
  1071. //
  1072. // baoGuangPertBox
  1073. //
  1074. this.baoGuangPertBox.Location = new System.Drawing.Point(369, 66);
  1075. this.baoGuangPertBox.Name = "baoGuangPertBox";
  1076. this.baoGuangPertBox.Size = new System.Drawing.Size(55, 21);
  1077. this.baoGuangPertBox.TabIndex = 30;
  1078. this.baoGuangPertBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.baoGuangPertBox_KeyPress);
  1079. //
  1080. // baoGuangTBox
  1081. //
  1082. this.baoGuangTBox.Location = new System.Drawing.Point(370, 31);
  1083. this.baoGuangTBox.Name = "baoGuangTBox";
  1084. this.baoGuangTBox.Size = new System.Drawing.Size(55, 21);
  1085. this.baoGuangTBox.TabIndex = 31;
  1086. this.baoGuangTBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.baoGuangTBox_KeyPress);
  1087. //
  1088. // unitLabel
  1089. //
  1090. this.unitLabel.AutoSize = true;
  1091. this.unitLabel.Location = new System.Drawing.Point(431, 34);
  1092. this.unitLabel.Name = "unitLabel";
  1093. this.unitLabel.Size = new System.Drawing.Size(17, 12);
  1094. this.unitLabel.TabIndex = 32;
  1095. this.unitLabel.Text = "us";
  1096. //
  1097. // unitPerLabel1
  1098. //
  1099. this.unitPerLabel1.AutoSize = true;
  1100. this.unitPerLabel1.Location = new System.Drawing.Point(431, 69);
  1101. this.unitPerLabel1.Name = "unitPerLabel1";
  1102. this.unitPerLabel1.Size = new System.Drawing.Size(11, 12);
  1103. this.unitPerLabel1.TabIndex = 33;
  1104. this.unitPerLabel1.Text = "%";
  1105. //
  1106. // checkBoxAutoExposure
  1107. //
  1108. this.checkBoxAutoExposure.AutoSize = true;
  1109. this.checkBoxAutoExposure.Location = new System.Drawing.Point(21, 117);
  1110. this.checkBoxAutoExposure.Margin = new System.Windows.Forms.Padding(2);
  1111. this.checkBoxAutoExposure.Name = "checkBoxAutoExposure";
  1112. this.checkBoxAutoExposure.Size = new System.Drawing.Size(72, 16);
  1113. this.checkBoxAutoExposure.TabIndex = 34;
  1114. this.checkBoxAutoExposure.Text = "自动曝光";
  1115. this.checkBoxAutoExposure.UseVisualStyleBackColor = true;
  1116. this.checkBoxAutoExposure.CheckedChanged += new System.EventHandler(this.checkBoxAutoExposure_CheckedChanged);
  1117. //
  1118. // groupBox1
  1119. //
  1120. this.groupBox1.Controls.Add(this.checkBoxAutoExposure);
  1121. this.groupBox1.Controls.Add(this.unitPerLabel1);
  1122. this.groupBox1.Controls.Add(this.unitLabel);
  1123. this.groupBox1.Controls.Add(this.baoGuangTBox);
  1124. this.groupBox1.Controls.Add(this.baoGuangPertBox);
  1125. this.groupBox1.Controls.Add(this.label3);
  1126. this.groupBox1.Controls.Add(this.label4);
  1127. this.groupBox1.Controls.Add(this.lblBaoGuangMaxVal);
  1128. this.groupBox1.Controls.Add(this.lblBaoGuangMinVal);
  1129. this.groupBox1.Controls.Add(this.label6);
  1130. this.groupBox1.Controls.Add(this.label5);
  1131. this.groupBox1.Controls.Add(this.baoGuangPerTBar);
  1132. this.groupBox1.Controls.Add(this.baoGuangTBar);
  1133. this.groupBox1.Location = new System.Drawing.Point(13, 14);
  1134. this.groupBox1.Name = "groupBox1";
  1135. this.groupBox1.Size = new System.Drawing.Size(464, 154);
  1136. this.groupBox1.TabIndex = 15;
  1137. this.groupBox1.TabStop = false;
  1138. this.groupBox1.Text = "曝光时间";
  1139. //
  1140. // baoGuangTBar
  1141. //
  1142. this.baoGuangTBar.Location = new System.Drawing.Point(89, 31);
  1143. this.baoGuangTBar.Maximum = 2998;
  1144. this.baoGuangTBar.Minimum = 250;
  1145. this.baoGuangTBar.Name = "baoGuangTBar";
  1146. this.baoGuangTBar.Size = new System.Drawing.Size(274, 45);
  1147. this.baoGuangTBar.TabIndex = 14;
  1148. this.baoGuangTBar.TickStyle = System.Windows.Forms.TickStyle.None;
  1149. this.baoGuangTBar.Value = 250;
  1150. this.baoGuangTBar.ValueChanged += new System.EventHandler(this.baoguangTrackBar_ValueChanged);
  1151. //
  1152. // baoGuangPerTBar
  1153. //
  1154. this.baoGuangPerTBar.Location = new System.Drawing.Point(89, 66);
  1155. this.baoGuangPerTBar.Maximum = 200;
  1156. this.baoGuangPerTBar.Minimum = 5;
  1157. this.baoGuangPerTBar.Name = "baoGuangPerTBar";
  1158. this.baoGuangPerTBar.Size = new System.Drawing.Size(274, 45);
  1159. this.baoGuangPerTBar.TabIndex = 13;
  1160. this.baoGuangPerTBar.TickStyle = System.Windows.Forms.TickStyle.None;
  1161. this.baoGuangPerTBar.Value = 100;
  1162. this.baoGuangPerTBar.ValueChanged += new System.EventHandler(this.baoguangPerTrackBar_ValueChanged);
  1163. //
  1164. // label5
  1165. //
  1166. this.label5.AutoSize = true;
  1167. this.label5.Location = new System.Drawing.Point(18, 31);
  1168. this.label5.Name = "label5";
  1169. this.label5.Size = new System.Drawing.Size(65, 12);
  1170. this.label5.TabIndex = 12;
  1171. this.label5.Text = "曝光时间:";
  1172. //
  1173. // baoheduTBar
  1174. //
  1175. this.baoheduTBar.Location = new System.Drawing.Point(95, 28);
  1176. this.baoheduTBar.Maximum = 20;
  1177. this.baoheduTBar.Name = "baoheduTBar";
  1178. this.baoheduTBar.Size = new System.Drawing.Size(274, 45);
  1179. this.baoheduTBar.TabIndex = 32;
  1180. this.baoheduTBar.TickStyle = System.Windows.Forms.TickStyle.None;
  1181. this.baoheduTBar.Value = 10;
  1182. this.baoheduTBar.ValueChanged += new System.EventHandler(this.baoheduTBar_ValueChanged);
  1183. //
  1184. // lblSaturationMaxVal
  1185. //
  1186. this.lblSaturationMaxVal.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  1187. this.lblSaturationMaxVal.AutoSize = true;
  1188. this.lblSaturationMaxVal.Location = new System.Drawing.Point(333, 53);
  1189. this.lblSaturationMaxVal.Name = "lblSaturationMaxVal";
  1190. this.lblSaturationMaxVal.RightToLeft = System.Windows.Forms.RightToLeft.No;
  1191. this.lblSaturationMaxVal.Size = new System.Drawing.Size(23, 12);
  1192. this.lblSaturationMaxVal.TabIndex = 34;
  1193. this.lblSaturationMaxVal.Text = "1.0";
  1194. this.lblSaturationMaxVal.TextAlign = System.Drawing.ContentAlignment.TopRight;
  1195. //
  1196. // label13
  1197. //
  1198. this.label13.AutoSize = true;
  1199. this.label13.Location = new System.Drawing.Point(18, 28);
  1200. this.label13.Name = "label13";
  1201. this.label13.Size = new System.Drawing.Size(53, 12);
  1202. this.label13.TabIndex = 24;
  1203. this.label13.Text = "饱和度:";
  1204. //
  1205. // baoheduTBox
  1206. //
  1207. this.baoheduTBox.Location = new System.Drawing.Point(389, 28);
  1208. this.baoheduTBox.Name = "baoheduTBox";
  1209. this.baoheduTBox.Size = new System.Drawing.Size(55, 21);
  1210. this.baoheduTBox.TabIndex = 35;
  1211. //
  1212. // lblSaturationMinVal
  1213. //
  1214. this.lblSaturationMinVal.AutoSize = true;
  1215. this.lblSaturationMinVal.Location = new System.Drawing.Point(99, 53);
  1216. this.lblSaturationMinVal.Name = "lblSaturationMinVal";
  1217. this.lblSaturationMinVal.Size = new System.Drawing.Size(29, 12);
  1218. this.lblSaturationMinVal.TabIndex = 33;
  1219. this.lblSaturationMinVal.Text = "-1.0";
  1220. //
  1221. // groupBox4
  1222. //
  1223. this.groupBox4.Controls.Add(this.lblSaturationMinVal);
  1224. this.groupBox4.Controls.Add(this.baoheduTBox);
  1225. this.groupBox4.Controls.Add(this.label13);
  1226. this.groupBox4.Controls.Add(this.lblSaturationMaxVal);
  1227. this.groupBox4.Controls.Add(this.baoheduTBar);
  1228. this.groupBox4.Location = new System.Drawing.Point(13, 490);
  1229. this.groupBox4.Name = "groupBox4";
  1230. this.groupBox4.Size = new System.Drawing.Size(464, 81);
  1231. this.groupBox4.TabIndex = 18;
  1232. this.groupBox4.TabStop = false;
  1233. this.groupBox4.Text = "色彩和饱和度";
  1234. //
  1235. // ShowCameraControl
  1236. //
  1237. this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
  1238. this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
  1239. this.Controls.Add(this.groupBox5);
  1240. this.Controls.Add(this.groupBox4);
  1241. this.Controls.Add(this.groupBox3);
  1242. this.Controls.Add(this.groupBox2);
  1243. this.Controls.Add(this.groupBox1);
  1244. this.Name = "ShowCameraControl";
  1245. this.Size = new System.Drawing.Size(490, 801);
  1246. ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
  1247. this.groupBox5.ResumeLayout(false);
  1248. ((System.ComponentModel.ISupportInitialize)(this.redChannelTB)).EndInit();
  1249. ((System.ComponentModel.ISupportInitialize)(this.greenChannelTB)).EndInit();
  1250. ((System.ComponentModel.ISupportInitialize)(this.blueChannelTB)).EndInit();
  1251. ((System.ComponentModel.ISupportInitialize)(this.lanlvpictureBox)).EndInit();
  1252. ((System.ComponentModel.ISupportInitialize)(this.hongsepictureBox)).EndInit();
  1253. ((System.ComponentModel.ISupportInitialize)(this.yanghongsepictureBox)).EndInit();
  1254. ((System.ComponentModel.ISupportInitialize)(this.lvsepictureBox)).EndInit();
  1255. ((System.ComponentModel.ISupportInitialize)(this.huangsepictureBox)).EndInit();
  1256. ((System.ComponentModel.ISupportInitialize)(this.lansepictureBox)).EndInit();
  1257. this.groupBox3.ResumeLayout(false);
  1258. this.groupBox3.PerformLayout();
  1259. ((System.ComponentModel.ISupportInitialize)(this.trbGain)).EndInit();
  1260. this.groupBox2.ResumeLayout(false);
  1261. this.groupBox2.PerformLayout();
  1262. this.groupBox1.ResumeLayout(false);
  1263. this.groupBox1.PerformLayout();
  1264. ((System.ComponentModel.ISupportInitialize)(this.baoGuangTBar)).EndInit();
  1265. ((System.ComponentModel.ISupportInitialize)(this.baoGuangPerTBar)).EndInit();
  1266. ((System.ComponentModel.ISupportInitialize)(this.baoheduTBar)).EndInit();
  1267. this.groupBox4.ResumeLayout(false);
  1268. this.groupBox4.PerformLayout();
  1269. this.ResumeLayout(false);
  1270. }
  1271. public void OnTimerAutoExposure(object source, System.Timers.ElapsedEventArgs e)
  1272. {
  1273. double paramValue = m_camera.GetExposureTime() ;
  1274. int expValue = (int)(paramValue * 1000);
  1275. if (expValue < 137)
  1276. {
  1277. expValue = 130;
  1278. }
  1279. if (expValue > 15000000)
  1280. {
  1281. expValue = 15000000;
  1282. }
  1283. decimal txtVale = 0;
  1284. int sec = 0;
  1285. int msec = 0;
  1286. int usec = 0;
  1287. m_camera.UpdateExposureTime(ref sec, ref msec, ref usec, (UInt64)(paramValue * 1000));
  1288. //UpdateExposureTime((UInt64)paramValue * 1000);
  1289. }
  1290. /// <summary>
  1291. /// 手动白平衡
  1292. /// </summary>
  1293. /// <param name="sender"></param>
  1294. /// <param name="e"></param>
  1295. private void button2_Click(object sender, EventArgs e)
  1296. {
  1297. m_cameraParamModel.parame.FMExposure = 0;
  1298. AutoWhiteBalance(false);
  1299. }
  1300. /// <summary>
  1301. /// 自动白平衡按钮点击
  1302. /// </summary>
  1303. /// <param name="sender"></param>
  1304. /// <param name="e"></param>
  1305. private void button3_Click(object sender, EventArgs e)
  1306. {
  1307. AutoWhiteBalance(true);
  1308. }
  1309. /// <summary>
  1310. /// 色温3200K
  1311. /// </summary>
  1312. /// <param name="sender"></param>
  1313. /// <param name="e"></param>
  1314. private void button4_Click(object sender, EventArgs e)
  1315. {
  1316. m_cameraParamModel.parame.FMExposure = 1;
  1317. m_camera.SetColorTemperatureByString("3200K");
  1318. AutoWhiteBalance(false);
  1319. }
  1320. /// <summary>
  1321. /// 色温5500K
  1322. /// </summary>
  1323. /// <param name="sender"></param>
  1324. /// <param name="e"></param>
  1325. private void button5_Click(object sender, EventArgs e)
  1326. {
  1327. m_cameraParamModel.parame.FMExposure = 2;
  1328. m_camera.SetColorTemperatureByString("5500K");
  1329. AutoWhiteBalance(false);
  1330. }
  1331. private void UpdateColorTemperature()
  1332. {
  1333. }
  1334. /// <summary>
  1335. /// 是否自动白平衡 修改显示样式
  1336. /// </summary>
  1337. /// <param name="s"></param>
  1338. private void AutoWhiteBalance(Boolean isWhiteBalance)
  1339. {
  1340. if (isWhiteBalance)
  1341. {
  1342. m_cameraParamModel.parame.WhiteBalance = 1;
  1343. if (m_immediately)
  1344. {
  1345. // 自动白平衡
  1346. m_camera.SetWhiteBalanceMode(WhiteBalanceMode.AUTO);
  1347. }
  1348. }
  1349. else
  1350. {
  1351. m_cameraParamModel.parame.WhiteBalance = 0;
  1352. if (m_immediately)
  1353. {
  1354. // 手动白平衡
  1355. m_camera.SetWhiteBalanceMode(WhiteBalanceMode.MANUAL);
  1356. }
  1357. }
  1358. UpdateColorTemperature();
  1359. }
  1360. private void xianshiColourCheckBox_CheckedChanged(object sender, EventArgs e)
  1361. {
  1362. }
  1363. private void redChannelTB_ValueChanged(object sender, EventArgs e)
  1364. {
  1365. }
  1366. private void greenChannelTB_Scroll(object sender, EventArgs e)
  1367. {
  1368. }
  1369. private void blueChannelTB_ValueChanged(object sender, EventArgs e)
  1370. {
  1371. }
  1372. private void trbGain_ValueChanged(object sender, EventArgs e)
  1373. {
  1374. }
  1375. private void txtGain_KeyPress(object sender, KeyPressEventArgs e)
  1376. {
  1377. }
  1378. private void baoGuangPertBox_KeyPress(object sender, KeyPressEventArgs e)
  1379. {
  1380. }
  1381. private void baoGuangTBox_KeyPress(object sender, KeyPressEventArgs e)
  1382. {
  1383. }
  1384. private void checkBoxAutoExposure_CheckedChanged(object sender, EventArgs e)
  1385. {
  1386. }
  1387. private void baoguangTrackBar_ValueChanged(object sender, EventArgs e)
  1388. {
  1389. }
  1390. private void baoguangPerTrackBar_ValueChanged(object sender, EventArgs e)
  1391. {
  1392. }
  1393. private void baoheduTBar_ValueChanged(object sender, EventArgs e)
  1394. {
  1395. }
  1396. }
  1397. }