コード例 #1
0
        //開啟
        private void EyeTrackerTookit_Load(object sender, EventArgs e)
        {
            // 設定視窗在右下角
            SetFormToRightCorner();

            // 設定眼動儀
            host   = new Host();
            stream = host.Streams.CreateGazePointDataStream();

            // 設定全部 Scroll Bar 的初始值
            InitScrollBarValue();

            // 設定游標
            SetupSystemCursorImage();

            // 設定鍵盤 Hook
            SetHook();

            // 設定 static 變數,給 Hook 的時候使用
            ZText = ZFunctionText;
            XText = XFunctionText;

            // 設定文字
            if (Screen.PrimaryScreen.Bounds.Width != 1920 || Screen.PrimaryScreen.Bounds.Height != 1080)
            {
                IntroductionText.Text = "說明:\n" +
                                        "目前為 " + Screen.PrimaryScreen.Bounds.Width.ToString() + "x" + Screen.PrimaryScreen.Bounds.Height.ToString() + " 的解析度:\n" +
                                        "以下是快捷鍵的說明:\n" +
                                        "Z =>開啟 / 關閉眼動操控游標的功能\n" +
                                        "X =>切換單擊 / 雙擊的 Mode\n" +
                                        "C =>是否要開始寫檔";
            }
        }
コード例 #2
0
 public TobiiGazeSource()
 {
     EyeXHost                  = new EyeXHost();
     GazePointDataStream       = EyeXHost.CreateGazePointDataStream(GazePointDataMode.Unfiltered);
     GazePointDataStream.Next += GazeData;
     EyeXHost.Start();
 }
コード例 #3
0
 //starts a fixation data stream (class constructor)
 public _Tobii()
 {
     //create connection to Tobii Eyetracker
     _host = new Host();
     _fixationDataStream  = _host.Streams.CreateFixationDataStream();
     _gazePointDataStream = _host.Streams.CreateGazePointDataStream();
 }
コード例 #4
0
 public void StartGazeDataStreams(GazePointCallback gazePointCallback, FixationCallback fixationCallback, EyePositionCallback eyePositionCallback)
 {
     if (gazePointCallback != null)
     {
         if (gazePointDataStream == null)
         {
             gazePointDataStream = eyeXHost.CreateGazePointDataStream(Tobii.EyeX.Framework.GazePointDataMode.Unfiltered);
         }
         gazePointDataStream.Next += InvokeGazePointEvent;
         GazePointEvent           += gazePointCallback;
         GazePointEvent           += RecordGazePoint;
     }
     if (fixationCallback != null)
     {
         if (fixationDataStream == null)
         {
             fixationDataStream = eyeXHost.CreateFixationDataStream(FixationDataMode.Sensitive);
         }
         fixationDataStream.Next += InvokeFixationEvent;
         FixationEvent           += fixationCallback;
         FixationEvent           += RecordFixation;
     }
     if (eyePositionCallback != null)
     {
         if (eyePositionDataStream == null)
         {
             eyePositionDataStream = eyeXHost.CreateEyePositionDataStream();
         }
         eyePositionDataStream.Next += InvokeEyePositionEvent;
         EyePositionEvent           += eyePositionCallback;
         EyePositionEvent           += RecordEyePosition;
     }
 }
コード例 #5
0
        public static int startTracker()
        {
            var status = Globs.NO_STATUS;

            if (Globs.tracker == null || !Globs.tracker.IsStarted)
            {
                if (Globs.tracker != null)
                {
                    Globs.tracker.Dispose();
                }

                Globs.tracker = new EyeXHost();
                status        = startHost(Globs.tracker);
            }

            if (status != Globs.TRACKER_ACTIVATED && status != Globs.TRACKER_ENGINE_OUTDATED)
            {
                return(status);
            }

            if (gazeStream != null)
            {
                gazeStream.Dispose();
            }

            gazeStream = Globs.tracker.CreateGazePointDataStream(GazePointDataMode.LightlyFiltered);
            var gazeListener = new GazeListener();

            gazeStream.Next += (s, e) => gazeListener.onGazeChanged(s, e);

            return(Globs.TRACKER_ACTIVATED);
        }
コード例 #6
0
        //Constructor
        public ScrollControl(int scrollStepTimerDuration, int InitialScrollScalarValue, int deadZoneHorizontalPercent, int deadZoneVerticalPercent, FormsEyeXHost EyeXHost)
        {
            //set scroll step timer duration.
            ScrollStepTimerDuration = scrollStepTimerDuration;

            //Connect to eyeX engine gaze stream.
            gazeStream = EyeXHost.CreateGazePointDataStream(GazePointDataMode.LightlyFiltered);

            //Create gate points event handler delegate
            EventHandler <GazePointEventArgs> gazeDel = new EventHandler <GazePointEventArgs>(updateGazeCoodinates);

            //register delegate with gaze data stream next event.
            gazeStream.Next += gazeDel;

            //set up scroll step timer
            scrollStepTimer = new Timer(ScrollStepTimerDuration);
            //Set to auto reset so that it fires events continuously at the ScrollStepTimerDuration
            scrollStepTimer.AutoReset = true;

            //Register scroll method with timer elapsed event.
            scrollStepTimer.Elapsed += scroll;

            //Set initial deadzone size of screen percent.
            DeadZoneHorizontalPercent = deadZoneHorizontalPercent;
            DeadZoneVerticalPercent   = deadZoneVerticalPercent;

            //run SetDeadZoneBounds method to set up the deadZoneRect field initially.
            SetDeadZoneBounds();

            //pass in ScrollscalarValue, this will be set by the users saved settings.
            ScrollScalarValue = InitialScrollScalarValue;
        }
コード例 #7
0
        public ZoomMagnifier(Form displayform, Point fixationPoint)
        {
            ZOOM_MAX      = Program.readSettings.maxZoom;               //Max zoom amount
            Magnification = DO_ZOOM ? 1 : Program.readSettings.maxZoom; //Set magnification to the max if not zooming
            form          = displayform;
            form.TopMost  = true;
            updateTimer   = new Timer();

            FixationPoint = fixationPoint;
            InitLens();

            //Event handlers
            form.Resize      += new EventHandler(form_Resize);
            form.FormClosing += new FormClosingEventHandler(form_FormClosing);
            updateTimer.Tick += new EventHandler(timer_Tick);

            updateTimer.Interval = UPDATE_SPEED;
            updateTimer.Enabled  = false;
            Offset          = new Point(0, 0);
            SecondaryOffset = new Point(0, 0);

            eyeXHost = new FormsEyeXHost();
            eyeXHost.Start();
            gazeStream       = eyeXHost.CreateGazePointDataStream(GazePointDataMode.LightlyFiltered);
            gazeStream.Next += (s, e) => SetLook(e.X, e.Y);

            form.Left   = -4000;
            form.Top    = -5000;
            form.Width  = 1;
            form.Height = 1;
        }
コード例 #8
0
ファイル: App.xaml.cs プロジェクト: bcsedlon/EyeCom
        protected override void OnStartup(StartupEventArgs e)
        {
            _host = new Host();
            _wpfInteractorAgent = _host.InitializeWpfAgent();

            gazePointDataStream = _host.Streams.CreateGazePointDataStream();
        }
コード例 #9
0
ファイル: StreamHandlers.cs プロジェクト: t-l-k/IOWrapper
        public GazePointHandler()
        {
            Host = new Host();
            _gazePointDataStream = Host.Streams.CreateGazePointDataStream(Tobii.Interaction.Framework.GazePointDataMode.LightlyFiltered);

            double x = 0, y = 0;
            var    watch = new Stopwatch();

            watch.Start();
            while ((x == 0 || y == 0) && watch.ElapsedMilliseconds < 100)
            {
                var max = Host.States.GetScreenBoundsAsync().Result;
                x = max.Value.Width;
                y = max.Value.Height;
            }

            if (x == 0 || y == 0)
            {
                const string msg = "Tobii GazePoint handler unable to get screen size within 100 ms, not starting watcher";
                Logger.Log($"WARNING: {msg}");
                throw new Exception(msg);
            }
            _scaleFactors[0]           = 65535 / x;
            _scaleFactors[1]           = 65535 / y;
            _gazePointDataStream.Next += GPCallback;
        }
コード例 #10
0
        public void Start()
        {
            Host       = new EyeXHost();
            DataStream = Host.CreateGazePointDataStream(GazePointDataMode.LightlyFiltered);

            Host.Start();
            DataStream.Next += SimpanPosisiMata;
        }
コード例 #11
0
ファイル: Program.cs プロジェクト: julianxywu/thesis
 private static void CreateAndVisualizeLightlyFilteredGazePointStream()
 {
     _gazePointDataStream = _host.Streams.CreateGazePointDataStream();
     _gazePointDataStream.GazePoint((x, y, ts) =>
     {
         Console.WriteLine("Timestamp: {0}\tX:{1}, Y:{2}", ts, x, y);
     });
 }
コード例 #12
0
        public void Start()         //menyalakan Eyetracker dan mulai tracking
        {
            Host       = new EyeXHost();
            DataStream = Host.CreateGazePointDataStream(GazePointDataMode.LightlyFiltered);

            Host.Start();                               //mulai tracking mata
            DataStream.Next += SimpanPosisiMata;        //menyimpan data mata
        }
コード例 #13
0
        /*************************EYE_X_COMPONENT.INIT********************/

        /*
         * Receive method for the EyeX gaze data stream.
         */
        private void ReceiveGazeData(Envelope e)
        {
            using (gazeDataStream = host.CreateGazePointDataStream(GazePointDataMode.LightlyFiltered))
            {
                Console.WriteLine("EyeX data stream initiated.");

                gazePoint.Post(gazeDataStream, e.OriginatingTime);

                using (eyePositionStream = host.CreateEyePositionDataStream())
                {
                    Console.WriteLine("EyeX eye position stream initiated.");

                    eyeData.Post(eyePositionStream, e.OriginatingTime);

                    gazeDataStream.Next += (s, q) =>
                    {
                        frameDataX = q.X;
                        frameDataY = q.Y;
                    };

                    eyePositionStream.Next += (s, q) =>
                    {
                        leftEyeX = q.LeftEye.X;
                        leftEyeY = q.LeftEye.Y;
                        leftEyeZ = q.LeftEye.Z;

                        leftEyeNormalizedX = q.LeftEyeNormalized.X;
                        leftEyeNormalizedY = q.LeftEyeNormalized.Y;
                        leftEyeNormalizedZ = q.LeftEyeNormalized.Z;

                        rightEyeX = q.RightEye.X;
                        rightEyeY = q.RightEye.Y;
                        rightEyeZ = q.RightEye.Z;

                        rightEyeNormalizedX = q.RightEyeNormalized.X;
                        rightEyeNormalizedY = q.RightEyeNormalized.Y;
                        rightEyeNormalizedZ = q.RightEyeNormalized.Z;
                    };

                    Console.WriteLine("Listening for gaze data...");

                    using (FixationDataStream fixationStream = host.CreateFixationDataStream(FixationDataMode.Sensitive))
                    {
                        fixationData.Post(fixationStream, e.OriginatingTime);

                        fixationStream.Next += (s, q) =>
                        {
                            fixationX = q.X;
                            fixationY = q.Y;
                        };

                        Console.WriteLine("Recording fixation points...");
                        Console.In.Read();
                    }
                }
            }
        }
コード例 #14
0
        public void StartDataCollection(int imageIndex)
        {
            IsRecording  = true;
            currentIndex = imageIndex;

            gazePointDataStream = host.Streams.CreateGazePointDataStream();
            host.EnableConnection();
            gazePointDataStream.GazePoint(RecordGazePointToList);
        }
コード例 #15
0
        public webBro()
        {
            InitializeComponent();
            InitBrowser();

            synth.SetOutputToDefaultAudioDevice();
            synth.SpeakCompleted += synth_SpeakCompleted;

            rgx = new Regex(pattern);

            try
            {
                defaultStyle    = File.ReadAllText(".\\Data\\style.css");
                monochromeStyle = File.ReadAllText(".\\Data\\monochrome.css");
                style           = defaultStyle;
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }

            eyeXHost = new EyeXHost();
            eyeXHost.Start();
            stream       = eyeXHost.CreateGazePointDataStream(Tobii.EyeX.Framework.GazePointDataMode.Unfiltered);
            stream.Next += (s, e) =>
            {
                setPos((int)e.X, (int)e.Y);
            };
            position       = eyeXHost.CreateEyePositionDataStream();
            position.Next += (s, e) =>
            {
                leftClose  = e.LeftEye.X == 0 && e.LeftEye.Y == 0;
                rightClose = e.RightEye.X == 0 && e.RightEye.Y == 0;
            };

            controller = new Controller();
            listener   = new LeapEventListener(this);
            controller.AddListener(listener);

            if (File.Exists("parameters.cfg"))
            {
                StreamReader sr = new StreamReader("parameters.cfg");
                fingerMove.Checked = sr.ReadLine() == "1";
                keyCheck.Checked   = sr.ReadLine() == "1";
                borderLeft         = float.Parse(sr.ReadLine());
                borderUp           = float.Parse(sr.ReadLine());
                borderRight        = float.Parse(sr.ReadLine());
                borderDown         = float.Parse(sr.ReadLine());
                sr.Close();

                if (borderLeft != -200)
                {
                    firstLeap = false;
                }
            }
        }
コード例 #16
0
    public TobiiInteractionEngineTracker()
    {
        _host = new EyeXHost();
        _host.Start();
        _lightlyFilteredGazePointDataProvider = _host.CreateGazePointDataStream(GazePointDataMode.LightlyFiltered);
        _lightlyFilteredGazePointDataProvider.Next += NewGazePoint;

        AspectRatio = 16f / 9f;
        IsHeadTracking = false;
    }
コード例 #17
0
ファイル: Program.cs プロジェクト: julianxywu/thesis
        private static void CreateAndVisualizeUnfilteredGazePointStream()
        {
            if (_gazePointDataStream != null)
            {
                _gazePointDataStream.Next -= OnNextGazePoint;
            }

            _gazePointDataStream       = _host.Streams.CreateGazePointDataStream(GazePointDataMode.Unfiltered);
            _gazePointDataStream.Next += OnNextGazePoint;
        }
コード例 #18
0
        private void StartEyeStream()
        {
            _eyeXHost = new EyeXHost();
            _lightlyFilteredGazeDataStream = _eyeXHost.CreateGazePointDataStream(GazePointDataMode.LightlyFiltered);
            _eyeXHost.Start();

            // Write the data to the console.
            _lightlyFilteredGazeDataStream.Next += gazeDataStreamNext;
            Console.WriteLine("Eyex setup");
        }
コード例 #19
0
        public GazeHandler()
        {
            _host = new Host();
            _wpfInteractorAgent = _host.InitializeWpfAgent();

            _gazePointDataStream = _host.Streams.CreateGazePointDataStream();
            _fixationDataStream  = _host.Streams.CreateFixationDataStream();

            _fixationDataStream.Subscribe(this);
            _gazePointDataStream.Subscribe(this);
        }
コード例 #20
0
        private void InitEyeTracker()
        {
            // Initialize the EyeX Host
            _eyeXHost = new EyeXHost();
            _eyeXHost.Start();

            // Create a data stream object and listen to events.
            stream       = _eyeXHost.CreateGazePointDataStream(GazePointDataMode.Unfiltered);
            stream.Next += DrawCircleAtGazePoint;
            stream.Next += StoreGazePoint;
        }
コード例 #21
0
        public EyeXWarpPointer()
        {
            samples       = new Point[10];
            warpThreshold = Properties.Settings.Default.EyeXWarpThreshold;

            stream = Program.EyeXHost.Streams.CreateGazePointDataStream();
            if (stream != null)
            {
                stream.IsEnabled = true;
                stream.Next     += UpdateGazePosition;
            }
        }
コード例 #22
0
        public Gta5EyeTracking()
        {
            _aspectRatio = 1;
            _host        = new EyeXHost();
            _host.Start();
            _lightlyFilteredGazePointDataProvider       = _host.CreateGazePointDataStream(GazePointDataMode.LightlyFiltered);
            _lightlyFilteredGazePointDataProvider.Next += NewGazePoint;

            _menuPool = new MenuPool();

            LoadSettings();
            _settingsMenu = new SettingsMenu(_menuPool, _settings);
            _settingsMenu.DeadzoneMenu.OnItemSelect += (m, item, indx) =>
            {
                if (indx == 0)
                {
                    _isDrawingDeadzone = true;
                }
                else
                {
                    _settings.Deadzones.RemoveAt(indx - 1);
                    _settingsMenu.DeadzoneMenu.RemoveItemAt(indx);
                    _settingsMenu.DeadzoneMenu.RefreshIndex();
                }
            };

            _gazeVisualization = new GazeVisualization();
            _debugOutput       = new DebugOutput();

            _aiming = new Aiming(_settings);

            _mouseEmulation      = new MouseEmulation();
            _controllerEmulation = new ControllerEmulation();
            _controllerEmulation.OnModifyState += OnModifyControllerState;
            _freelook = new Freelook(_controllerEmulation, _mouseEmulation, _settings);
            _pedestrianInteraction = new PedestrianInteraction();
            _radialMenu            = new RadialMenu(_controllerEmulation);

            _gazeStopwatch = new Stopwatch();
            _gazeStopwatch.Restart();

            _tickStopwatch = new Stopwatch();

            _foregroundWindowWatcher = new ForegroundWindowWatcher();
            _foregroundWindowWatcher.ForegroundWindowChanged += ForegroundWindowWatcherOnForegroundWindowChanged;
            _isWindowForeground = _foregroundWindowWatcher.IsWindowForeground();

            View.MenuTransitions = true;

            KeyDown += OnKeyDown;

            Tick += OnTick;
        }
コード例 #23
0
 public TobiiEyeTrackingProvider()
 {
     gazeHost                  = new Host();
     gazePointDataStream       = gazeHost.Streams.CreateGazePointDataStream(Tobii.Interaction.Framework.GazePointDataMode.LightlyFiltered);
     gazePointDataStream.Next += (s, e) =>
     {
         Task.Run(() =>
         {
             PointAvailable?.Invoke(this, new Point(e.Data.X, e.Data.Y));
         });
     };
 }
コード例 #24
0
ファイル: Tobii.cs プロジェクト: c13proto/tobii_camera
        public Tobii()
        {
            InitializeComponent();
            eyexhost.Start();
            lightlyFilteredGazeDataStream = eyexhost.CreateGazePointDataStream(GazePointDataMode.LightlyFiltered);
            lightlyFilteredGazeDataStream.Next += (s, e) => 視点情報格納(s, e);
            PosDataStream=eyexhost.CreateEyePositionDataStream();
            PosDataStream.Next += (s, e) =>  眼球位置_XY情報格納(s, e);

            タイマー開始();
            //System.Diagnostics.Debug.WriteLine(gaze_data.ToString());
        }
コード例 #25
0
        public TobiiTracker()
        {
            host = new Host();

            // 2. Create stream.
            GazePointDataBehavior b = new GazePointDataBehavior(Tobii.Interaction.Framework.GazePointDataMode.LightlyFiltered);

            gazePointDataStream = host.Streams.CreateGazePointDataStream();

            //FixationDataBehavior behavior = new FixationDataBehavior(Tobii.Interaction.Framework.FixationDataMode.Slow);
            //fixationDataStream = host.Streams.CreateFixationDataStream(behavior);
        }
コード例 #26
0
 public void StopAllGazeDataStream()
 {
     SetGazeDataRecording(false, false, false);
     GazePointEvent = null;
     gazePointDataStream.Dispose();
     gazePointDataStream = null;
     FixationEvent       = null;
     fixationDataStream.Dispose();
     fixationDataStream = null;
     EyePositionEvent   = null;
     eyePositionDataStream.Dispose();
     eyePositionDataStream = null;
 }
コード例 #27
0
        public void startEyeTrack()
        {
            GazePointDataStream gpda = eHost.CreateGazePointDataStream(GazePointDataMode.LightlyFiltered);

            gpda.Next += new EventHandler <GazePointEventArgs>(GetPos);
            EyePositionDataStream epds = eHost.CreateEyePositionDataStream();

            epds.Next += new EventHandler <EyePositionEventArgs>(GetEyePos);

            eHost.UserPresenceChanged += new EventHandler <EngineStateValue <UserPresence> >(GetPresence);
            eHost.GazeTrackingChanged += new EventHandler <EngineStateValue <GazeTracking> >(GetGaze);

            //eHost.Start();
        }
コード例 #28
0
        public TobiiMouseForm(Host host)
        {
            InitializeComponent();

            _stream = host.Streams.CreateGazePointDataStream();
            // TODO: Exit the program
            if (_stream == null)
            {
                return;
            }

            _stream.GazePoint(OnGazeData);
            _keyboardHook.KeyboardPressed += OnKeyPressed;
        }
コード例 #29
0
 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;
     }
                                    );
 }
コード例 #30
0
        public ShortcutKeyWorker(KeyboardHook KeyboardObserver, Dictionary <ActionToBePerformed, String> KeyAssignments, FormsEyeXHost EyeXHost)//, Dictionary<EToolBarFunction, String> KeyAssignments)
        {
            keyBoardHook = KeyboardObserver;
            keyBoardHook.OnKeyPressed += RunKeyFunction;

            keyAssignments = KeyAssignments;

            //Connect to eyeX engine gaze stream.
            gazeStream = EyeXHost.CreateGazePointDataStream(GazePointDataMode.LightlyFiltered);
            //Create gate points event handler delegate
            gazeDel = new EventHandler <GazePointEventArgs>(updateGazeCoodinates);
            //register delegate with gaze data stream next event.
            gazeStream.Next += gazeDel;
        }
コード例 #31
0
        /// <summary>
        ///     Releases unmanaged and - optionally - managed resources.
        /// </summary>
        /// <param name="disposing">
        ///     <c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only
        ///     unmanaged resources.
        /// </param>
        protected virtual void Dispose(bool disposing)
        {
            if (this.GazePointDataStream != null)
            {
                this.GazePointDataStream.Dispose();
                this.GazePointDataStream = null;
            }

            if (this.EyeXHost != null)
            {
                this.EyeXHost.Dispose();
                this.EyeXHost = null;
            }
        }
コード例 #32
0
        //constructor
        public EyeXWarpPointer(Configuration configuration)
        {
            mConfiguration     = configuration;
            samples            = new Point[10];
            warpThreshold      = 400;
            warpThresholdWidth = mConfiguration.MagnifierWidth;
            warpThresholdHight = mConfiguration.MagnifierHeight;

            stream = Program.EyeXHost.Streams.CreateGazePointDataStream();
            if (stream != null)
            {
                stream.IsEnabled = true;
                stream.Next     += UpdateGazePosition;
            }
        }
コード例 #33
0
        private void setup()
        {
            host_ = new EyeXHost();
            {
                stream_ = host_.CreateGazePointDataStream(GazePointDataMode.LightlyFiltered);
                {
                    host_.Start();

                    stream_.Next += (s, e) => {
                        gazeX_ = e.X;
                        gazeY_ = e.Y;
                    };
                }
            }
        }
コード例 #34
0
        public Gta5EyeTracking()
        {
            Util.Log("Begin Initialize");
            _shutDownRequestedEvent = new ManualResetEvent(false);
            _aspectRatio = 1;
            _host = new EyeXHost();
            _host.Start();
            _lightlyFilteredGazePointDataProvider = _host.CreateGazePointDataStream(GazePointDataMode.LightlyFiltered);
            _lightlyFilteredGazePointDataProvider.Next += NewGazePoint;

            _menuPool = new MenuPool();

            LoadSettings();
            _settingsMenu = new SettingsMenu(_menuPool, _settings);
            _deadzoneEditor = new DeadzoneEditor(_settings,_settingsMenu);

            _settingsMenu.ShutDownRequested += SettingsMenuOnShutDownRequested;

            _gazeVisualization = new GazeVisualization();
            _debugOutput = new DebugOutput();

            _aiming = new Aiming(_settings);

            _mouseEmulation = new MouseEmulation();
            _controllerEmulation = new ControllerEmulation();
            _controllerEmulation.OnModifyState += OnModifyControllerState;
            _freelook = new Freelook(_controllerEmulation, _mouseEmulation, _settings);
            _pedestrianInteraction = new PedestrianInteraction();
            _radialMenu = new RadialMenu(_controllerEmulation);

            _gazeStopwatch = new Stopwatch();
            _gazeStopwatch.Restart();

            _tickStopwatch = new Stopwatch();

            _foregroundWindowWatcher = new ForegroundWindowWatcher();
            _foregroundWindowWatcher.ForegroundWindowChanged += ForegroundWindowWatcherOnForegroundWindowChanged;
            _isWindowForeground = _foregroundWindowWatcher.IsWindowForeground();

            KeyDown += OnKeyDown;

            Tick += OnTick;
            Util.Log("End Initialize");
        }
コード例 #35
0
ファイル: Form1.cs プロジェクト: romannep/sharp-eye
        private void button1_Click(object sender, EventArgs e)
        {
            //fill consts
            scrad = (bcrad - bcd * Math.Cos(Math.PI / 4))/2;
            scx = length45x(ll0) + scrad * Math.Cos(Math.PI / 4);
            scy = length45x(ll0) - scrad * Math.Cos(Math.PI / 4);
            ll1 = Math.PI * scrad;
            ll2 = (ll0 + scrad * 2 - bcrad) + bcd / Math.Cos(Math.PI / 4);
            ll3 = Math.PI * bcrad * 1.5;
            lineLen = 0;
            gazeData.Clear();
            //gazeData.Add(pointCM(0, 0));
            //set timer
            timer1.Interval = (int)( 1 / FREQ * 1000);
            timer1.Enabled = true;
            //start streaming gaze data
            stream = eyeX.CreateGazePointDataStream(GazePointDataMode.Unfiltered);
            stream.Next += Stream_Next;

            /*
            var centrPoint = pointCM(0, 0);
            //var p1 = pointCM(length45x(8), length45x(8));
            //gr.DrawLine(p, centrPoint.X, centrPoint.Y, p1.X, p1.Y);
            var p2 = pointRl(3.0,0,7,Math.PI/4*3,0);
            drawDot(p2.X, p2.Y);
            p2 = pointRl(3.0, 0, 7, Math.PI / 4 * 3, -3);
            drawDot(p2.X, p2.Y);
            p2 = pointRl(3.0, 0, 7, Math.PI / 4 * 3, -6);
            drawDot(p2.X, p2.Y);
            p2 = pointRl(3.0, 0, 7, Math.PI / 4 * 3, -8);
            drawDot(p2.X, p2.Y);
            p2 = pointRl(3.0, 0, 7, Math.PI / 4 * 3, -Math.PI*1.5*7);
            drawDot(p2.X, p2.Y);

            Invalidate();
            */

            /*
            timer1.Enabled = true;
            */
        }
コード例 #36
0
ファイル: TobiiGazeHandler.cs プロジェクト: rajincse/rajin
        public void StartServer()
        {
            this.eyeXHost = new EyeXHost();
            this.eyeXHost.Start();
            this.gazeDataStream = eyeXHost.CreateGazePointDataStream(GazePointDataMode.LightlyFiltered);
            this.gazeDataStream.Next += new System.EventHandler<EyeXFramework.GazePointEventArgs>(this.HandleEyeGazeEvent);

            this.fixationDataStream = eyeXHost.CreateFixationDataStream(FixationDataMode.Slow);
            this.fixationDataStream.Next += new System.EventHandler<EyeXFramework.FixationEventArgs>(this.HandleEyeFixationEvent);

            try
            {
                IPAddress ipAddr = IPAddress.Parse(host);
                tcpServer = new TcpClient();
                tcpServer.Connect(ipAddr, port);
                swSender = new StreamWriter(tcpServer.GetStream());
            }
            catch
            {
                this.StopServer();
            }
        }
コード例 #37
0
ファイル: Form1.cs プロジェクト: moyoron64/eyeX
        private void Form1_Load(object sender, System.EventArgs e)
	    {
		    timer1.Interval = 25;
		    timer1.Enabled = true;
            timer2.Interval = 10000;
            timer2.Enabled = true;
            webBrowser1.Navigate("http://com.center.wakayama-u.ac.jp/~s175022/englishTest15.html");
            _eyeXHost.Start();
            stream = _eyeXHost.CreateGazePointDataStream(GazePointDataMode.LightlyFiltered);
            stream2 = _eyeXHost.CreateEyePositionDataStream();
            stream.Next += OutputGazePoint;
            stream2.Next += OutputEyePosition;

            


        }
コード例 #38
0
ファイル: EyeXHost.cs プロジェクト: osin-vladimir/EyeX
 /// <summary>
 /// Gets a gaze point data stream.
 /// </summary>
 /// <param name="mode">Specifies the kind of data processing to be applied by the EyeX Engine.</param>
 /// <returns>The data stream.</returns>
 public GazePointDataStream CreateGazePointDataStream(GazePointDataMode mode)
 {
     var dataStream = new GazePointDataStream(mode);
     RegisterDataStreamObserver(dataStream);
     return dataStream;
 }
コード例 #39
0
    public void Dispose()
    {
        if (_lightlyFilteredGazePointDataProvider != null)
        {
            _lightlyFilteredGazePointDataProvider.Next -= NewGazePoint;
            _lightlyFilteredGazePointDataProvider.Dispose();
            _lightlyFilteredGazePointDataProvider = null;
        }

        if (_host != null)
        {
            _host.Dispose();
            _host = null;
        }
    }
コード例 #40
0
        private void StartEyeStream()
        {
            _eyeXHost = new EyeXHost();
            _lightlyFilteredGazeDataStream = _eyeXHost.CreateGazePointDataStream(GazePointDataMode.LightlyFiltered);
            _eyeXHost.Start();

                    // Write the data to the console.
            _lightlyFilteredGazeDataStream.Next += gazeDataStreamNext;
            Console.WriteLine("Eyex setup");
        }
コード例 #41
-1
        public Gta5EyeTracking()
        {
            _aspectRatio = 1;
            _host = new EyeXHost();
            _host.Start();
            _lightlyFilteredGazePointDataProvider = _host.CreateGazePointDataStream(GazePointDataMode.LightlyFiltered);
            _lightlyFilteredGazePointDataProvider.Next += NewGazePoint;

            _menuPool = new MenuPool();

            LoadSettings();
            _settingsMenu = new SettingsMenu(_menuPool, _settings);
            _settingsMenu.DeadzoneMenu.OnItemSelect += (m, item, indx) =>
            {
                if (indx == 0)
                {
                    _isDrawingDeadzone = true;
                }
                else
                {
                    _settings.Deadzones.RemoveAt(indx - 1);
                    _settingsMenu.DeadzoneMenu.RemoveItemAt(indx);
                    _settingsMenu.DeadzoneMenu.RefreshIndex();
                }
            };

            _gazeVisualization = new GazeVisualization();
            _debugOutput = new DebugOutput();

            _aiming = new Aiming(_settings);

            _mouseEmulation = new MouseEmulation();
            _controllerEmulation = new ControllerEmulation();
            _controllerEmulation.OnModifyState += OnModifyControllerState;
            _freelook = new Freelook(_controllerEmulation, _mouseEmulation, _settings);
            _pedestrianInteraction = new PedestrianInteraction();
            _radialMenu = new RadialMenu(_controllerEmulation);

            _gazeStopwatch = new Stopwatch();
            _gazeStopwatch.Restart();

            _tickStopwatch = new Stopwatch();

            _foregroundWindowWatcher = new ForegroundWindowWatcher();
            _foregroundWindowWatcher.ForegroundWindowChanged += ForegroundWindowWatcherOnForegroundWindowChanged;
            _isWindowForeground = _foregroundWindowWatcher.IsWindowForeground();

            View.MenuTransitions = true;

            KeyDown += OnKeyDown;

            Tick += OnTick;
        }