public AnalysisCreationWizard(Form creator, Court court, List<Camera> cameraList, Ball ball, int panel) { this.creator = creator; this.court = court; this.cameraList = cameraList; this.ball = ball; this.currentStep = panel; InitializeComponent(); }
public decimal PredictFrame(Ball b, int frame) { Image<Bgr, byte> frameImg = video.GetFrame(Camera.StartFrame + frame); ErodeDilateSimplifier s = new ErodeDilateSimplifier(Camera.Iterations); BgrThresholdsDetector d = new BgrThresholdsDetector(Camera.MinimumThresholds, Camera.MaximumThresholds); Image<Bgr, byte> simplifiedFrame = s.Simplify(frameImg); Blob prediction = d.Detect(simplifiedFrame); if (prediction != null) { int apparentWidth = (prediction.Contour.BoundingRectangle.Width + prediction.Contour.BoundingRectangle.Height) / 2; Distances[frame] = Camera.FocalLength / apparentWidth * b.Diameter; } else { Distances[frame] = -1; // Ball could not be located in the frame } return Distances[frame]; }
private void nextBtn_Click(object sender, EventArgs e) { // Store court properties if (currentStep == 2) { court = new Court(); ball = new Ball(); court.Width = court_width.Value; court.Height = court_height.Value; ball.Diameter = (int)ball_size.Value; } if (currentStep == totalPanels) { Finish(); } else { DisplayPanel(++currentStep); } }
public void Predict(Ball b) { // TODO: The weightings of the final prediction should be based on an inverse square law on the ball // diameter or inverse relationship of the area }