/* * private void InitCa310() * { #region Init Ca310 * if (mode == TestMode.Ca310) * { * if (ca310Pipe == null) * { * ca310Pipe = new Ca310Pipe(System.Windows.Forms.Application.StartupPath); * ca310Hanle = new KonicaCa310(); * args.StatusInfo = "Initilaze Ca310 device."; * * if (!ca310Pipe.Connect()) * { * args.StatusInfo = ca310Pipe.ErrorMessage; * } * else * { * args.StatusInfo = "Ca310 has Connected."; * ca310Pipe.ResetZero(); * } * } * } * else * { * if (ca310Pipe != null) * { * ca310Pipe.Disconnect(); * ca310Pipe = null; * } * } #endregion * } */ private void InitCa310() { #region Init Ca310 if (mode == TestMode.Ca310) { if (ca310Hanle == null) { ca310Hanle = new KonicaCa310(); args.StatusInfo = "Initilaze Ca310 device."; ca310Hanle.Initiaze(); if (ca310Hanle.ErrorMessage != "") { args.StatusInfo = ca310Hanle.ErrorMessage; } else { args.StatusInfo = "Ca310 has Connected."; ca310Hanle.Zero(); } } } else { if (ca310Hanle != null) { ca310Hanle = null; } } #endregion }
public LuminanceCalibration(KonicaCa310 pipe, Fixture fixture, Colorimeter colorimeter, IntegratingSphere integrate) { this.ca310Pipe = pipe; this.fixture = fixture; this.camera = colorimeter; this.integrate = integrate; this.ReadProfile(); }
public ColorCalibration(DUTclass.DUT dut, KonicaCa310 pipe, Fixture fixture, Colorimeter colorimeter) { this.dut = dut; this.ca310Pipe = pipe; this.fixture = fixture; this.camera = colorimeter; this.rgbList = new List <int[]>(); FULLNAME = this.filepath + @"\RGB.txt"; PATH = this.filepath + @"\ColorCalibration\"; Directory.CreateDirectory(PATH); this.ReadProfile(); }
public void LvCalibrate(Action callBack, System.Windows.Forms.PictureBox cavaus) { float exposure = 4096; float runExp = exposure; float maxExp = exposure; float minExp = 1; new Action(delegate() { IntegratingSphere sphere = (IntegratingSphere)DevManage.Instance.SelectDevice(typeof(IntegratingSphere).Name); try { if (ca310Hanle == null) { ca310Hanle = new KonicaCa310(); ca310Hanle.Initiaze(); if (ca310Pipe.ErrorMessage == "") { System.Windows.Forms.MessageBox.Show("Please switch Ca310 to initial mode."); ca310Hanle.Zero(); System.Windows.Forms.MessageBox.Show("Please switch Ca310 to measure mode."); } } fixture.HoldOut(); fixture.IntegratingSphereUp(); sphere.Lighten(); System.Windows.Forms.MessageBox.Show("Software will waitting 5 minutes"); System.Threading.Thread.Sleep(300000); fixture.RotateOn(); // CIE1931Value value = ca310Pipe.GetCa310Data(); CIE1931Value value = ca310Hanle.GetCa310Data(); fixture.RotateOff(); fixture.CameraDown(); fixture.MotorMove(150000); System.Threading.Thread.Sleep(26000); foreach (TestItem item in Items) { if (item.RGB == Color.FromArgb(255, 255, 255)) { do { colorimeter.ExposureTime = runExp; System.Drawing.Bitmap bitmap = colorimeter.GrabImage(); if (cavaus != null) { cavaus.Image = System.Drawing.Image.FromHbitmap(bitmap.GetHbitmap()); } double[] rgbMean = this.Mean(ip.bmp2rgb(bitmap)); if (rgbMean[0] > 230 || rgbMean[1] > 230 || rgbMean[2] > 230) { maxExp = runExp; runExp = (runExp + minExp) / 2; } else if (rgbMean[0] < 215 || rgbMean[1] < 215 || rgbMean[2] < 215) { minExp = runExp; runExp = (runExp + maxExp) / 2; } else { optimalExp = runExp; item.Exposure = optimalExp; } if (Math.Abs(minExp) == Math.Abs(maxExp)) { throw new Exception("Luminance calibration fail."); } }while (true); } else { double faction = (redWeight * item.RGB.R + greenWeight * item.RGB.G + blueWeight * item.RGB.B) / 255; if (faction == 0) { item.Exposure = 4000; } item.Exposure = (float)(optimalExp / faction); } } if (callBack != null) { callBack(); } } catch (Exception e) { System.Windows.Forms.MessageBox.Show(e.Message); } finally { if (sphere != null) { sphere.Lightoff(); } if (fixture != null) { fixture.IntegratingSphereDown(); fixture.CameraUp(); fixture.Reset(); } xml.SaveScript(); } }).BeginInvoke(null, null); }