/// <summary> //This method has the Action that will be run once a fixation is confirmed passed in and stored in SelectedFicationAction. It also sets the state to RunningFixationDetection, //which sets logic in RunSelectedActionAtFixation to run on fixationPointDataStream.Next events. /// </summary> public void StartDetectingFixation() { customfixStream.ResetFixationDetectionState(); pointSmootherWorker = CreateSmoother(pointSmootherBufferSize); //Console.WriteLine("Start detection call"); fixationState = EFixationState.DetectingFixation; timeOutTimer.Start(); }
/// <summary> /// This method of is run on gaze events, checks if it is the beginning or end of a fixation and runs appropriate code. /// </summary> /// <param name="o"></param> /// <param name="fixationDataBucket"></param> private void detectFixation(object o, CustomFixationEventArgs fixationDataBucket) { //Check if FixationDetection needs to be monitoring CustomFixation data stream. if (fixationState == EFixationState.DetectingFixation) { GazePoint currentSmoothPoint; //If databucket state is the start of a fixation if (fixationDataBucket.Status == EFixationStreamEventType.Start) { fixationTimer.Start(); //increment timeout interval so a fixation doesn't get cut off. timeOutTimer.Interval += FixationDetectionTimeLength + FixationExtensionBuffer;; // Console.WriteLine(timeOutTimer.Interval); fixationProgressStartTimeStamp = fixationDataBucket.TimeStamp; //Instantiate new point smoother, this clears out and previous in the ring buffer. pointSmootherWorker = CreateSmoother(pointSmootherBufferSize); //Console.WriteLine("Fixation Begin X" + fixationDataBucket.X + " Y" + fixationDataBucket.Y); } //if fixation data is in the middle of a fixation, use the data returned to highlight progress and draw users current gaze location to the screen. if (fixationDataBucket.Status == EFixationStreamEventType.Middle) { //Check if point smoothing is required. if (usePointSmoother) { //Data smoothing being done in CustomFixationDectection, currentSmoothPoint = pointSmootherWorker.UpdateAndGetSmoothPoint(fixationDataBucket.X, fixationDataBucket.Y); xPosFixation = (int)Math.Floor(currentSmoothPoint.X); yPosFixation = (int)Math.Floor(currentSmoothPoint.Y); } else { //Slightly smoothed data from the Customfixation data stream xPosFixation = (int)Math.Floor(fixationDataBucket.X); yPosFixation = (int)Math.Floor(fixationDataBucket.Y); } // calculateFixationProgressPercent(fixationDataBucket.TimeStamp); onFixationProgressEvent(fixationDataBucket.TimeStamp, xPosFixation, yPosFixation); } //if the fixation ends before the fixation timer completes, reset the fixation timer. if (fixationDataBucket.Status == EFixationStreamEventType.End) { fixationTimer.Stop(); //customfixStream.ResetFixationDetectionState(); //Debug //Console.WriteLine("Fixation Stopped due to end datatype"); } } }
public DrawingForm() { InitializeComponent(); ShowInTaskbar = false; smoother = CreateSmoother(); // If wanting to draw a fillEllipse, or re-introduce gazeHighlight // then un-comment the below line to set size // highlightSize = new Size(40, 40); currentGaze = new Point(); history = new List <Point>(); // Load the user feedback image crosshairImage = GetCrossHairImage((CrossHair)Program.readSettings.Crosshair); }
public void ClearForm() { Refresh(); Hide(); smoother = CreateSmoother(); }