Skip to content

Commit

Permalink
adding saving sensitivity to files
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterWaIIace committed Apr 16, 2024
1 parent c806588 commit 8fc9596
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
8 changes: 5 additions & 3 deletions apps/appUtils/data_saver.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __save_screenshots(self):
print("no item available")
print("exiting saving")

def add_frame(self,directory,gevent,rois_to_save):
def add_frame(self,directory,gevent,rois_to_save,x_sensitivity,y_sensitivity):
timestamp = datetime.datetime.now().timestamp()

Path(f"./data/{directory}").mkdir(parents=True, exist_ok=True)
Expand All @@ -60,7 +60,7 @@ def add_frame(self,directory,gevent,rois_to_save):

headers = ["unix_timestamp","point_x", "point_y", "blink", "fixation",
"screen_x", "screen_y", "screen_width", "screen_height",
"l_eye_landmarks", "r_eye_landmarks", "l_eye_pupil", "r_eye_pupil","rois"]
"l_eye_landmarks", "r_eye_landmarks", "l_eye_pupil", "r_eye_pupil","rois","x_sensitivity","y_sensitivity"]

if self.sizes[self.number_of_csv] > 100:
self.number_of_csv += 1
Expand Down Expand Up @@ -93,7 +93,9 @@ def add_frame(self,directory,gevent,rois_to_save):
pickle.dumps(r_eye_landmarks),
pickle.dumps(l_eye_pupil),
pickle.dumps(r_eye_pupil),
rois_to_save]
rois_to_save,
x_sensitivity,
y_sensitivity]

writer.writerow(row)
self.sizes[self.number_of_csv] += 1
Expand Down
7 changes: 5 additions & 2 deletions apps/app_win.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,13 @@ def on_quit(self):
def save_data(self,event,rois_to_save):
if not self.calibrator.calibrated():
filename = f"calib_{self.eyegesture_widget.get_text()}"
self.dataSavingMan.add_frame(filename,event,rois_to_save)
else:
filename = f"{self.eyegesture_widget.get_text()}"
self.dataSavingMan.add_frame(filename,event,rois_to_save)
self.dataSavingMan.add_frame(filename,
event,
rois_to_save,
self.sensitivity_roi_width,
self.sensitivity_roi_height)

def __display_eye(self,frame):
frame = cv2.flip(frame, 1)
Expand Down

0 comments on commit 8fc9596

Please sign in to comment.