C++ EXAMPLE FOR EYE TRACKING

Forum for development in the C++ programming language.

Re: C++ EXAMPLE FOR EYE TRACKING

Postby uril » 28 Feb 2014, 18:22

Hi Mingxin,

Thank you very much for your help.
I have tested your new method of using average of the right and the left eye and it works perfectly for me.
I work for the research.


Uril.
uril
 
Posts: 11
Joined: 20 Jan 2014, 20:34

Re: C++ EXAMPLE FOR EYE TRACKING

Postby uril » 28 Feb 2014, 18:26

Hi Mingxin,

Thank you very much for your help.
I have tested your new method of using average of the right and the left eye and it works perfectly for me.
I work for the research.


Uril.
uril
 
Posts: 11
Joined: 20 Jan 2014, 20:34

Re: C++ EXAMPLE FOR EYE TRACKING

Postby mingxinbit » 28 Feb 2014, 19:53

Hi Uril,

It is my pleasure.

Maybe we can further communication about your and my research.

Currently, I plan to use the eye gaze to control robot movement. What about you?

My E-mail: mingxinbit@gmail.com, we can discuss something through E-mail.

I am now studying in Northeastern University at Boston.

Thank you!

MIngxin
mingxinbit
 
Posts: 19
Joined: 22 Jan 2014, 05:59

Re: C++ EXAMPLE FOR EYE TRACKING

Postby ryklin » 24 Apr 2014, 05:16

What is the name of the .lib file to link to? Where is it located?
ryklin
 
Posts: 65
Joined: 08 Apr 2014, 19:02

Re: C++ EXAMPLE FOR EYE TRACKING

Postby Tingjie1005 » 22 Sep 2014, 09:05

Hi,

I have followed the above steps.

Code: Select all
/******  MyGaze.h  ******/
#ifndef _MY_GAZE_
#define _MY_GAZE_

#include <gazeapi.h>
#include <windows.h>
#include <iostream>

using namespace std;

class MyGaze : public gtl::IGazeListener
{
public:
   MyGaze();
   ~MyGaze();

   void on_gaze_data( gtl::GazeData const &gazeData );

private:
   gtl::GazeApi mApi;
};

#endif

/******MyGaze.cpp******/
#include "MyGaze.h"
MyGaze::MyGaze()
{
   // Connect to the server in push mode on the default TCP port (6555)
   if( mApi.connect( true ) )
   {
      // Enable GazeData notifications
      mApi.add_listener( *this );
      if ( mApi.is_connected() )
      {
         printf("Connected!!\n");

                        // Set screen
         gtl::Screen screen;
         screen.set( 1, 1920, 1080, 0.5003, 0.2814 );
         mApi.set_screen( screen );
      }
   }
}

MyGaze::~MyGaze()
{
   mApi.remove_listener( *this );
   mApi.disconnect();
}

void MyGaze::on_gaze_data( gtl::GazeData const & gazeData )
{
   printf( "state = %d\n", gazeData.state );

   if( gazeData.state & gtl::GazeData::GD_STATE_TRACKING_GAZE )
   {
      gtl::Point2D const & smoothedCoordinates = gazeData.avg;
   
                // Move GUI point, do hit-testing, log coordinates, etc.

      Sleep(1000);
      gtl::Point2D const & smoothedCoordinatesLeftEye = gazeData.lefteye.avg; // smoothed data from left eye
      gtl::Point2D const & smoothedCoordinatesRightEye=gazeData.righteye.avg; // smoothed data from right eye

      //center values for left and right eyes, respectively.
      cout << "x = " << (smoothedCoordinatesLeftEye.x+ smoothedCoordinatesRightEye.x)/2<< " y = " << (smoothedCoordinatesLeftEye.y+smoothedCoordinatesRightEye.y)/2 << endl;

      printf( "\n" );
   }
}

/******  Main.cpp  ******/
#include <stdio.h>
#include "MyGaze.h"

int main()
{
   MyGaze myGaze;
   gtl::GazeData gazeData;

   while (true)
   {
      Sleep(2000);
      //here you also can write the output function e.g. cout <<  or printf, of course, under the precondition of predefined coordinates variable in your class
      printf( "\n-----------------------------------------------------\n" );
   }

   getchar();
   return 0;
}


I have some questions.

1. Why the state of gazeData always becomes 4,6,8 or 16 suddenly and never returns to 7( there is GD_STATE_TRACKING_GAZE = 1 << 0) ? When it happened, I have to run your UI or your C# sample simultaniously to do "recalibration" so that the console can output from value of coordinates again.

2. When my project is running, does it have any problem that your EyeTribe UI or C# sample runs as well?

3. Why the EyeTribe UI often stops suddenly? The figure of the eyes stays in the same place without moving ( the EyeTribe Server still connected ) and the values of coordinates are 0. I need to restart both of them and recalibrate the eye tribe.
Tingjie1005
 
Posts: 2
Joined: 19 Sep 2014, 10:50

Re: C++ EXAMPLE FOR EYE TRACKING

Postby 8484hui » 16 Mar 2015, 10:27

Hi everyone,

i have a question to ask, how and what application you all program the eyetribe tracker using c++ coding? I am doing a project that requires track eye positioning on the computer screen, to know how long the eye stay at which part of the screen. So don't mind somebody can help me out.
8484hui
 
Posts: 16
Joined: 12 Mar 2015, 03:04

Previous

Return to C++



cron