mirror of
https://github.com/EyeTrackVR/EyeTrackVR.git
synced 2025-09-26 23:09:28 +08:00
feat: expose LEAP calibration samples
This commit is contained in:
parent
da9cdb5436
commit
fae1a953cb
@ -169,6 +169,7 @@ class EyeTrackSettingsConfig(BaseModel):
|
||||
ibo_filter_samples: int = 400
|
||||
ibo_average_output_samples: int = 0
|
||||
ibo_fully_close_eye_threshold: float = 0.3
|
||||
leap_calibration_samples: int = 2000
|
||||
calibration_samples: int = 600
|
||||
osc_right_eye_close_address: str = "/avatar/parameters/RightEyeLidExpandedSqueeze"
|
||||
osc_left_eye_close_address: str = "/avatar/parameters/LeftEyeLidExpandedSqueeze"
|
||||
|
@ -319,7 +319,7 @@ class EyeProcessor:
|
||||
self.rawx,
|
||||
self.rawy,
|
||||
self.eyeopen,
|
||||
) = self.er_leap.run(self.current_image_gray, self.current_image_gray_clean)
|
||||
) = self.er_leap.run(self.current_image_gray, self.current_image_gray_clean, self.calibration_frame_counter, self.settings.leap_calibration_samples)
|
||||
|
||||
if len(self.prev_y_list) >= 100: # "lock" eye when close/blink IN TESTING, kinda broke
|
||||
self.prev_y_list.pop(0)
|
||||
@ -391,7 +391,7 @@ class EyeProcessor:
|
||||
def LEAPM(self):
|
||||
self.thresh = self.current_image_gray.copy()
|
||||
(self.current_image_gray, self.rawx, self.rawy, self.eyeopen,) = self.er_leap.run(
|
||||
self.current_image_gray, self.current_image_gray_clean
|
||||
self.current_image_gray, self.current_image_gray_clean, self.calibration_frame_counter, self.settings.leap_calibration_samples
|
||||
) # TODO: make own self var and LEAP toggle
|
||||
self.thresh = self.current_image_gray.copy()
|
||||
# todo: lorow, fix this as well
|
||||
|
@ -111,15 +111,18 @@ class LEAP_C:
|
||||
d2 = math.dist(pre_landmark[2], pre_landmark[4])
|
||||
d = (d1 + d2) / 2
|
||||
|
||||
if len(self.openlist) > 0 and d >= np.percentile(self.openlist, 80):
|
||||
if len(self.openlist) > 0 and d >= np.percentile(self.openlist, 80) and len(self.openlist) < self.calibration_samples:
|
||||
self.maxlist.append(d)
|
||||
|
||||
if len(self.maxlist) > 2000:
|
||||
self.maxlist.pop(0)
|
||||
# if len(self.maxlist) > 2000:
|
||||
# self.maxlist.pop(0)
|
||||
|
||||
normal_open = np.percentile(self.openlist, 70) if len(self.openlist) >= 500 else 0.8
|
||||
|
||||
if len(self.openlist) < 2500:
|
||||
if self.calib == 0:
|
||||
self.openlist = []
|
||||
|
||||
if len(self.openlist) < self.calibration_samples:
|
||||
self.openlist.append(d)
|
||||
|
||||
try:
|
||||
@ -152,8 +155,10 @@ class External_Run_LEAP:
|
||||
def __init__(self):
|
||||
self.algo = LEAP_C()
|
||||
|
||||
def run(self, current_image_gray, current_image_gray_clean):
|
||||
def run(self, current_image_gray, current_image_gray_clean, calib, calibration_samples):
|
||||
self.algo.current_image_gray = current_image_gray
|
||||
self.algo.current_image_gray_clean = current_image_gray_clean
|
||||
self.algo.calib = calib
|
||||
self.algo.calibration_samples = calibration_samples
|
||||
img, x, y, per = self.algo.leap_run()
|
||||
return img, x, y, per
|
||||
|
@ -33,6 +33,7 @@ class BlinkAlgoSettingsModule(BaseSettingsModule):
|
||||
self.ibo_fully_close_eye_threshold = f"-CLOSETHRESH{widget_id}-"
|
||||
self.gui_circular_crop_left = f"-CIRCLECROPLEFT{widget_id}-"
|
||||
self.gui_circular_crop_right = f"-CIRCLECROPRIGHT{widget_id}-"
|
||||
self.leap_calibration_samples = f"-LEAPCALIBRATION{widget_id}-"
|
||||
|
||||
def get_layout(self):
|
||||
return [
|
||||
@ -63,6 +64,14 @@ class BlinkAlgoSettingsModule(BaseSettingsModule):
|
||||
background_color="#424042",
|
||||
),
|
||||
],
|
||||
[
|
||||
sg.Text("LEAP Calibration Samples", background_color="#424042"),
|
||||
sg.InputText(
|
||||
self.config.leap_calibration_samples,
|
||||
key=self.leap_calibration_samples,
|
||||
size=(0, 10),
|
||||
),
|
||||
],
|
||||
[
|
||||
sg.Text("IBO Filter Sample Size", background_color="#424042"),
|
||||
sg.InputText(
|
||||
|
Loading…
Reference in New Issue
Block a user