public void streamGazeData() { _gazePointDataStream.GazePoint((x, y, timestamp) => { sendGazeToLSL(gazeDataOutlet, x, y, timestamp); }); }
private static void CreateAndVisualizeLightlyFilteredGazePointStream() { _gazePointDataStream = _host.Streams.CreateGazePointDataStream(); _gazePointDataStream.GazePoint((x, y, ts) => { Console.WriteLine("Timestamp: {0}\tX:{1}, Y:{2}", ts, x, y); }); }
public void StartDataCollection(int imageIndex) { IsRecording = true; currentIndex = imageIndex; gazePointDataStream = host.Streams.CreateGazePointDataStream(); host.EnableConnection(); gazePointDataStream.GazePoint(RecordGazePointToList); }
public TobiiMouseForm(Host host) { InitializeComponent(); _stream = host.Streams.CreateGazePointDataStream(); // TODO: Exit the program if (_stream == null) { return; } _stream.GazePoint(OnGazeData); _keyboardHook.KeyboardPressed += OnKeyPressed; }
private void CreateAndVisualizeLightlyFilteredGazePointStream() { _gazePointDataStream = _host.Streams.CreateGazePointDataStream(); _gazePointDataStream.GazePoint((x, y, ts) => { if (s1.Count == 0) { s1.Add(ts); } sample[0] = ts - s1[0]; sample[1] = x; sample[2] = y; } ); }
// When form is shown, init gaze monitoring private void TrialForm_Shown(object sender, EventArgs e) { //Refresh gaze drawing if (MainForm.showGaze) { // Init tobii point gaze and get data's pointDataStream = MainForm.tobii4C.Streams.CreateGazePointDataStream(); pointDataStream.GazePoint((x, y, ts) => { eyeX = x; eyeY = y; }); // Init gaze pointer refresh thread gazeThread = new Thread(new ThreadStart(GazeRefreshThread)) { IsBackground = true }; gazeThread.Start(); } }
private void StartButton_Click(object sender, EventArgs e) { StartOverButton_Click(sender, e); fsFIX = new FileStream(@"C: \Users\CTS\Desktop\testFIX.txt", FileMode.Create, FileAccess.Write); fsSAC = new FileStream(@"C: \Users\CTS\Desktop\testSAC.txt", FileMode.Create, FileAccess.Write); swFIX = new StreamWriter(fsFIX); swSAC = new StreamWriter(fsSAC); hostFIX = new Host(); hostSAC = new Host(); fixationDataStream = hostFIX.Streams.CreateFixationDataStream(Tobii.Interaction.Framework.FixationDataMode.Slow); gazePointDataStream = hostSAC.Streams.CreateGazePointDataStream(); fixationDataStream.Data((x, y, timestamp) => addToTXTFIX(x, y, timestamp)); gazePointDataStream.GazePoint((x, y, ts) => addToTXTSAC(x, y, ts)); }
//end of imports for mouse clicks public Mouse() { posX = 0; posY = 0; cursorX = 0; cursorY = 0; longGazeCount = 0; resetCount = 0; isCursorActive = false; isMoveSlowly = false; isClickActive = false; isClickActive2 = false; isInSquareAlways = true; isLeftClick = false; isRightClick = false; gazePointDataStream.GazePoint((gazePointX, gazePointY, _) => { posX = (int)gazePointX; posY = (int)gazePointY; }); }
private static void CreateAndVisualizeLightlyFilteredGazePointStream() { _gazePointDataStream = _host.Streams.CreateGazePointDataStream(); _gazePointDataStream.GazePoint((x, y, ts) => { // Console.WriteLine("Timestamp: {0}\tX:{1}, Y:{2}", ts, x, y); s1.Add(ts); time_st = ts - s1[0]; eye_x = x; eye_y = y; if (band) { using (StreamWriter sw = File.AppendText(@"C:\Users\Inf-CG\Documents\raw_eye.txt")) { sw.WriteLine((ts - s1[0]).ToString("0.#").Replace(",", ".") + ";" + x.ToString("0.##").Replace(",", ".") + ";" + y.ToString("0.##").Replace(",", ".")); } } }); }
private void btnStartStop_Click(object sender, RoutedEventArgs e) { //если отслеживание не запущено if (isEnabled == false) { //если координаты не заданы if (leftUpX == -1 || leftUpY == -1 || rightDownX == -1 || rightDownY == -1) { //сообщить, что координаты не заданы labelEyesCoordinates.Text = "Область отслеживания не выбрана"; } //иначе else { //начать отслеживание взгляда... isEnabled = true; btnStartStop.Content = "Закончить отслеживание"; gazePointDataStream = host.Streams.CreateGazePointDataStream(); host.EnableConnection(); gazePointDataStream.GazePoint(RecordGazePointToList); } } //иначе else { //прекратить отслеживание взгляда... isEnabled = false; sp.Stop(); if (cts != null) { cts.Cancel(); } btnStartStop.Content = "Начать отслеживание"; host.DisableConnection(); gazeStream.Abort(); labelEyesCoordinates.Text = ""; if (labelAlert.Visibility == Visibility.Visible) { labelAlert.Visibility = Visibility.Hidden; } } }
private void GetGazePointTimer_Tick(object sender, EventArgs e) { // 抓眼動位置及儲存 stream.GazePoint((x, y, ts) => CopyToGlobalVariable(x, y, ts)); // Clipping 到螢幕中 ClippingToScreenSize(); // 代表資料不一樣 // 要覆蓋 last 的值 if (lastTimeStamp != timeStamp) { // 使用 Double Exp MathUtil.Vector2 tempVector2 = DoubleExpFilter(new MathUtil.Vector2(eyeX, eyeY)); eyeX = tempVector2.X; eyeY = tempVector2.Y; lastEyeX = eyeX; lastEyeY = eyeY; lastTimeStamp = timeStamp; // 是否要被眼動儀 Control if (IsEnableControl) { SetCursorPos((int)eyeX, (int)eyeY); // 點擊判斷 if (MathUtil.Vector2.Distance(clickTempVector, tempVector2) > FreezeDistanceToClick) { clickTempVector = tempVector2; clickTime = 0; } else if ((float)(clickTime * GetGazePointTimer.Interval) / 1000 > FreezeTimeToClick) { if (IsSingleClickModel) { DoSingleClick(); } else { DoDoubleClick(); } clickTempVector = tempVector2; clickTime = 0; } else { clickTime++; } } #region 記錄相關 if (IsRecording) { string line = eyeX.ToString() + "," + eyeY.ToString() + "," + timeStamp.ToString(); LineData.Add(line); if (TryToUnRecording) { // 要暫停 Hook 不然會無法使用鍵盤打檔名 GetGazePointTimer.Enabled = false; UnHook(); // 找到位置,並儲存 if (outputFileDialog.ShowDialog() == DialogResult.OK) { // 寫出檔案 string outputStr = "X, Y, TimeStamp\n"; for (int i = 0; i < LineData.Count; i++) { outputStr += LineData[i] + "\n"; } System.IO.File.WriteAllText(outputFileDialog.FileName, outputStr); } LineData.Clear(); // 繼續抓 GetGazePointTimer.Enabled = true; SetHook(); TryToUnRecording = false; IsRecording = false; } } #endregion } }
public Point GetGaze() { gazePointDataStream.GazePoint(RegisterGaze); return(lastGaze); }
static void startStreamData(GazePointDataStream currentTobiiStream) { GazePointDataStream gazeStream = currentTobiiStream.GazePoint((x, y, ts) => { currentPoint.x = x; currentPoint.y = y; }); return; }
public void reinitializeGazePoint() { gazePointDataStream = host.Streams.CreateGazePointDataStream(); gazePointDataStream.GazePoint((gazePointX, gazePointY, _) => { posX = (int)gazePointX; posY = (int)gazePointY; }); }