private void bUpdate_Click(object sender, EventArgs e) { CameraDefine.Save(); }
private void bAutoCliab1_Click(object sender, EventArgs e) { if (fm_SoftwareCliab.FindTemp == null || fm_SoftwareCliab.FindTemp.GetInvocationList().Length <= 0) { MessageBox.Show("请打开相机轴控界面!!"); return; } #region 九点标定 Task.Factory.StartNew(() => { float.TryParse(this.tXSpace.Text, out this.xspace); float.TryParse(this.tYSpace.Text, out this.yspace); List <PointF> WorldPt = new List <PointF>(); PointF start = new PointF(orgPt.X - xspace, orgPt.Y - yspace); for (int i = 0; i < 3; ++i) { for (int j = 0; j < 3; ++j) { WorldPt.Add(new PointF(start.X + i * xspace, start.Y + j * yspace)); } } // 拍照 标定 记录图像坐标 List <PointContour> ImagePt = new List <PointContour>(); var camera = CameraDefine.Instance.CameraList[this.module.Module][this.calibRatio1.SelectCam]; var entiy = SystemEntiy.Instance[this.module.Module]; for (int I = 0; I < WorldPt.Count; ++I) { entiy.XYGoPosTillStop(WorldPt[I]); // Grab Image and Calc var result = fm_SoftwareCliab.FindTemp.Invoke(this.module.Module, this.calibRatio1.SelectCam); if (result.State == VisionResultState.OK) { ImagePt.Add(result.Point); } else { MessageBox.Show("侦测失败!!"); return; } } short rtn = 0; var image = GetImage?.Invoke(); if (image == null) { MessageBox.Show("获取图片失败!!!"); return; } if (this.calibRatio1.SelectCam == Camera.Top || this.calibRatio1.SelectCam == Camera.Label) { this.AddCliab(this.module.Module, this.calibRatio1.SelectCam, 0, image, WorldPt, ImagePt); } else { if (this.calibRatio1.SelectNz == Nozzle.Nz1 || this.calibRatio1.SelectNz == Nozzle.Nz3) { this.AddCliab(this.module.Module, this.calibRatio1.SelectCam, 0, image, WorldPt, ImagePt); } else { this.AddCliab(this.module.Module, this.calibRatio1.SelectCam, 1, image, WorldPt, ImagePt); } } if (rtn == 0) { CameraDefine.Save(); MessageBox.Show("相机标定成功!!"); } else { MessageBox.Show("相机标定成功!!"); } }); #endregion }