DetectBlinks360File.m 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. % function DetectBlinks360File:
  2. %
  3. % This function detects blinks from the input file and stores them in the
  4. % provided attribute of the output file. The values of the attribute in the
  5. % output file are '{unassigned, blink}'
  6. %
  7. %
  8. % input:
  9. % inputfile - ARFF file containing gaze coordinates
  10. % outputfile - ARFF file to store detected fixations
  11. % outputAtt - attribute that holds detected fixations in the output ARFF file
  12. % typeOfMotion- 1 -> eye FOV, 2 -> eye+head
  13. % paramfile - (optional) txt file containing parameters for saccade detection (explanation below)
  14. %
  15. % paramfile format:
  16. % The file is indipendent of parameter ordering and letter case. Each parameter is followed by
  17. % an equal sign and then the value. The available values are below
  18. % tolerance=
  19. % thresholdOnsetFast=
  20. % thresholdOnsetSlow=
  21. % thresholdOffset=
  22. % maxSpeed=
  23. % minDuration=
  24. % maxDuration=
  25. % velIntegrationInterv=
  26. % minConfidence=
  27. function DetectBlinks360File(inputfile, outputFile, outputAtt, typeOfMotion, paramfile)
  28. % load gaze coordinates from arff file
  29. [data, metadata, attributes, relation, comments] = LoadArff(inputfile);
  30. if (nargin < 5)
  31. params.tolerance = 0.1;
  32. params.thresholdonsetfast = 137.5;
  33. params.thresholdonsetslow = 17.1875;
  34. params.thresholdoffset = 17.1875;
  35. params.maxspeed = 1031.25;
  36. params.minduration = 15000;
  37. params.maxduration = 160000;
  38. params.velintegrationinterv = 4000;
  39. params.minconfidence = 0.25;
  40. else
  41. params = LoadParams(paramfile);
  42. end
  43. res = DetectBlinks360(data, metadata, attributes, typeOfMotion, params);
  44. [data, attributes] = AddAttArff(data, attributes, res, outputAtt, '{unassigned,blink}');
  45. SaveArff(outputFile, data, metadata, attributes, relation, comments);
  46. end