public static GazeData openAndFilter(string path) { GazeData gd = new GazeData(Path.ChangeExtension(Path.GetFullPath(path), null)); gd.gazes = GazeData.fixationBusher2008(gd.gazes); return(gd); }
static void Main(string[] args) { //load a file //string namefile = @"C:\Users\Olivier\Documents\GitHub\eyex\RecordingEyeGaze\RecordingEyeGaze\bin\Debug\readingNature_screenshots\readingNaturep1-913words"; ////string namefile = @"C:\Users\Olivier\Documents\GitHub\eyex\RecordingEyeGaze\RecordingEyeGaze\bin\Debug\notreading_screenshots\notreading"; //GazeData gd = new GazeData(namefile); //gd.gazes = GazeData.fixationBusher2008(gd.gazes); //List<bool> reading = scoreReading1(gd.gazes); string folder = @"C:\Users\Olivier\Documents\GitHub\eyex\RecordingEyeGaze\ReadingVSNotReading\bin\Debug\verticalJapanese"; //string folder = @"C:\Users\Olivier\Documents\GitHub\eyex\RecordingEyeGaze\ReadingVSNotReading\bin\Debug\English"; string[] files = Directory.GetFiles(folder); foreach (var file in files) { Console.WriteLine(file); GazeData gd = new GazeData(file); gd.gazes = GazeData.fixationBusher2008(gd.gazes); List <int> reading = scoreReading2(gd.gazes, 5, 20); double average = reading.Average(); Console.WriteLine(average); Console.WriteLine("\n"); //If reading, apply the wordometer //if (average > 0.5) //{ // gd.lines = GazeData.lineBreakDetectionSimple(ref gd.gazes); // int nbWords = (int)(gd.TotalLinesLength / 70); // Console.WriteLine("Nb of words = " + nbWords); //} } Console.WriteLine("\n\nPress a key to exit..."); Console.ReadLine(); }
static void Main(string[] args) { //Load recordings string[] files = Directory.GetFiles(folder, name + ".csv", SearchOption.AllDirectories); //Load image Bitmap bmp = new Bitmap(@"V:\manga-eyegaze\l3i\2015-10-06_10-26-41\001_back.png"); Graphics g = Graphics.FromImage(bmp); //Compute fixations foreach (var file in files) { GazeData gd = new GazeData(file.Replace(".csv", "")); //List<Gaze> gazes = new List<Gaze>(); List <Gaze> fixations = GazeData.fixationBusher2008(gd.gazes); //normalize the time double sum = fixations.Sum(x => x.duration); for (int i = 0; i < fixations.Count; i++) { // 360/25 fixations[i].duration *= 100 / sum; //Add to the hue , the duration in 50 pixels around the fixations Pen p = new Pen(Color.Red); g.DrawEllipse(p, new Rectangle((int)fixations[i].gazeX, (int)fixations[i].gazeY, 50, 50)); // Should be a gaussian } //gd.gazes = fixations; } }
public Recording(string path) { this.path = path; gaze = GazeData.readTobiiCsv(path); fixations = GazeData.fixationBusher2008(gaze); fixationLines = GazeData.lineBreakDetectionSimple(ref fixations); string[] split = Path.GetFileNameWithoutExtension(path).Split('_'); readerName = split[0]; documentName = split[1]; saccades = computeSaccades(fixations); computeFeatures(); }
public int estimatedNumberOfReadWords() { GazeData gdCopy = (GazeData)gd.Clone(); gdCopy.gazes = GazeData.fixationBusher2008(gdCopy.gazes); gdCopy.lines = GazeData.lineBreakDetectionSimple(ref gdCopy.gazes); List <int> words = new List <int>(); foreach (var item in gdCopy.lines) { //estimateSpeed words.Add(wordsLine(item)); } return(words.Sum()); }
public List <double> speedPerLine() { //Clone the gaze for applying fixation and line break detection on it GazeData gdCopy = (GazeData)gd.Clone(); gdCopy.gazes = GazeData.fixationBusher2008(gdCopy.gazes); gdCopy.lines = GazeData.lineBreakDetectionSimple(ref gdCopy.gazes); List <double> speed = new List <double>(); foreach (var item in gdCopy.lines) { //estimateSpeed speed.Add(speedLine(item)); } return(speed); }
public void update(float posX, float posY, float timestamp) { Gaze g = new Gaze(); g.gazeX = posX; g.gazeY = posY; g.timestamp = timestamp; gazes.Add(g); GazeData gd = new GazeData(); gd.gazes = gazes; gd.gazes = GazeData.fixationBusher2008(gd.gazes); gd.lines = GazeData.lineBreakDetectionSimple(ref gd.gazes); fixations = gd.gazes; nbWords = (int)(gd.TotalLinesLength / space); //I had one word per line in the estimation because the fixations are found at the center of the words nbWords += gd.lines.Count; }
public static List <GazeData> loadEyeGazes(string folderPathEG) { List <GazeData> gazes = new List <GazeData>(); List <string> files = Directory.GetFiles(folderPathEG, "*.csv").ToList(); files.AddRange(Directory.GetFiles(folderPathEG, "*.txt")); foreach (var item in files) { //Get the ID of the groundtruth int groundTruthID = int.Parse(Path.GetFileNameWithoutExtension(item).Split('_')[1]); //I don't take the first text as it seems not relevant //if (groundTruthID == 1) continue; GazeData gd = new GazeData(Path.ChangeExtension(item, null), groundTruthID - 1); gd.gazes = GazeData.fixationBusher2008(gd.gazes, 100); gd.lines = GazeData.lineBreakDetectionSimple(ref gd.gazes); //gd.lineBreakDetectionOkoso(); //gd.rowDataLineBreak(-80); gazes.Add(gd); } return(gazes); }
public List <double> speedPerFixation() { //Clone the gaze for applying fixation detection on it GazeData gdFixation = (GazeData)gd.Clone(); GazeData.fixationBusher2008(gdFixation.gazes); List <double> speed = new List <double>(); for (int i = 1; i < gdFixation.gazes.Count; i++) { double distX = gdFixation.gazes[i].gazeX - gdFixation.gazes[i - 1].gazeX; //Don't compute speed for backward if (distX < 0) { continue; } double estimatedWords = distX / averageWidthWordSpace; double elapsedtime = gdFixation.gazes[i].timestamp - gdFixation.gazes[i - 1].timestamp; speed.Add(60000 * estimatedWords / elapsedtime); } return(speed); }
//input a file recorded by tobii //outut the tag words as a string. This string can be use in wordle.net static void Main(string[] args) { Console.WriteLine("Write the path to the Tobii file:"); string tobiiFile = readFile("Timestamp;GazeX;GazeY;LeftEye;RightEye"); Console.WriteLine("Write the path to the layout file:"); string layoutFile = readFile("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); GazeData gd = new GazeData(Path.ChangeExtension(tobiiFile, null)); PcGts layout = Retrieval.Program.loadLayout(layoutFile); gd.gazes = GazeData.fixationBusher2008(gd.gazes); //For each gaze, find the closest word List <string> words = findClosestWords(gd, layout); //Outpout the words foreach (var item in words) { Console.WriteLine(item); } Console.WriteLine("Write the path to export the file:"); string pathSave = Console.ReadLine(); File.WriteAllLines(pathSave, words); }