public Configuration() { // defaults calibration = null; calibration_corners = new PointF[4]; camera_index = 0; teama = new Team("Team1", new Person("", "", Person.DefaultPosition.Left, Person.Role.Player), new Person("", "", Person.DefaultPosition.Right, Person.Role.Player)); teamb = new Team("Team2", new Person("", "", Person.DefaultPosition.Left, Person.Role.Player), new Person("", "", Person.DefaultPosition.Right, Person.Role.Player)); teamAup = false; teama.Player1.Current_position = Rally.PlayerPosition.lowerLeft; teama.Player2.Current_position = Rally.PlayerPosition.lowerRight; teamb.Player1.Current_position = Rally.PlayerPosition.upperLeft; teamb.Player2.Current_position = Rally.PlayerPosition.upperRight; location = ""; tournamentType = ""; freeText = ""; outputDir = ""; gameID = ""; loadXmlFile = "Please choose a XML file"; }
public Calibration createNewCalibration(Size birdview_size, Size videoframe_size) { Calibration new_calibration = new Calibration(videoframe_size); PointF point = corners[0]; // up left new_calibration.addMapping(point.X, point.Y, 0, 0, 0); point = corners[1]; // up right new_calibration.addMapping(point.X, point.Y, field_width, 0, 0); point = corners[2]; // down right new_calibration.addMapping(point.X, point.Y, field_width, field_height, 0); point = corners[3]; // down left new_calibration.addMapping(point.X, point.Y, 0, field_height, 0); return new_calibration; }
/*************************************** VIDEO STUFF END ******************************************************************/ /**********************************************************************************************************************************/ /************************************* CALIBRATION STUFF **************************************************************************/ // This is called in the Configuration form uppon apply. public void setCalibration(Calibration c) { calibration = c; if (calibration != null) { toolStripStatusLabel_calibration.Text = "Camera is calibrated"; toolStripStatusLabel_calibration.ForeColor = Color.Green; checkBox_calibrationlines.Enabled = true; } else { toolStripStatusLabel_calibration.Text = "Camera is not calibrated"; toolStripStatusLabel_calibration.ForeColor = Color.Red; checkBox_calibrationlines.Enabled = false; } pictureBox_reviewercamera.Refresh(); // to draw the calibratio lines }
public void showCalibrationStep(int step) { if (step == 0) // reset all the calibration stuff { toolStripStatusLabel_calibration.Text = "not calibrated"; toolStripStatusLabel_calibration.ForeColor = Color.Red; label_calibrationstep1.ForeColor = Color.Black; label_calibrationstep2.ForeColor = Color.Black; label_calibrationstep3.ForeColor = Color.Black; label_calibrationstep4.ForeColor = Color.Black; label_calibrationstep1.Enabled = false; label_calibrationstep2.Enabled = false; label_calibrationstep3.Enabled = false; label_calibrationstep4.Enabled = false; progressBar_calibrationsteps.Visible = false; progressBar_calibrationsteps.Value = 0; pictureBox_arrowstep1.Visible = false; pictureBox_arrowstep2.Visible = false; pictureBox_arrowstep3.Visible = false; pictureBox_arrowstep4.Visible = false; corner_count = 0; corners = new PointF[4]; } if (step == 1) { toolStripStatusLabel_calibration.Text = "not calibrated"; toolStripStatusLabel_calibration.ForeColor = Color.Red; label_calibrationstep1.ForeColor = Color.Black; label_calibrationstep2.ForeColor = Color.Black; label_calibrationstep3.ForeColor = Color.Black; label_calibrationstep4.ForeColor = Color.Black; //show calibration steps (only the first) label_calibrationstep1.Enabled = true; label_calibrationstep2.Enabled = false; label_calibrationstep3.Enabled = false; label_calibrationstep4.Enabled = false; progressBar_calibrationsteps.Visible = true; progressBar_calibrationsteps.Value = 0; pictureBox_arrowstep1.Visible = true; pictureBox_arrowstep2.Visible = false; pictureBox_arrowstep3.Visible = false; pictureBox_arrowstep4.Visible = false; } if (step == 2) { label_calibrationstep1.Enabled = false; label_calibrationstep2.Enabled = true; label_calibrationstep3.Enabled = false; label_calibrationstep4.Enabled = false; progressBar_calibrationsteps.Visible = true; pictureBox_arrowstep1.Visible = false; pictureBox_arrowstep2.Visible = true; pictureBox_arrowstep3.Visible = false; pictureBox_arrowstep4.Visible = false; } if (step == 3) { label_calibrationstep1.Enabled = false; label_calibrationstep2.Enabled = false; label_calibrationstep3.Enabled = true; label_calibrationstep4.Enabled = false; progressBar_calibrationsteps.Visible = true; pictureBox_arrowstep1.Visible = false; pictureBox_arrowstep2.Visible = false; pictureBox_arrowstep3.Visible = true; pictureBox_arrowstep4.Visible = false; pictureBox_reviewercamera.Refresh(); } if (step == 4) { label_calibrationstep1.Enabled = false; label_calibrationstep2.Enabled = false; label_calibrationstep3.Enabled = false; label_calibrationstep4.Enabled = true; progressBar_calibrationsteps.Visible = true; pictureBox_arrowstep1.Visible = false; pictureBox_arrowstep2.Visible = false; pictureBox_arrowstep3.Visible = false; pictureBox_arrowstep4.Visible = true; pictureBox_reviewercamera.Refresh(); } if (step == 5) //finished calibration { label_calibrationstep1.Enabled = true; label_calibrationstep2.Enabled = true; label_calibrationstep3.Enabled = true; label_calibrationstep4.Enabled = true; label_calibrationstep1.ForeColor = Color.Green; label_calibrationstep2.ForeColor = Color.Green; label_calibrationstep3.ForeColor = Color.Green; label_calibrationstep4.ForeColor = Color.Green; progressBar_calibrationsteps.Visible = false; pictureBox_arrowstep1.Visible = false; pictureBox_arrowstep2.Visible = false; pictureBox_arrowstep3.Visible = false; pictureBox_arrowstep4.Visible = false; draw_cornerlines_incalibrationbox(corners[2], corners[3]); draw_cornerlines_incalibrationbox(corners[3], corners[0]); toolStripStatusLabel_calibration.Text = "calibrated"; toolStripStatusLabel_calibration.ForeColor = Color.Green; calibrating = false; if (corner_count == 4) // create a new calibration on the first time calibration = createNewCalibration(pictureBox_birdview.Size, new Size(640, 480)); if (game.Reviewing_rally.Service_pos.ImageX != 0 && game.Reviewing_rally.Service_pos.ImageY != 0) { editing_position = 0; savePosition(game.Reviewing_rally.Service_pos.ImageX, game.Reviewing_rally.Service_pos.ImageY); } if (game.Reviewing_rally.Defence_pos.ImageX != 0 && game.Reviewing_rally.Defence_pos.ImageY != 0) { editing_position = 5; savePosition(game.Reviewing_rally.Defence_pos.ImageX, game.Reviewing_rally.Defence_pos.ImageY); } listView_reviewertrackedpoints.Focus(); } }