fix: eye falloff dom eye bugged

This commit is contained in:
Prohurtz 2024-03-28 07:23:37 -05:00
parent 7c9ed1dc5c
commit 25591b6104
2 changed files with 34 additions and 28 deletions

View File

@ -317,7 +317,7 @@ class cal:
out_x = -abs(max(0.0, min(1.0, xl)))
if self.settings.gui_outer_side_falloff:
print("pn")
run_time = time.time()
out_x_mult = out_x * 100
out_y_mult = out_y * 100
@ -334,7 +334,7 @@ class cal:
var.past_x = out_x_mult
var.past_y = out_y_mult
out_x, out_y = velocity_falloff(self, var, out_x, out_y)
out_x, out_y = velocity_falloff(self, var, out_x, out_y)
try:
noisy_point = np.array([float(out_x), float(out_y)]) # fliter our values with a One Euro Filter

View File

@ -10,36 +10,42 @@ class EyeId(IntEnum):
def velocity_falloff(self, var, out_x, out_y):
print("call")
# Calculate the distance between the two eyes
dist = np.sqrt(np.square(var.l_eye_x - var.r_eye_x) + np.square(var.left_y - var.right_y))
if self.eye_id == EyeId.LEFT:
var.l_eye_x = out_x
var.left_y = out_y
if self.eye_id == EyeId.RIGHT:
var.r_eye_x = out_x
var.right_y = out_y
if (
self.settings.gui_right_eye_dominant
or self.settings.gui_left_eye_dominant
or self.settings.gui_outer_side_falloff
):
# Calculate the distance between the two eyes
dist = np.sqrt(np.square(var.l_eye_x - var.r_eye_x) + np.square(var.left_y - var.right_y))
if self.eye_id == EyeId.LEFT:
var.l_eye_x = out_x
var.left_y = out_y
# Check if the distance is greater than the threshold
if dist > self.settings.gui_eye_dominant_diff_thresh:
if self.eye_id == EyeId.RIGHT:
var.r_eye_x = out_x
var.right_y = out_y
if self.settings.gui_right_eye_dominant:
out_x, out_y = var.r_eye_x, var.right_y
# Check if the distance is greater than the threshold
if dist > self.settings.gui_eye_dominant_diff_thresh:
elif self.settings.gui_left_eye_dominant:
out_x, out_y = var.l_eye_x, var.left_y
else:
# If the distance is too large, identify the eye with the lower velocity
if var.l_eye_velocity < var.r_eye_velocity:
# Mirror the position of the eye with lower velocity to the other eye
if self.settings.gui_right_eye_dominant:
out_x, out_y = var.r_eye_x, var.right_y
else:
# Mirror the position of the eye with lower velocity to the other eye
out_x, out_y = var.l_eye_x, var.left_y
else:
# If the distance is within the threshold, do not mirror the eyes
pass
elif self.settings.gui_left_eye_dominant:
out_x, out_y = var.l_eye_x, var.left_y
else:
# If the distance is too large, identify the eye with the lower velocity
if var.l_eye_velocity < var.r_eye_velocity:
# Mirror the position of the eye with lower velocity to the other eye
out_x, out_y = var.r_eye_x, var.right_y
else:
# Mirror the position of the eye with lower velocity to the other eye
out_x, out_y = var.l_eye_x, var.left_y
else:
# If the distance is within the threshold, do not mirror the eyes
pass
else:
pass
return out_x, out_y