How to calibrate using the C# GazeManager ?

Forum for C#/Windows development

How to calibrate using the C# GazeManager ?

Postby uril » 31 Jan 2014, 17:26

Hi Everyone,

I'm trying to build in calibration into my code using the C# GazeManager provided with the instructions from the tutorials. Can you provide a little sample code on what needs to be done to complete this procedure? I'm having trouble figuring it out just from the API protocols.

Thank you,

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

Re: How to calibrate using the C# GazeManager ?

Postby uril » 31 Jan 2014, 23:05

Hi Everyone,

I have tried to use Calibration function from GazeManager but it did not work out.
Please see below:

private TETCSharpClient.IGazeCalibrationListener listener;
GazeManager.Instance.CalibrationStart(9, listener);

Any help will be appreciated!!!

Thank you,

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

Re: How to calibrate using the C# GazeManager ?

Postby Martin » 03 Feb 2014, 19:16

Hi Uril,

Please take a look at the calibration sample from the tet-cshap-samples on Github.

To start a calibration in your own project (first include controls dll) then call the CalibrationRunner:
In the example I compiled below you can either wait for the results in the same method, or receive a callback on the ICalibrationResultListener interface when a new calibration occurs.

Code: Select all

public class MyClass : ICalibrationResultListener
{
    public MyClass()
    {
        GazeManager.Instance.Activate(GazeManager.ApiVersion.VERSION_1_0, GazeManager.ClientMode.Push);
        GazeManager.Instance.AddCalibrationStateListener(this);
    }

    private void Calibrate()
    {
         //Run the calibration on 'this' monitor
         var ActiveScreen = Screen.FromHandle(new WindowInteropHelper(this).Handle);

         // Initialize and start the calibration
         CalibrationRunner calRunner = new CalibrationRunner(ActiveScreen, ActiveScreen.Bounds.Size, 9);

         bool isCalibrated = calRunner.Start();
         if (!isCalibrated) return;

         // Show overall accuracy (in degrees) of last calibration (wait here for it)
         Console.Out.WriteLine(GazeManager.Instance.LastCalibrationResult.AverageErrorDegree);
    }

     // Interface method (callback)
     public void OnCalibrationChanged(bool isCalibrated, CalibrationResult calibResult)
     {
          Console.Out.WriteLine(calibResult.AverageErrorDegree);
     }
}



We're preparing more complete documentation and samples to illustrated key concepts such as calibration, trackbox, cursor redirection, selection etc. Aiming at having it ready by Monday (week from today).
Martin
 
Posts: 567
Joined: 29 Oct 2013, 15:20

Re: How to calibrate using the C# GazeManager ?

Postby uril » 06 Feb 2014, 19:06

Thank you very much!!!

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

Re: How to calibrate using the C# GazeManager ?

Postby uril » 07 Feb 2014, 18:47

Hi All,

I can not find control dll in my client directory. All I have are these dll's : Dotway.WPF.Controls, Newtonsoft.Json, TETCSharpClient and TETUserInterface.
Can I download from your website, if yes can I please get a link?

Thank you,

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

Re: How to calibrate using the C# GazeManager ?

Postby Martin » 07 Feb 2014, 19:18

Visual Studio project available on Github.
Martin
 
Posts: 567
Joined: 29 Oct 2013, 15:20

Re: How to calibrate using the C# GazeManager ?

Postby 8484hui » 18 Mar 2015, 10:16

Hi Martin

In the coding you posted, why it said my TETCSharpClient.GazeManager does not contain a definition for AddCalibrationStateListener?
any help will be appreciated!!
8484hui
 
Posts: 16
Joined: 12 Mar 2015, 03:04


Return to C#