mirror of
https://github.com/EyeTrackVR/EyeTrackVR.git
synced 2025-11-04 14:39:42 +08:00
fix: eye falloff dom eye bugged
This commit is contained in:
parent
7c9ed1dc5c
commit
25591b6104
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user