public MainForm() { InitializeComponent(); this.Closing += MainForm_Closing; //spinningTriangleControl.MouseDown += new MouseEventHandler(spinningTriangleControl_MouseDown); spinningTriangleControl.MouseMove += new MouseEventHandler(spinningTriangleControl_MouseMove); spinningTriangleControl.MouseWheel += new MouseEventHandler(spinningTriangleControl_MouseWheel); //Get the number of Cameras available numCameras = WebCamEye.GetNumCameras(); //create listbox items int simpletrakerImageHeight = 150; for (int i = 0; i < numCameras; i++) { WebCamEye thiscam = new WebCamEye(i); lCalibTracks.Add(new WebCamTrack()); lWebCams.Add(thiscam); //Fill in the checklist lstBoxCameras.Items.Add("Camera " + i); PictureBox thisPictureBox = new PictureBox(); thisPictureBox.Top = i * (simpletrakerImageHeight + 5); thisPictureBox.Width = simpletrakerImageHeight; thisPictureBox.Height = simpletrakerImageHeight; Bitmap thisbitmap = new Bitmap(simpletrakerImageHeight, simpletrakerImageHeight); thisPictureBox.Image = thisbitmap; lSimpleTrackPictureBox.Add(thisPictureBox); pnlWebCamTrack.Controls.Add(thisPictureBox); } //Setup a thread to update the simple track images periodically trackImagesTimer = new Timer(); trackImagesTimer.Tick += new EventHandler(Update_SimpleTrackImages); trackImagesTimer.Interval = 100; // in miliseconds trackImagesTimer.Start(); //If the directory for the calibrations does not exist, create it if (!System.IO.Directory.Exists(Directory.GetCurrentDirectory() + @"\Calibrations")) { System.IO.Directory.CreateDirectory(Directory.GetCurrentDirectory() + @"\Calibrations"); } //read the calibration file to add previous calibrations: ReadCalibrationsfile(); //chkListBoxCameras.SelectedIndex = 0; if (lWebCams.Count > 0) { trackBarThreshold.Value = lWebCams[0].thresMag; trk2DClusterThreshold.Value = lWebCams[0].ClusterDistance; } }
public MainForm() { InitializeComponent(); this.Closing += MainForm_Closing; //spinningTriangleControl.MouseDown += new MouseEventHandler(spinningTriangleControl_MouseDown); spinningTriangleControl.MouseMove +=new MouseEventHandler(spinningTriangleControl_MouseMove); spinningTriangleControl.MouseWheel += new MouseEventHandler(spinningTriangleControl_MouseWheel); //Get the number of Cameras available numCameras = WebCamEye.GetNumCameras(); //create listbox items int simpletrakerImageHeight = 150; for (int i = 0; i < numCameras; i++) { WebCamEye thiscam = new WebCamEye(i); lCalibTracks.Add(new WebCamTrack()); lWebCams.Add(thiscam); //Fill in the checklist lstBoxCameras.Items.Add("Camera " + i); PictureBox thisPictureBox = new PictureBox(); thisPictureBox.Top = i * (simpletrakerImageHeight + 5); thisPictureBox.Width = simpletrakerImageHeight; thisPictureBox.Height = simpletrakerImageHeight; Bitmap thisbitmap = new Bitmap(simpletrakerImageHeight, simpletrakerImageHeight); thisPictureBox.Image = thisbitmap; lSimpleTrackPictureBox.Add(thisPictureBox); pnlWebCamTrack.Controls.Add(thisPictureBox); } //Setup a thread to update the simple track images periodically trackImagesTimer = new Timer(); trackImagesTimer.Tick += new EventHandler(Update_SimpleTrackImages); trackImagesTimer.Interval = 100; // in miliseconds trackImagesTimer.Start(); //If the directory for the calibrations does not exist, create it if (!System.IO.Directory.Exists(Directory.GetCurrentDirectory() + @"\Calibrations")) { System.IO.Directory.CreateDirectory(Directory.GetCurrentDirectory() + @"\Calibrations"); } //read the calibration file to add previous calibrations: ReadCalibrationsfile(); //chkListBoxCameras.SelectedIndex = 0; if (lWebCams.Count > 0) { trackBarThreshold.Value = lWebCams[0].thresMag; trk2DClusterThreshold.Value = lWebCams[0].ClusterDistance; } }
private void button1_Click(object sender, EventArgs e) { WebCamEye thiscam1 = new WebCamEye(0); WebCamEye thiscam2 = new WebCamEye(1); WebCamEye thiscam3 = new WebCamEye(2); WebCamEye thiscam4 = new WebCamEye(3); lCalibTracks.Add(new WebCamTrack()); lCalibTracks.Add(new WebCamTrack()); lCalibTracks.Add(new WebCamTrack()); lCalibTracks.Add(new WebCamTrack()); lWebCams.Add(thiscam1); lWebCams.Add(thiscam2); lWebCams.Add(thiscam3); lWebCams.Add(thiscam4); trackBarThreshold.Value = lWebCams[0].thresMag; trk2DClusterThreshold.Value = lWebCams[0].ClusterDistance; }