DataReprojFovDetection.m 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. % DataReprojFovDetection.m
  2. %
  3. % This function detects eye movements by reprojectinig the 360-degree
  4. % equirectangular data in the field-of-view (FOV) coordinates of the headset.
  5. % By doing this we disentagle the head from the eye motion. On the converted
  6. % data we can then call an external eye movement detection function. The input
  7. % data should have the relation "gaze_360" to mark they were recorded in
  8. % 360-degree equirectangular.
  9. %
  10. % The eye movement detection function is provided as string in the input
  11. % arguments. This function should have at least 3 input variables, namely
  12. % data, metadata, and attributes as loaded from the LoadArff function. If the
  13. % provided detection function requires more input than the 3 default arguments,
  14. % these can be provided as extra arguments in the argument list of the current
  15. % function. The extra arguments are placed in the order that they appear after
  16. % the 3 default arguments in the detection function. The output of the
  17. % detection function should be a vector with a unique integer value for each
  18. % detected eye movement. These should correspond to the provided attValues
  19. % input argument as in the case of an enumeration.
  20. %
  21. % input:
  22. % arffFile - file to process
  23. % outFile - file to store results
  24. % outputAtt - name of the attribute in the output ARFF
  25. % attValues - nominal values of the added attributes. They are a string in the
  26. % form '{unassigned, fixation, sacacde, sp, noise}'
  27. % detFuncName - detection function name
  28. % varargin - required extra arguments for calling the detection function.
  29. % The data, metadata, attributes are used by default in this
  30. % order followed by the varargin arguments
  31. function DataReprojFovDetection(arffFile, outFile, outputAtt, attValues, detFuncName, varargin)
  32. DetectionFunction = str2func(detFuncName);
  33. [data, metadata, attributes, relation, comments] = LoadArff(arffFile);
  34. [fovData, fovMetadata, fovAttributes, fovRelation] = ProjectEquirect2Fov(data, metadata, attributes, relation);
  35. if (isempty(varargin))
  36. labelledAtt = DetectionFunction(fovData, fovMetadata, fovAttributes);
  37. else
  38. labelledAtt = DetectionFunction(fovData, fovMetadata, fovAttributes, varargin{:});
  39. end
  40. [newData, newAttributes] = AddAttArff(data, attributes, labelledAtt, outputAtt, attValues);
  41. SaveArff(outFile, newData, metadata, newAttributes, relation, comments);
  42. end