コード例 #1
0
ファイル: frmMain.cs プロジェクト: williammc/sentience
        private void startCameraToolStripMenuItem_Click(object sender, EventArgs e)
        {
            initCamera();
            if (global_variables.selectedCameraName != "")
            {
                global_variables.camera_initialised = false;

                // grab the required camera WDM device name from the text box
                // (hope you remembered to fill that in correctly)
                String cameraFilterName = global_variables.selectedCameraName;

                if (cameraFilterName.Contains("#"))
                {
                    String[] str = cameraFilterName.Split('#');
                    cameraFilterName = str[0].Trim();
                }

                //transformRight = RotateFlipType.Rotate180FlipNone;

                // get the device list index number for this WDM device
                int index = global_variables.getCameraIndexContaining(cameraFilterName, 0);
                if (index > -1)
                {
                    // start running the left camera
                    global_variables.selectCamera(true, index);
                    initCameraLeft2();
                    no_of_cameras = 1;

                    index = global_variables.getCameraIndexContaining(cameraFilterName, 1);
                    if (index > -1)
                    {
                        //start running the right camera
                        // note: it's assumed that the device index for the right
                        // camera is immediately after the left one
                        global_variables.selectCamera(false, index);
                        initCameraRight2();
                        no_of_cameras = 2;
                    }

                    // set the driver name
                    cam.DriverName = cameraFilterName;

                    picTitle.Visible = false;
                    cmdStart.Enabled = true;

                    // and lo, the cameras were initialised...
                    startCameraToolStripMenuItem.Enabled = false;
                    global_variables.camera_initialised  = true;
                }
                //else MessageBox.Show("Cannot find a WDM driver for the device known as '" + cameraFilterName + "'.  Are the cameras plugged in ?", "Sentience Demo");

                Redraw();
            }
        }
コード例 #2
0
        private void Bo_Selecta()
        {
            //String IdVentana;

            if (cboCamaras.SelectedItem == null)
            {
                MessageBox.Show("Select an available camera.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                this.Close();
            }

            global_variables.selectCamera(LeftImage, cboCamaras.SelectedIndex);

            this.Dispose();
        }
コード例 #3
0
        private void startSentienceToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // open a calibration file if none was found
            if (!File.Exists(global_variables.calibration_filename))
                OpenCalibrationFile();

            if (File.Exists(global_variables.calibration_filename))
            {
                // load calibration settings
                stereo.LoadCalibration(global_variables.calibration_filename);

                String cameraFilterName = stereo.getCameraDriverName();
                txtCameraDeviceName.Text = cameraFilterName;

                // grab the required camera WDM device name from the text box
                // (hope you remembered to fill that in correctly)
                /*
                string cameraFilterName = txtCameraDeviceName.Text;

                if (cameraFilterName.Contains("#"))
                {
                    String[] s = cameraFilterName.Split('#');
                    cameraFilterName = s[0].Trim();
                }
                 */

                // get the device list index number for this WDM device
                int index = global_variables.getCameraIndexContaining(cameraFilterName, 0);
                if (index > -1)
                {
                    // start running the left camera
                    global_variables.selectCamera(true, index);
                    initCameraLeft2();

                    index = global_variables.getCameraIndexContaining(cameraFilterName, 1);
                    if (index > -1)
                    {
                        //start running the right camera
                        // note: it's assumed that the device index for the right
                        // camera is immediately after the left one
                        global_variables.selectCamera(false, index);
                        initCameraRight2();

                        // do some crap with the menu bar
                        startSentienceToolStripMenuItem.Enabled = false;
                        optomiseToolStripMenuItem.Enabled = false;

                        // and lo, the cameras were initialised...
                        global_variables.camera_initialised = true;

                        tabSentience.SelectedIndex = 1;

                        // and lo, the cameras were initialised...
                        global_variables.camera_initialised = true;
                    }
                    else MessageBox.Show("Cannot find a WDM driver for the right camera device known as '" + cameraFilterName + "'.  Is the right camera plugged in ?", "Sentience Demo");
                }
                else MessageBox.Show("Cannot find a WDM driver for the left camera device known as '" + cameraFilterName + "'.  Is the left camera plugged in ?", "Sentience Demo");
            }
            else MessageBox.Show("Could not locate a calibration file '" + global_variables.calibration_filename + "'", "Sentience Demo");
        }