コード例 #1
0
        private void buttonGetBlob_Click(object sender, EventArgs e)
        {
            double cx   = 0;
            double cy   = 0;
            double Area = 0;

            int ret = 0;

            int pos;

            pos        = this.BlobBar.Value;
            matrix     = new bool[col, row];
            blobmatrix = new BlobPoint[col, row];
            minx       = miny = 100000;
            maxx       = maxy = -1;
            blobs.Clear();
            VSTest.Vision_MarkClean();
            ret = VSTest.Vision_FindBlobMultiplePoint(false, pos, BlobMinArea, BlobMaxArea, BlobSearchRect);

            for (int i = 0; i < ret; i++)
            {
                VSTest.Vision_GetBlobMultiplePointResult(i, ref cx, ref cy, ref Area);
                VSTest.Vision_DrawCross(Convert.ToInt32(cx), Convert.ToInt32(cy), 5, 250, 2);
                AddData(cx, cy);
            }
            GetPitch();
            CalcPixelWidth();
            MessageBox.Show("标定完成。");
        }
コード例 #2
0
 private void buttonStartRefCali_Click(object sender, EventArgs e)
 {
     if (UseGauge == "")
     {
         MessageBox.Show("当前产品没有标准块,不能进行基准设置。需要在CDI产品设置中选择标准块并保存后,再重新进行基准设置。");
         return;
     }
     IsRefSetting = true;
     refpoints.Clear();
     VSTest.Vision_MarkClean();
     if (CameraLive != null)
     {
         foreach (EventHandler handler in CameraLive.GetInvocationList())
         {
             CameraLive(sender, e);
         }
     }
     MessageBox.Show("相机已打开。将开始分别对电芯和标准块进行基准的设置。");
     if (MessageBox.Show("是否需要对标准块基准进行设置?如果需要则先放置好标准块,然后点“是”开始标准块基准设置,需要略过则点“否”。", "标准块基准设置", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         RefIndex = REF_GAUGE;
         MessageBox.Show("请先确定标准块已放好,点”确定“开始标准块基准设置。用鼠标点击图像中标准块主体边缘四个顶点。");
     }
     else if (MessageBox.Show("是否需要对电芯基准进行设置?如果需要则先放置好电芯,然后点“是”开始电芯基准设置,需要略过则点“否”。", "电芯基准设置", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         RefIndex = REF_CELL;
         MessageBox.Show("请先确定电芯已放好,点”确定“开始电芯基准设置。用鼠标点击图像中电芯主体边缘四个顶点。");
     }
     else
     {
         IsRefSetting = false;
     }
 }
コード例 #3
0
        private void buttonSet_Click(object sender, EventArgs e)
        {
            row         = int.Parse(textBoxRow.Text);
            col         = int.Parse(textBoxCol.Text);
            rowPitch    = double.Parse(textBoxRowPitch.Text);
            colPitch    = double.Parse(textBoxColPitch.Text);
            BlobThres   = this.BlobBar.Value;
            BlobMinArea = int.Parse(TextBoxMinArea.Text);
            BlobMaxArea = int.Parse(TextBoxMaxArea.Text);

            BlobWhiteBlob = CheckBoxWhiteBlob.Checked;

            VSTest.Vision_MarkClean();
            VSTest.Vision_ShowRect(BlobSearchRect, VSBase.COLOR_BLUE, 2);
        }