Page 1 of 1

How to calibrate using the C# GazeManager ?

PostPosted: 31 Jan 2014, 17:26
by uril
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.

Re: How to calibrate using the C# GazeManager ?

PostPosted: 31 Jan 2014, 23:05
by uril
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.

Re: How to calibrate using the C# GazeManager ?

PostPosted: 03 Feb 2014, 19:16
by Martin
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).

Re: How to calibrate using the C# GazeManager ?

PostPosted: 06 Feb 2014, 19:06
by uril
Thank you very much!!!

Uril.

Re: How to calibrate using the C# GazeManager ?

PostPosted: 07 Feb 2014, 18:47
by uril
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.

Re: How to calibrate using the C# GazeManager ?

PostPosted: 07 Feb 2014, 19:18
by Martin
Visual Studio project available on Github.

Re: How to calibrate using the C# GazeManager ?

PostPosted: 18 Mar 2015, 10:16
by 8484hui
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!!