/// <summary> /// Main working method - runs in loop on Start /// </summary> public override void Job() { Initialize(); //Detach from streamer _publisher.Detach(this); //get current ball coordinates BallCoordinates coordinates = SampleCoordinates(); //show current ball coordinates on screen and GUI System.Drawing.PointF p = TransformAgent.Data.InvertTransform(new System.Drawing.PointF(_x, _y)); Marks.DrawBall(new Point(p.X, p.Y), _ballRadius); Statistics.TryUpdateBasicImageProcessingInfo(String.Format("Generated coordinates: {0}x{1}", _x, _y)); //set current coordinates to update ImagingData.BallCoords = coordinates; //set current coordinates and publish new ball coordinates BallLocationUpdater.UpdateAndNotify(); //attach back to streamer _publisher.Attach(this); }
/// <summary> /// Loop method to run /// </summary> public override void Job() { try { _publisher.Detach(this); using (_currentFrame = _publisher.Data.Clone()) { VerifyDifferentFrameByTimeStamp(_currentFrame.Timestamp); //Performs calibration if required Initialize(); if (IsInitialized) { AnalyzerTool.Begin(); bool detectionResult = _ballTracker.Detect(_currentFrame); AnalyzerTool.Finalize(detectionResult); BallLocationUpdater.UpdateAndNotify(); } } } catch (Exception ex) { Log.Print("Exception in image processing flow: " + ex.Message, eCategory.Debug, LogTag.IMAGE); } finally { _publisher.Attach(this); } }