fix config calibration saves

This commit is contained in:
Prohurtz 2023-06-24 13:48:00 -05:00
parent bbe1629ebd
commit 338591617e
3 changed files with 10 additions and 4 deletions

View File

@ -61,6 +61,7 @@ class CameraWidget:
self.ransac = EyeProcessor( self.ransac = EyeProcessor(
self.config, self.config,
self.settings_config, self.settings_config,
main_config,
self.cancellation_event, self.cancellation_event,
self.capture_event, self.capture_event,
self.capture_queue, self.capture_queue,

View File

@ -83,6 +83,7 @@ class EyeProcessor:
self, self,
config: "EyeTrackCameraConfig", config: "EyeTrackCameraConfig",
settings: "EyeTrackSettingsConfig", settings: "EyeTrackSettingsConfig",
baseconfig: "EyetrackConfig",
cancellation_event: "threading.Event", cancellation_event: "threading.Event",
capture_event: "threading.Event", capture_event: "threading.Event",
capture_queue_incoming: "queue.Queue", capture_queue_incoming: "queue.Queue",
@ -99,6 +100,7 @@ class EyeProcessor:
self.cancellation_event = cancellation_event self.cancellation_event = cancellation_event
self.capture_event = capture_event self.capture_event = capture_event
self.eye_id = eye_id self.eye_id = eye_id
self.baseconfig = baseconfig
# Cross algo state # Cross algo state
self.lkg_projected_sphere = None self.lkg_projected_sphere = None
@ -120,6 +122,7 @@ class EyeProcessor:
# Keep large in order to recenter correctly # Keep large in order to recenter correctly
self.calibration_frame_counter = None self.calibration_frame_counter = None
self.eyeoffx = 1 self.eyeoffx = 1
self.printcal = True
self.xmax = -69420 self.xmax = -69420
self.xmin = 69420 self.xmin = 69420

View File

@ -18,7 +18,6 @@ class cal():
cx = 1 cx = 1
if cy == 0: if cy == 0:
cy = 1 cy = 1
if self.eye_id == EyeId.RIGHT: if self.eye_id == EyeId.RIGHT:
flipx = self.settings.gui_flip_x_axis_right flipx = self.settings.gui_flip_x_axis_right
else: else:
@ -27,6 +26,7 @@ class cal():
self.calibration_frame_counter = None self.calibration_frame_counter = None
self.config.calib_XOFF = cx self.config.calib_XOFF = cx
self.config.calib_YOFF = cy self.config.calib_YOFF = cy
self.baseconfig.save()
PlaySound('Audio/completed.wav', SND_FILENAME | SND_ASYNC) PlaySound('Audio/completed.wav', SND_FILENAME | SND_ASYNC)
if self.calibration_frame_counter == self.settings.calibration_samples: if self.calibration_frame_counter == self.settings.calibration_samples:
self.config.calib_XMAX = -69420 self.config.calib_XMAX = -69420
@ -63,8 +63,8 @@ class cal():
out_x = 0.5 out_x = 0.5
out_y = 0.5 out_y = 0.5
if self.config.calib_XMAX != None and self.config.calib_XOFF != None: if self.config.calib_XMAX != None and self.config.calib_XOFF != None:
calib_diff_x_MAX = self.config.calib_XMAX - self.config.calib_XOFF calib_diff_x_MAX = self.config.calib_XMAX - self.config.calib_XOFF
if calib_diff_x_MAX == 0: if calib_diff_x_MAX == 0:
calib_diff_x_MAX = 1 calib_diff_x_MAX = 1
@ -125,5 +125,7 @@ class cal():
pass pass
return out_x, out_y return out_x, out_y
else: 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 return 0, 0