Home › Forums › Software Development › [Solved] Project building with several errors when using EyeXFramework
Tagged: BadImageFormatException, eyexclient.dll, EyeXFramework, Tobii
- This topic has 29 replies, 7 voices, and was last updated 5 years, 8 months ago by
Grant [Tobii].
- AuthorPosts
- 16/09/2014 at 09:43 #1648
Siddarth
ParticipantHello,
I’m trying to use the MinimalGazeDataStream as a base to find eye positions and print them to the console over a period of time. Sounds quite simple. However, I have been struggling to build a project without facing hundreds of errors regarding imported dlls and projects. I followed the instructions of the Developer’s guide and added EyeXFramework to my project as well as the two required dlls. However, the most common errors say ‘Could not locate the assembly Tobii.EyeX.Client.Net20’ and ‘the type or namespace Tobii could not be found’ and several Tobii related words are red-underlined in my C# code on Visual Studio Express 2013. I don’t think the project has recognized EyeXFramework or the dlls for some reason. Does anyone have any guidance on how to move forward? Any help will be appreciated. Thank you!
19/09/2014 at 17:10 #1689Anders
ParticipantHi Siddarth,
here is how I did it:
1. create a brand new console c# project with a new solution.
2. right-click the References node in the project and choose Add references. Browse to the SDK/source/EyeXFramework/bin/x86/Debug directory and select both the EyeXFramework dll and the Tobii.EyeX.Client.Net20 dll. (This of course assumes that you built the EyeX Framework before.)
3. copy the code from the Main method in SDK/source/MinimalSamples/MinimalGazeDataStream/Program class into the Program class of the new project.
4. place the cursor on the two types that cannot be resolve and press Ctrl-. to add the necessary using statements. At this point the code compiles, but you get a DllNotFoundException if you try to run it.
5. the default platform for c# is Any CPU, but we need to change that to either x86 or x64, because otherwise we won’t know which bitness of the Tobii.EyeX.Client dll to load until runtime. Since we already chose the x86 assemblies in step 2, let’s stick to x86. Open the Build/Configuration manager dialog and add a solution platform for x86. (Re)build the app for the new platform.
6. copy the Tobii.EyeX.Client dll from Sdk/lib/x86 into the output folder of your new project. Note that the output folder will now be bin/x86/Debug by default. Now the app should run and spit out a trail of gaze data!I hope this helps.
22/09/2014 at 14:03 #1706Siddarth
ParticipantHello Anders,
Thanks so much for your help. I have followed your steps and have had difficulty in just Step 4. I am working on a tablet and the shortcuts for Smart Tags don’t seem to be working. I have done extensive research on the subject on Google to no avail. Can you please tell me which “using” statements are needed so that I can manually type them myself or if there is another way to accomplish this?
Regards,
Siddarth23/09/2014 at 07:53 #1713Robert [Tobii]
ParticipantHi Siddarth,
With these include statements you should be on the safe side:using EyeXFramework; using Tobii.EyeX.Client; using Tobii.EyeX.Framework;
23/09/2014 at 08:39 #1714Siddarth
ParticipantYes, those are the ones I tried, but the keywords are still red-underlined. Here is my code below. The keywords void, [], args, EyeXHost and GazePointDataStream are unresolved. If I remove the Main method statement to run it as a script (not even sure if that’s possible because I’ve never used C# before), EyeXHost and GazePointDataStream are still not resolved. Any ideas?
using EyeXFramework;
using System;
using Tobii.EyeX.Client;
using Tobii.EyeX.Framework;
using System.Text;public static void Main(string[] args)
{
using (var eyeXHost = new EyeXHost())
{
eyeXHost.Start();// Create a data stream: lightly filtered gaze point data.
using (var lightlyFilteredGazeDataStream = eyeXHost.CreateDataStream(new GazePointDataStream(GazePointDataMode.LightlyFiltered))
// using (var stream = eyeXHost.CreateDataStream(new EyePositionDataStream(EyePositionDataMode.LightlyFiltered))
{
// Write the data to the console.lightlyFilteredGazeDataStream.Next += (s, e) => Console.WriteLine(“Gaze point at ({0:0.0}, {1:0.0}) @{2:0}”, e.X, e.Y, e.Timestamp);
// stream.Next += (s,e) => Console.WriteLine(“Eye position at
// Let it run until a key is pressed.
Console.WriteLine(“Listening for gaze data, press any key to exit…”);
Console.In.Read();
}
}
}23/09/2014 at 10:00 #1715Robert [Tobii]
ParticipantIn C# you need to put your main method inside a class. Try to add these lines before your Main
public static class Program {
23/09/2014 at 11:52 #1716Siddarth
ParticipantThanks for that, it solved the problem of errors! However when I run the program, the console immediately displays “Listening for gaze data, press any key to exit” without printing any gaze data before that. Also, it doesn’t end the program when a key is pressed but continues to run, not outputting anything to the console. Do I need to edit the code somehow?
23/09/2014 at 15:57 #1718Anders
ParticipantHi Siddarth,
it’s not an error that the console displays “Listening for gaze data” immediately, that’s how it is supposed to work. The main thread hangs on the next statement which is Console.In.Read() while the EyeX worker threads keep running and deliver gaze data events. But if you don’t receive any such events then something must be wrong.Do the samples work for you if you run them unmodified?
Does the tracker light up when you run a sample?
Does the EyeX icon show in the notification area (“system tray”)? And, if you open the settings panel, is tracking enabled?23/09/2014 at 16:13 #1719Siddarth
ParticipantI’m not sure what exactly you mean by sample. The tracker lights up when I connect it to the tablet, the EyeX icon shows in the System Tray, and tracking is turned on in the settings. What do you mean by running a sample (modified or unmodified)? I simply would like the tracker to register the gaze\eye position co-ordinates of my eyes and print them to the console real time.
24/09/2014 at 08:54 #1726Siddarth
ParticipantOh you mean the sample code! I haven’t modified them and am running exactly what was provided. The tracker is lit up too.
25/09/2014 at 08:10 #1740Anders
ParticipantHi Siddarth,
it’s good to know that the tracker is lit up. That means that we can rule out several potential problem sources.If you launch the settings panel and check your calibration, is there a swarm of dots following your eye-gaze?
And what about the eye indicator, the little black box at the bottom of the screen — does it follow your eyes, or does it display two crossed-out eyes?
25/09/2014 at 08:29 #1742Siddarth
ParticipantYes, the dots follow my eyes and are quite accurate too. And the eye indicator shows dots, not crosses. I think the tracker is working fine.
26/09/2014 at 09:25 #1745Siddarth
ParticipantHello!
I managed to fix the issue – all I needed to do was download the new driver Tobii EyeX 0.10.0. Thanks so much for all your help!
26/09/2014 at 11:57 #1749Siddarth
ParticipantHey @anderstobii just one more thing. How can I edit this code to get the X, Y and Z coordinates of eye position instead of gaze point?
26/09/2014 at 12:21 #1751Anders
ParticipantHi Siddarth,
it’s great to hear that you solved your problem!You can switch to using the eye positions data stream instead of the gaze data stream. That is, instead of eyeXHost.CreateGazePointDataStream, use eyeXHost.CreateEyePositionDataStream.
- AuthorPosts
- You must be logged in to reply to this topic.