-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdrawGazeCursor.m
33 lines (26 loc) · 1.32 KB
/
drawGazeCursor.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
%get recent eye pos
[left_xyTMP, right_xyTMP, left_pupilTMP, right_pupilTMP, ...
left_validityTMP, right_validityTMP, emptyset]=...
GetEyeData(ScreenTime(end-1), ScreenTime(end));
%window to average cursor over
c=5;
if(~emptyset)
left_xy_PRE(end+1,:)=left_xyTMP(end,:);
right_xy_PRE(end+1,:)=right_xyTMP(end,:);
left_pupil_PRE(end+1,:)=left_pupilTMP(end,:);
right_pupil_PRE(end+1,:)=right_pupilTMP(end,:);
left_validity_PRE(end+1,:)=left_validityTMP(end,:);
right_validity_PRE(end+1,:)=right_validityTMP(end,:);
EyeTime_PRE(end+1)=ScreenTime(end);
EyeInsideLR_PRE(end+1,1)=EyeInAOI_Median(right_xy_PRE(end,:),...
left_xy_PRE(end,:),Calib,LeftChoiceSquare,Constants.AOI_border);
EyeInsideLR_PRE(end,2)=EyeInAOI_Median(right_xy_PRE(end,:),...
left_xy_PRE(end,:),Calib,RightChoiceSquare,Constants.AOI_border);
if(length(left_xy_PRE)>c)
x=median(median([right_xy_PRE(end-c:end,1) left_xy_PRE(end-c:end,1)]))*Calib.screen.width;
y=median(median([right_xy_PRE(end-c:end,2) left_xy_PRE(end-c:end,2)]))*Calib.screen.height;
gazeCursor = [x-Constants.gXY/2, y-Constants.gXY/2, ...
x+Constants.gXY/2, y+Constants.gXY/2];
Screen('FillRect', EXPWIN, Constants.gColor, gazeCursor );
end
end