private void InitCameras() { stereo_camera = new WebcamVisionStereoWin(left_camera_device_index.ToString(), right_camera_device_index.ToString(), 10010, frames_per_sec); stereo_camera.window = this; stereo_camera.display_image[0] = picLeftImage; stereo_camera.display_image[1] = picRightImage; stereo_camera.Load(calibration_filename); stereo_camera.image_width = image_width; stereo_camera.image_height = image_height; stereo_camera.min_exposure = min_exposure; stereo_camera.max_exposure = max_exposure; stereo_camera.use_media_pause = use_pause; stereo_camera.endless_thread = false; if (!File.Exists(calibration_filename)) { stereo_camera.Save(calibration_filename); stereo_camera.disable_rectification = true; stereo_camera.disable_radial_correction = true; } disable_rectification = stereo_camera.disable_rectification; disable_radial_correction = stereo_camera.disable_radial_correction; stereo_camera.Run(); dissableRectificationToolStripMenuItem.Checked = disable_rectification; disableRadialCorrectionToolStripMenuItem.Checked = disable_radial_correction; }
private void calibrateCameraAlignmentToolStripMenuItem_Click(object sender, EventArgs e) { // stop the cameras in order avoid thread collisions stereo_camera.Stop(); for (int i = 0; i < 100; i++) { System.Threading.Thread.Sleep(5); } if (stereo_camera.CalibrateCameraAlignment()) { stereo_camera.Save(calibration_filename); ShowMessage("Calibration complete"); } else { ShowMessage("Please individually calibrate left and right cameras before the calibrating the focus"); } // restart the cameras stereo_camera.Run(); }