Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

Project3dVectorsFov.m 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. % Project3dVectorsFov.m
  2. %
  3. % This function projects the 3D eye FOV vectors into the FOV and stores a new
  4. % file where the x, y, and tilt of the are accounted for.
  5. %
  6. % input:
  7. % arffFile - file to process
  8. % outputFile - file to store converted data
  9. function Project3dVectorsFov(arffFile, outputFile)
  10. [data, metadata, attributes, relation, comments] = LoadArff(arffFile);
  11. % Proccess the FOV vectors
  12. [eyeFovVec] = GetCartVectors(data, metadata, attributes); % rotation at (-1,0,0) point
  13. widthFov = str2num(GetMetaExtraValueArff(metadata, 'fov_width_deg'));
  14. widthFovRads = widthFov * pi / 180;
  15. heightFov = str2num(GetMetaExtraValueArff(metadata, 'fov_height_deg'));
  16. heightFovRads = heightFov * pi / 180;
  17. widthFovPx = str2num(GetMetaExtraValueArff(metadata, 'fov_width_px'));
  18. heightFovPx = str2num(GetMetaExtraValueArff(metadata, 'fov_height_px'));
  19. xFov = zeros(size(data,1),1);
  20. yFov = zeros(size(data,1),1);
  21. for i=1:size(data,1)
  22. [horRads, verRads] = CartToSpherical(eyeFovVec(i,:));
  23. if (horRads < 0)
  24. horRads = 2*pi + horRads;
  25. end
  26. horRads = horRads - pi; % reference vetor at (-1,0,0)
  27. verRads = verRads - pi/2;
  28. xFov(i) = widthFovPx * (horRads + widthFovRads / 2) / widthFovRads;
  29. yFov(i) = heightFovPx * (verRads + heightFovRads / 2) / heightFovRads;
  30. end
  31. metaOut = metadata;
  32. metaOut.width_px = 0;
  33. metaOut.height_px = 0;
  34. attOut = {};
  35. dataOut = zeros(size(data,1),0);
  36. timeInd = GetAttPositionArff(attributes, 'time');
  37. [dataOut, attOut] = AddAttArff(dataOut, attOut, data(:,timeInd), attributes{timeInd,1}, attributes{timeInd,2});
  38. [dataOut, attOut] = AddAttArff(dataOut, attOut, xFov, 'x', 'Numeric');
  39. [dataOut, attOut] = AddAttArff(dataOut, attOut, yFov, 'y', 'Numeric');
  40. confInd = GetAttPositionArff(attributes, 'confidence');
  41. [dataOut, attOut] = AddAttArff(dataOut, attOut, data(:,confInd), attributes{confInd,1}, attributes{confInd,2});
  42. relOut = 'gaze_fov';
  43. commentsOut = comments;
  44. SaveArff(outputFile, dataOut, metaOut, attOut, relOut, commentsOut);
  45. end