mirror of
https://github.com/EyeTrackVR/EyeTrackVR.git
synced 2025-11-04 14:39:42 +08:00
fix y axis flip and OSC stuff
This commit is contained in:
parent
5f14ceafcc
commit
d781ccd95b
@ -400,9 +400,9 @@ class EyeProcessor:
|
|||||||
if xl > 0:
|
if xl > 0:
|
||||||
out_x = -abs(max(0.0, min(1.0, xl)))
|
out_x = -abs(max(0.0, min(1.0, xl)))
|
||||||
if yd > 0:
|
if yd > 0:
|
||||||
out_y = max(0.0, min(1.0, yd))
|
out_y = -abs(max(0.0, min(1.0, yd)))
|
||||||
if yu > 0:
|
if yu > 0:
|
||||||
out_y = -abs(max(0.0, min(1.0, yu)))
|
out_y = max(0.0, min(1.0, yu))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
noisy_point = np.array([out_x, out_y]) #fliter our values with a One Euro Filter
|
noisy_point = np.array([out_x, out_y]) #fliter our values with a One Euro Filter
|
||||||
@ -627,7 +627,6 @@ class EyeProcessor:
|
|||||||
self.ymax = eym
|
self.ymax = eym
|
||||||
if eym < self.ymin:
|
if eym < self.ymin:
|
||||||
self.ymin = eym
|
self.ymin = eym
|
||||||
print(eym, self.ymin, self.ymax)
|
|
||||||
self.calibration_frame_counter -= 1
|
self.calibration_frame_counter -= 1
|
||||||
|
|
||||||
#print(self.yoff)
|
#print(self.yoff)
|
||||||
@ -661,9 +660,9 @@ class EyeProcessor:
|
|||||||
if xl > 0:
|
if xl > 0:
|
||||||
out_x = -abs(max(0.0, min(1.0, xl)))
|
out_x = -abs(max(0.0, min(1.0, xl)))
|
||||||
if yd > 0:
|
if yd > 0:
|
||||||
out_y = max(0.0, min(1.0, yd))
|
out_y = -abs(max(0.0, min(1.0, yd)))
|
||||||
if yu > 0:
|
if yu > 0:
|
||||||
out_y = -abs(max(0.0, min(1.0, yu)))
|
out_y = max(0.0, min(1.0, yu))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -28,12 +28,12 @@ class VRChatOSC:
|
|||||||
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
||||||
yl = 621
|
yl = 621
|
||||||
yr = 621
|
yr = 621
|
||||||
sx = 0
|
sx = 0
|
||||||
sy = 0
|
sy = 0
|
||||||
se = 0
|
se = 0
|
||||||
was_blinking = True
|
|
||||||
while True:
|
while True:
|
||||||
if self.cancellation_event.is_set():
|
if self.cancellation_event.is_set():
|
||||||
print("Exiting OSC Queue")
|
print("Exiting OSC Queue")
|
||||||
@ -46,29 +46,15 @@ class VRChatOSC:
|
|||||||
|
|
||||||
if not eye_info.blink:
|
if not eye_info.blink:
|
||||||
|
|
||||||
if was_blinking == True:
|
|
||||||
if eye_id in [EyeId.LEFT, EyeId.BOTH]:
|
|
||||||
self.client.send_message("/avatar/parameters/LeftEyeLid", float(0)) # old param open left
|
|
||||||
self.client.send_message("/avatar/parameters/LeftEyeLidExpandedSqueeze", float(0.8)) # open left eye
|
|
||||||
|
|
||||||
if eye_id in [EyeId.RIGHT, EyeId.BOTH]:
|
|
||||||
self.client.send_message("/avatar/parameters/RightEyeLid", float(0)) # old param open right, will be in the next few releases to not break things
|
|
||||||
self.client.send_message("/avatar/parameters/RightEyeLidExpandedSqueeze", float(0.8)) # open right eye
|
|
||||||
|
|
||||||
if se == 1:
|
|
||||||
self.client.send_message("/avatar/parameters/RightEyeLid", float(0))# old param open right
|
|
||||||
self.client.send_message("/avatar/parameters/LeftEyeLid", float(0))# old param open left
|
|
||||||
self.client.send_message("/avatar/parameters/RightEyeLidExpandedSqueeze", float(0.8)) # open right eye
|
|
||||||
self.client.send_message("/avatar/parameters/LeftEyeLidExpandedSqueeze", float(0.8)) # open left eye
|
|
||||||
was_blinking = False
|
|
||||||
|
|
||||||
if eye_id in [EyeId.RIGHT, EyeId.BOTH]:
|
if eye_id in [EyeId.RIGHT, EyeId.BOTH]:
|
||||||
sx = eye_info.x
|
sx = eye_info.x
|
||||||
yr = eye_info.y
|
yr = eye_info.y
|
||||||
sy = eye_info.y
|
sy = eye_info.y
|
||||||
|
|
||||||
|
|
||||||
self.client.send_message("/avatar/parameters/RightEyeX", eye_info.x)
|
self.client.send_message("/avatar/parameters/RightEyeX", eye_info.x)
|
||||||
|
self.client.send_message("/avatar/parameters/RightEyeLid", float(0))# old param open right
|
||||||
|
self.client.send_message("/avatar/parameters/RightEyeLidExpandedSqueeze", float(0.8)) # open right eye
|
||||||
|
|
||||||
# self.client.send_message(
|
# self.client.send_message(
|
||||||
# "/avatar/parameters/EyesDilation", eye_info.pupil_dialation
|
# "/avatar/parameters/EyesDilation", eye_info.pupil_dialation
|
||||||
#)
|
#)
|
||||||
@ -77,6 +63,8 @@ class VRChatOSC:
|
|||||||
yl = eye_info.y
|
yl = eye_info.y
|
||||||
sy = eye_info.y
|
sy = eye_info.y
|
||||||
self.client.send_message("/avatar/parameters/LeftEyeX", eye_info.x)
|
self.client.send_message("/avatar/parameters/LeftEyeX", eye_info.x)
|
||||||
|
self.client.send_message("/avatar/parameters/LeftEyeLid", float(0))# old param open left
|
||||||
|
self.client.send_message("/avatar/parameters/LeftEyeLidExpandedSqueeze", float(0.8)) # open left eye
|
||||||
|
|
||||||
if yr != 621 and yl != 621:
|
if yr != 621 and yl != 621:
|
||||||
y = (yr + yl) / 2
|
y = (yr + yl) / 2
|
||||||
@ -89,27 +77,21 @@ class VRChatOSC:
|
|||||||
self.client.send_message("/avatar/parameters/RightEyeX", sx)
|
self.client.send_message("/avatar/parameters/RightEyeX", sx)
|
||||||
self.client.send_message("/avatar/parameters/EyesY", sy)
|
self.client.send_message("/avatar/parameters/EyesY", sy)
|
||||||
|
|
||||||
if eye_id in [EyeId.LEFT, EyeId.BOTH]:
|
|
||||||
|
|
||||||
self.client.send_message("/avatar/parameters/LeftEyeLid", float(0))
|
|
||||||
|
|
||||||
if eye_id in [EyeId.RIGHT, EyeId.BOTH]:
|
|
||||||
|
|
||||||
self.client.send_message("/avatar/parameters/RightEyeLid", float(0)) # old param, will be in the next few releases to not break things
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
if eye_id in [EyeId.LEFT, EyeId.BOTH]:
|
if eye_id in [EyeId.LEFT, EyeId.BOTH]:
|
||||||
self.client.send_message("/avatar/parameters/LeftEyeLid", float(1))
|
self.client.send_message("/avatar/parameters/LeftEyeLid", float(1))
|
||||||
|
self.client.send_message("/avatar/parameters/LeftEyeLidExpandedSqueeze", float(0))
|
||||||
|
|
||||||
if eye_id in [EyeId.RIGHT, EyeId.BOTH]:
|
if eye_id in [EyeId.RIGHT, EyeId.BOTH]:
|
||||||
self.client.send_message("/avatar/parameters/RightEyeLid", float(1))
|
self.client.send_message("/avatar/parameters/RightEyeLid", float(1))
|
||||||
|
self.client.send_message("/avatar/parameters/RightEyeLidExpandedSqueeze", float(0)) # close eye
|
||||||
|
|
||||||
else:
|
if se == 1:
|
||||||
self.client.send_message("/avatar/parameters/RightEyeLid", float(1)) #close eye
|
self.client.send_message("/avatar/parameters/RightEyeLid", float(1)) #close eye
|
||||||
self.client.send_message("/avatar/parameters/LeftEyeLid", float(1))
|
self.client.send_message("/avatar/parameters/LeftEyeLid", float(1))
|
||||||
self.client.send_message("/avatar/parameters/RightEyeLidExpandedSqueeze", float(0)) # close eye
|
self.client.send_message("/avatar/parameters/RightEyeLidExpandedSqueeze", float(0)) # close eye
|
||||||
self.client.send_message("/avatar/parameters/LeftEyeLidExpandedSqueeze", float(0))
|
self.client.send_message("/avatar/parameters/LeftEyeLidExpandedSqueeze", float(0))
|
||||||
was_blinking = True
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user