add algo toggles and rename blob

This commit is contained in:
Prohurtz 2022-12-19 18:13:56 -08:00
parent 61b1a4ad9c
commit 79647ad024
4 changed files with 33 additions and 12 deletions

View File

@ -22,7 +22,9 @@ class EyeTrackSettingsConfig(BaseModel):
gui_flip_x_axis_left: bool = False
gui_flip_x_axis_right: bool = False
gui_flip_y_axis: bool = False
gui_blob_fallback: bool = True
gui_RANSAC3D: bool = True
gui_HSF: bool = True
gui_BLOB: bool = True
gui_min_cutoff: str = "0.0004"
gui_speed_coefficient: str = "0.9"
gui_osc_address: str = "127.0.0.1"

View File

@ -934,7 +934,7 @@ class EyeProcessor:
)
return True
def blob_tracking_fallback(self):
def BLOB(self):
# define circle
if self.config.gui_circular_crop:
if self.cct == 0:
@ -1356,8 +1356,8 @@ class EyeProcessor:
# If we have no convex maidens, we have no pupil, and can't progress from here. Dump back to
# using blob tracking.
if len(convex_hulls) == 0:
if self.settings.gui_blob_fallback:
self.blob_tracking_fallback()
if self.settings.gui_BLOB:
self.BLOB()
else:
print("[INFO] Blob fallback disabled. Assuming blink.")
self.output_images_and_update(thresh, EyeInformation(InformationOrigin.RANSAC, 0, 0, 0, True))
@ -1375,7 +1375,7 @@ class EyeProcessor:
largest_hull.reshape(-1, 2)
)
except:
f = 1
f = True
# Get axis and angle of the ellipse, using pupil labs 2d algos. The next bit of code ranges
# from somewhat to completely magic, as most of it happens in native libraries (hence passing
@ -1458,13 +1458,14 @@ class EyeProcessor:
# Shove a concatenated image out to the main GUI thread for rendering
self.output_images_and_update(thresh, output_info)
except:
f = 1
f = True
return f
def run(self):
while True:
f = False
# Check to make sure we haven't been requested to close
if self.cancellation_event.is_set():
print("Exiting Tracking thread")
@ -1496,9 +1497,12 @@ class EyeProcessor:
try:
f = self.RANSAC3D()
if f == 1 and self.settings.gui_blob_fallback: #if a fail has been reported and other algo is enabled, use it.
self.gui_blob_fallback()
if self.settings.gui_RANSAC3D: #for now ransac goes first
f == self.RANSAC3D()
if f and self.settings.gui_HSF: #if a fail has been reported and other algo is enabled, use it.
f == self.HSF()
if f and self.settings.gui_blob_fallback:
f == self.BLOB()
except:
print("[WARN] ALL ALGORITHIMS HAVE FAILED OR ARE DISABLED.")

View File

@ -20,7 +20,9 @@ class SettingsWidget:
self.gui_osc_receiver_port = f"OSCRECEIVERPORT{widget_id}-"
self.gui_osc_recenter_address = f"OSCRECENTERADDRESS{widget_id}-"
self.gui_osc_recalibrate_address = f"OSCRECALIBRATEADDRESS{widget_id}-"
self.gui_blob_fallback = f"-BLOBFALLBACK{widget_id}-"
self.gui_BLOB = f"-BLOBFALLBACK{widget_id}-"
self.gui_HSF = f"-HSF{widget_id}-"
self.gui_RANSAC3D = f"-RANSAC3D{widget_id}-"
self.gui_blob_maxsize = f"-BLOBMAXSIZE{widget_id}-"
self.gui_blob_minsize = f"-BLOBMINSIZE{widget_id}-"
self.gui_speed_coefficient = f"-SPEEDCOEFFICIENT{widget_id}-"
@ -76,9 +78,21 @@ class SettingsWidget:
],
[sg.Checkbox(
"RANSAC 3D",
default=self.config.gui_RANSAC3D,
key=self.gui_RANSAC3D,
background_color='#424042',
),
sg.Checkbox(
"Haar Surround Feature",
default=self.config.gui_HSF,
key=self.gui_HSF,
background_color='#424042',
),
sg.Checkbox(
"Blob Fallback",
default=self.config.gui_blob_fallback,
key=self.gui_blob_fallback,
default=self.config.gui_BLOB,
key=self.gui_BLOB,
background_color='#424042',
),
],

View File

@ -0,0 +1 @@
{"version": 1, "right_eye": {"threshold": 53, "rotation_angle": 334, "roi_window_x": 134, "roi_window_y": 104, "roi_window_w": 132, "roi_window_h": 77, "focal_length": 30, "capture_source": "http://192.168.0.238/", "gui_circular_crop": false}, "left_eye": {"threshold": 82, "rotation_angle": 46, "roi_window_x": 117, "roi_window_y": 118, "roi_window_w": 120, "roi_window_h": 154, "focal_length": 30, "capture_source": "http://192.168.0.62", "gui_circular_crop": false}, "settings": {"gui_flip_x_axis_left": false, "gui_flip_x_axis_right": false, "gui_flip_y_axis": false, "gui_blob_fallback": true, "gui_min_cutoff": "0.0004", "gui_speed_coefficient": "0.9", "gui_osc_address": "127.0.0.1", "gui_osc_port": 9000, "gui_osc_receiver_port": 9001, "gui_osc_recenter_address": "/avatar/parameters/etvr_recenter", "gui_osc_recalibrate_address": "/avatar/parameters/etvr_recalibrate", "gui_blob_maxsize": 25.0, "gui_blob_minsize": 10.0, "gui_recenter_eyes": false, "gui_eye_falloff": false, "tracker_single_eye": 0, "gui_blink_sync": false}, "eye_display_id": 2}