From 338591617e0c1a9c1a3d93a8ca2fb653d54f89d0 Mon Sep 17 00:00:00 2001 From: Prohurtz <48768484+RedHawk989@users.noreply.github.com> Date: Sat, 24 Jun 2023 13:48:00 -0500 Subject: [PATCH] fix config calibration saves --- EyeTrackApp/camera_widget.py | 1 + EyeTrackApp/eye_processor.py | 3 +++ EyeTrackApp/osc_calibrate_filter.py | 10 ++++++---- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/EyeTrackApp/camera_widget.py b/EyeTrackApp/camera_widget.py index 6cb7292..ff9452b 100644 --- a/EyeTrackApp/camera_widget.py +++ b/EyeTrackApp/camera_widget.py @@ -61,6 +61,7 @@ class CameraWidget: self.ransac = EyeProcessor( self.config, self.settings_config, + main_config, self.cancellation_event, self.capture_event, self.capture_queue, diff --git a/EyeTrackApp/eye_processor.py b/EyeTrackApp/eye_processor.py index bb7f306..e562c94 100644 --- a/EyeTrackApp/eye_processor.py +++ b/EyeTrackApp/eye_processor.py @@ -83,6 +83,7 @@ class EyeProcessor: self, config: "EyeTrackCameraConfig", settings: "EyeTrackSettingsConfig", + baseconfig: "EyetrackConfig", cancellation_event: "threading.Event", capture_event: "threading.Event", capture_queue_incoming: "queue.Queue", @@ -99,6 +100,7 @@ class EyeProcessor: self.cancellation_event = cancellation_event self.capture_event = capture_event self.eye_id = eye_id + self.baseconfig = baseconfig # Cross algo state self.lkg_projected_sphere = None @@ -120,6 +122,7 @@ class EyeProcessor: # Keep large in order to recenter correctly self.calibration_frame_counter = None self.eyeoffx = 1 + self.printcal = True self.xmax = -69420 self.xmin = 69420 diff --git a/EyeTrackApp/osc_calibrate_filter.py b/EyeTrackApp/osc_calibrate_filter.py index d4d3ab4..8b27e62 100644 --- a/EyeTrackApp/osc_calibrate_filter.py +++ b/EyeTrackApp/osc_calibrate_filter.py @@ -18,7 +18,6 @@ class cal(): cx = 1 if cy == 0: cy = 1 - if self.eye_id == EyeId.RIGHT: flipx = self.settings.gui_flip_x_axis_right else: @@ -27,6 +26,7 @@ class cal(): self.calibration_frame_counter = None self.config.calib_XOFF = cx self.config.calib_YOFF = cy + self.baseconfig.save() PlaySound('Audio/completed.wav', SND_FILENAME | SND_ASYNC) if self.calibration_frame_counter == self.settings.calibration_samples: self.config.calib_XMAX = -69420 @@ -46,7 +46,7 @@ class cal(): self.config.calib_YMAX = cy if cy < self.config.calib_YMIN: self.config.calib_YMIN = cy - + self.calibration_frame_counter -= 1 if self.settings.gui_recenter_eyes == True: @@ -62,9 +62,9 @@ class cal(): out_x = 0.5 out_y = 0.5 - if self.config.calib_XMAX != None and self.config.calib_XOFF != None: + calib_diff_x_MAX = self.config.calib_XMAX - self.config.calib_XOFF if calib_diff_x_MAX == 0: calib_diff_x_MAX = 1 @@ -125,5 +125,7 @@ class cal(): pass return out_x, out_y else: - print("[INFO] Please Calibrate Eyes") + if self.printcal: + print("\033[91m[ERROR] Please Calibrate Eye(s).\033[0m") + self.printcal = False return 0, 0 \ No newline at end of file