From 8fc9596af927ba59df132f045e65aee2ae64dc4b Mon Sep 17 00:00:00 2001 From: PeterWaIIace Date: Tue, 16 Apr 2024 20:11:07 +0200 Subject: [PATCH] adding saving sensitivity to files --- apps/appUtils/data_saver.py | 8 +++++--- apps/app_win.py | 7 +++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/apps/appUtils/data_saver.py b/apps/appUtils/data_saver.py index db0328b..960c586 100644 --- a/apps/appUtils/data_saver.py +++ b/apps/appUtils/data_saver.py @@ -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) @@ -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 @@ -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 diff --git a/apps/app_win.py b/apps/app_win.py index c0436c5..b0fd445 100644 --- a/apps/app_win.py +++ b/apps/app_win.py @@ -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)