mirror of
https://github.com/Project-Babble/ProjectBabble.git
synced 2026-12-05 08:12:20 -08:00
fix config save, fix config load, fix config when check is unchecked
This commit is contained in:
1 parent
92d8c1def7
commit
549d4ec21f
3 files changed
+18
-11
No files matched your search
@@ -4,8 +4,7 @@ from dataclasses import dataclass
|
||||
import sys
|
||||
import asyncio
|
||||
sys.path.append(".")
|
||||
from config import BabbleCameraConfig
|
||||
from config import BabbleSettingsConfig
|
||||
from config import BabbleCameraConfig, BabbleSettingsConfig, BabbleConfig
|
||||
import queue
|
||||
import threading
|
||||
import numpy as np
|
||||
@@ -42,6 +41,7 @@ class EyeProcessor:
|
||||
self,
|
||||
config: "BabbleCameraConfig",
|
||||
settings: "BabbleSettingsConfig",
|
||||
fullconfig: "BabbleConfig",
|
||||
cancellation_event: "threading.Event",
|
||||
capture_event: "threading.Event",
|
||||
capture_queue_incoming: "queue.Queue",
|
||||
@@ -52,6 +52,7 @@ class EyeProcessor:
|
||||
self.config = config
|
||||
self.settings = settings
|
||||
self.eye_id = eye_id
|
||||
self.config_class = fullconfig
|
||||
# Cross-thread communication management
|
||||
self.capture_queue_incoming = capture_queue_incoming
|
||||
self.image_queue_outgoing = image_queue_outgoing
|
||||
@@ -270,10 +271,11 @@ class EyeProcessor:
|
||||
|
||||
|
||||
run_model(self)
|
||||
if self.config.use_calibration:
|
||||
cal.cal_osc(self, self.output)
|
||||
else:
|
||||
pass
|
||||
#if self.config.use_calibration:
|
||||
cal.cal_osc(self, self.output)
|
||||
|
||||
#else:
|
||||
# pass
|
||||
#print(self.output)
|
||||
self.output_images_and_update(self.thresh, CamInfo(self.current_algo, self.output))
|
||||
|
||||
@@ -59,6 +59,7 @@ class CameraWidget:
|
||||
self.ransac = EyeProcessor(
|
||||
self.config,
|
||||
self.settings_config,
|
||||
self.main_config,
|
||||
self.cancellation_event,
|
||||
self.capture_event,
|
||||
self.capture_queue,
|
||||
|
||||
@@ -38,8 +38,8 @@ class cal():
|
||||
# Store the min and max values in the min_max_array
|
||||
self.min_max_array[0, i] = min_value
|
||||
self.min_max_array[1, i] = max_value
|
||||
|
||||
self.settings.calib_array = self.min_max_array
|
||||
self.settings.calib_array = np.array2string(self.min_max_array, separator=',')
|
||||
self.config_class.save()
|
||||
print("[INFO] Calibration completed.")
|
||||
|
||||
PlaySound('Audio/completed.wav', SND_FILENAME | SND_ASYNC)
|
||||
@@ -55,9 +55,11 @@ class cal():
|
||||
# np.append(self.calibrate_config, array.reshape(-1, 1), axis=1)
|
||||
|
||||
self.calibration_frame_counter -= 1
|
||||
varcount = 0
|
||||
filtered_output = []
|
||||
if self.settings.calib_array is not None and np.any(self.settings.calib_array):
|
||||
# print(self.settings.calib_array)
|
||||
if self.settings.calib_array is not None and self.config.use_calibration:
|
||||
self.min_max_array = np.fromstring(self.settings.calib_array.replace('[', '').replace(']', ''), sep=',')
|
||||
self.min_max_array = self.min_max_array.reshape((2, 45))
|
||||
|
||||
calibrated_array = np.zeros_like(array)
|
||||
for i, value in enumerate(array):
|
||||
min_value = self.min_max_array[0, i]
|
||||
@@ -70,4 +72,6 @@ class cal():
|
||||
|
||||
calibrated_array[i] = calibrated_value
|
||||
array = calibrated_array
|
||||
|
||||
|
||||
return array
|
||||
Reference in new issue
Block a user