Instruction that Locate/detect eyes

Forum for C#/Windows development

Instruction that Locate/detect eyes

Postby LorenzoM » 12 Mar 2015, 15:56

Hi everyone, I'm Lorenzo.

I have a doubt/problem that i can't solve. I can't understand (and find...) which instruction I have to use in order to understand that the eye tracker is not locating (or detecting) eyes in the "calibration sample program" (before and after the calibration) and in the "scroll sample program".

Maybe someone has already had this problem and had solve it.

Thanks
Lorenzo.
LorenzoM
 
Posts: 3
Joined: 12 Mar 2015, 13:00

Re: Instruction that Locate/detect eyes

Postby Anders » 14 Mar 2015, 15:31

Hi

I am unable to understand the specifics of the problem you are facing. Could you please inform me what your setup is in terms of hardware and software?

Have you gone through the FAQ (bottom of this page) and the basic toturial?

/Anders
Anders
 
Posts: 124
Joined: 29 Oct 2013, 16:23

Re: Instruction that Locate/detect eyes

Postby LorenzoM » 15 Mar 2015, 14:24

Hi. Thank you for the reply.
Probably I haven’t clearly explained my problem.
First: all the samples work on my system.

My problem is the following: I need something, like a method or properties and so on, that tell me if there is (or there isn’t) someone in front of the eye tracker. In other words, I need that the eye tracker gives me a feedback (like a flag) when it detects the presence of someone in front of it, like this:
There is someone in front of it: flag = true;
There isn’t someone in front of it: flag = false.

Anyway in the last three days I have tried to find a solution. I find here http://eyetribe.github.io/tet-csharp-client/ in the GazeData class these fields, that give these costants:
GazeData. STATE_TRACKING_EYES = 2
GazeData.STATE_TRACKING_PRESENCE = 4
GazeData. STATE_TRACKING_FAIL = 8
GazeData. STATE_TRACKING_GAZE = 1
GazeData. STATE_TRACKING_LOST = System.Eventargs

I have found also, in the same page, the property State, that assumes different values in different situations. Those values are: 7, 8, 6, 16.

After several tests I have observed the following results:
gazeData.State == 7 that is: GazeData. STATE_TRACKING_GAZE + GazeData.STATE_TRACKING_PRESENCE + GazeData. STATE_TRACKING_EYES
gazeData.State == 6 that is: GazeData. STATE_TRACKING_EYES + GazeData.STATE_TRACKING_PRESENCE
gazeData.State == 8 that is: GazeData. STATE_TRACKING_FAIL , the eye tracker doesn’t detect anybody for a certain period of time established by itself.
gazeData.State == 16 that is: nobody is in front of the eye tracker, so the eye tracker dosn’t detect both the presence and the eyes of the person.

Is my analysis correct? Because if it’s correct, I think I’ve found the reply to my question.
Thanks!
LorenzoM
 
Posts: 3
Joined: 12 Mar 2015, 13:00

Re: Instruction that Locate/detect eyes

Postby Anders » 16 Mar 2015, 12:47

In the Open API Documentation you can find detailed information about the tracking state. You need to 'extract' the value using bitmasks. Since tracking can be several states at the same time (e.g. STATE_TRACKING_EYES and STATE_TRACKING_PRESENCE) we chose to design it this way.

For your case, you should use:

Code: Select all
internal const int NO_TRACKING_MASK = GazeData.STATE_TRACKING_FAIL | GazeData.STATE_TRACKING_LOST;

privat void SomeMethod(GazeData gd)
{
    if ( (gd.State & NO_TRACKING_MASK) == 0 )
    {
        //tracking successful, presence detected
    }
    else
    {
        //tracking lost or failed
    }
}
Anders
 
Posts: 124
Joined: 29 Oct 2013, 16:23

Re: Instruction that Locate/detect eyes

Postby LorenzoM » 16 Mar 2015, 12:56

Perfect. Now it's clear.

Thank you!

Lorenzo
LorenzoM
 
Posts: 3
Joined: 12 Mar 2015, 13:00

Re: Instruction that Locate/detect eyes

Postby Nathalie » 16 Sep 2015, 11:17

I have a question to the GazeData. STATE_TRACKING_LOST State.
In the API description it is told that the Tracking_Lost-State uses a 0x10 bismask.

I've noticed that if the state 7 is sent (the state for sucessful detecting eyes and locating gaze position) and I do bitmask the state with de Tracking_Lost_State (111 & 1010 = 0010) it tells me that it is != 0 and consequently the tracking_Lost State is true? But that can't be possible because the tracking_presence, _eyes and _gaze - states are true thereof!
Or do I have an error in reasoning..
Nathalie
 
Posts: 10
Joined: 23 Apr 2015, 14:58

Re: Instruction that Locate/detect eyes

Postby Anders » 19 Sep 2015, 11:40

I've noticed that if the state 7 is sent (the state for sucessful detecting eyes and locating gaze position) and I do bitmask the state with de Tracking_Lost_State (111 & 1010 = 0010) it tells me that it is != 0 and consequently the tracking_Lost State is true? But that can't be possible because the tracking_presence, _eyes and _gaze - states are true thereof!


Could you please share your code so that I have a better chance of helping you?
Anders
 
Posts: 124
Joined: 29 Oct 2013, 16:23

Re: Instruction that Locate/detect eyes

Postby Nathalie » 20 Sep 2015, 13:21

Hello Anders,

thanks for your answer, and thanks for wanting to help me!

But I noticed that I was wrong..
I thought the bitmask of the number 0x10 would be 1010 (I thought 0x10 would be 10 as a decimal number) but these are hexadecimal numbers (0x) so 0x10 as a bitmask is 00010000.
That was a really bad fault of mine :lol: Sorry!

But thanks for your reply :)
Nathalie
 
Posts: 10
Joined: 23 Apr 2015, 14:58

Re: Instruction that Locate/detect eyes

Postby Anders » 21 Sep 2015, 09:10

But I noticed that I was wrong..
I thought the bitmask of the number 0x10 would be 1010 (I thought 0x10 would be 10 as a decimal number) but these are hexadecimal numbers (0x) so 0x10 as a bitmask is 00010000.
That was a really bad fault of mine :lol: Sorry!


I hope you are aware that all the used bitmasks are available and present in GazeData.STATE_TRACKING_*? There is no need for you to generate them yourself.
Anders
 
Posts: 124
Joined: 29 Oct 2013, 16:23

Re: Instruction that Locate/detect eyes

Postby Nathalie » 27 Sep 2015, 00:20

Yes I know, but thanks :)
I tried to understand by myself how to read out the different states ;)
Nathalie
 
Posts: 10
Joined: 23 Apr 2015, 14:58


Return to C#