Skip to content

Commit

Permalink
adding changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Wallace committed Feb 21, 2024
1 parent d9ba216 commit 4e2c876
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 32 deletions.
13 changes: 2 additions & 11 deletions PupilLab.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,6 @@ def on_button(self,key):
print("Calibration start")
self.calibration = True

# if key.char == 'w' and self.prev_event:
# print("Pushing on width")
# self.gestures.start_calibration()

# if key.char == 'e' and self.prev_event:
# print("Pushing on height")
# self.gestures.add_offset()



def __display_clusters(self,whiteboardPupil,buffor):

for point in buffor.getBuffor():
Expand Down Expand Up @@ -199,8 +189,9 @@ def __display_eye(self,frame):
self.prev_event = event

if not event is None:
print(f"event.point_screen: {event.point_screen}")
self.frame_counter += 1

if not event.blink:
self.dot_widget.setColour((int(255*(1-event.fixation)),120,int(255*event.fixation)))
else:
Expand Down
44 changes: 23 additions & 21 deletions eyeGestures/screenTracker/screenTracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,31 @@

# THIS FILE IS SLOWLY BECOMING BLACK MAGIC

def detect_edges(screen, display, point_on_screen, point_on_display):
def detect_edges(roi, display, point_on_screen, point_on_display):
(s_x,s_y) = point_on_screen
(d_x,d_y) = point_on_display

new_w = screen.width
margin = 5
x,y,width,height = roi.getBoundaries()
new_roi = dp.ScreenROI(x,y,width,height)

# new_w = screen.width
# margin = 5
# TODO: fix this to estimate w and h
if(d_x <= 0 or d_x >= display.width):
new_w = abs(screen.getCenter().x - s_x) * 1 + margin
if(d_x <= 0):
new_roi.width = new_roi.width + abs(new_roi.x - s_x)
new_roi.x = s_x

if screen.width < new_w:
pass
else:
new_w = screen.width

new_h = screen.height
if(d_y <= 0 or d_y >= display.height):
new_h = abs(screen.getCenter().y - s_y) * 1 + margin
if(d_x >= display.width):
new_roi.width = abs(new_roi.x - s_x)

if(d_y <= 0):
new_roi.height = new_roi.height + abs(new_roi.y - s_y)
new_roi.y = s_y

if screen.height < new_h:
pass
else:
new_h = screen.height
if(d_y >= display.height):
new_roi.height = abs(new_roi.y - s_y)

return (new_w,new_h)
return new_roi

def rescale_h(roi, scale_h, change = 0.5):
scale_diff_h = abs(1.0 - scale_h)
Expand Down Expand Up @@ -104,9 +104,11 @@ def process(self,point,buffor_length,roi,edges,screen,display,heatmap):
p_on_display = self.screen2display(point,roi,display)

if buffor_length > 20:
new_screen_w,new_screen_h = detect_edges(roi, display, point, p_on_display)
edges.width = new_screen_w
edges.height = new_screen_h
new_edges = detect_edges(roi, display, point, p_on_display)
edges.x = new_edges.x
edges.y = new_edges.y
edges.width = new_edges.width
edges.height = new_edges.height

p_on_display = (p_on_display[0] + display.offset_x, p_on_display[1] + display.offset_y)

Expand Down

0 comments on commit 4e2c876

Please sign in to comment.