GetTileSize() public method

public GetTileSize ( ) : float
return float
Ejemplo n.º 1
0
        //Calibration
        private void cabliButton_Click(object sender, EventArgs e)
        {
            if (cabliButton.Text == "Start Calibration")
            {
                ChessSizeForm csf = new ChessSizeForm();

                if(csf.ShowDialog(this) == DialogResult.OK)
                {
                    float tilesize = csf.GetTileSize();
                    if (tilesize > 5)
                    {
                        Ovrvision.InitializeCalibration(7, 4, (float)tilesize);
                        cabliButton.Text = "Find Chessboard";
                        textBox1.AppendText(String.Format("Start calibration.... tile size is {0}mm\r\n", tilesize));

                        HowToUse htudialog = new HowToUse();
                        htudialog.ShowDialog(this);
                    }

                }
            }
            else if (cabliButton.Text == "Find Chessboard")
            {
                cameraPicRight.Visible = false;
                cameraPicLeft.Visible = false;
                Thread.Sleep(25);

                if(Ovrvision.CalibFindChess() != 0)
                    textBox1.AppendText(String.Format("[Success]Chess board was found: No.{0} / {1}\r\n", Ovrvision.CalibGetImageCount(), CalibrationImageNum));
                else
                    textBox1.AppendText(String.Format("[Failure]Can not find the chess board.\r\n"));

                if (Ovrvision.CalibGetImageCount() >= CalibrationImageNum)
                {
                    cabliButton.Text = "Create Parameters";
                }

                cameraPicRight.Visible = true;
                cameraPicLeft.Visible = true;
            }
            else if (cabliButton.Text == "Create Parameters")
            {
                textBox1.AppendText(String.Format("Setup in the data..... "));
                Ovrvision.CalibSolveStereoParameter();
                textBox1.AppendText(String.Format("OK!\r\n"));
                Thread.Sleep(500); //0.5s wait
                textBox1.AppendText(String.Format("The calibration params was saved successfully.\r\n"));

                //Close
                ThreadEnd = true;
                UpdateThread.Join();
                if (Ovrvision.Close())
                {
                    statelabel.Text = "Closed";
                    runbutton.Text = "Open Ovrvision";
                    cabliButton.Text = "Start Calibration";
                    cameraPicRight.Image = null;
                    cameraPicLeft.Image = null;

                    cabliButton.Enabled = false;
                }

                textBox1.AppendText(String.Format("Ovrvision calibration is done.\r\n"));
            }
        }
Ejemplo n.º 2
0
        //Calibration
        private void cabliButton_Click(object sender, EventArgs e)
        {
            if (cabliButton.Text == "Start Calibration")
            {
                ChessSizeForm csf = new ChessSizeForm();

                if (csf.ShowDialog(this) == DialogResult.OK)
                {
                    float tilesize = csf.GetTileSize();
                    if (tilesize > 5)
                    {
                        Ovrvision.InitializeCalibration(7, 4, (float)tilesize);
                        cabliButton.Text = "Find Chessboard";
                        textBox1.AppendText(String.Format("Start calibration.... tile size is {0}mm\r\n", tilesize));

                        HowToUse htudialog = new HowToUse();
                        htudialog.ShowDialog(this);
                    }
                }
            }
            else if (cabliButton.Text == "Find Chessboard")
            {
                cameraPicRight.Visible = false;
                cameraPicLeft.Visible  = false;
                Thread.Sleep(25);

                if (Ovrvision.CalibFindChess() != 0)
                {
                    textBox1.AppendText(String.Format("[Success]Chess board was found: No.{0} / {1}\r\n", Ovrvision.CalibGetImageCount(), CalibrationImageNum));
                }
                else
                {
                    textBox1.AppendText(String.Format("[Failure]Can not find the chess board.\r\n"));
                }

                if (Ovrvision.CalibGetImageCount() >= CalibrationImageNum)
                {
                    cabliButton.Text = "Create Parameters";
                }

                cameraPicRight.Visible = true;
                cameraPicLeft.Visible  = true;
            }
            else if (cabliButton.Text == "Create Parameters")
            {
                textBox1.AppendText(String.Format("Setup in the data..... "));
                Ovrvision.CalibSolveStereoParameter(opfCheckBox.Checked);
                textBox1.AppendText(String.Format("OK!\r\n"));
                Thread.Sleep(500); //0.5s wait
                textBox1.AppendText(String.Format("The calibration params was saved successfully.\r\n"));

                //Close
                ThreadEnd = true;
                UpdateThread.Join();
                if (Ovrvision.Close())
                {
                    statelabel.Text      = "Closed";
                    runbutton.Text       = "Open Ovrvision";
                    cabliButton.Text     = "Start Calibration";
                    cameraPicRight.Image = null;
                    cameraPicLeft.Image  = null;

                    cabliButton.Enabled = false;
                }

                textBox1.AppendText(String.Format("Ovrvision calibration is done.\r\n"));
            }
        }