mirror of
https://github.com/EyeTrackVR/EyeTrackVR.git
synced 2025-11-04 14:39:42 +08:00
single eye in dual cam
This commit is contained in:
parent
3e10640780
commit
8adb0a8ece
@ -28,6 +28,11 @@ class VRChatOSC:
|
|||||||
yl = 0
|
yl = 0
|
||||||
yr = 0
|
yr = 0
|
||||||
|
|
||||||
|
sx = 0
|
||||||
|
se = 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
@ -38,10 +43,12 @@ class VRChatOSC:
|
|||||||
(eye_id, eye_info) = self.msg_queue.get(block=True, timeout=0.1)
|
(eye_id, eye_info) = self.msg_queue.get(block=True, timeout=0.1)
|
||||||
except queue.Empty:
|
except queue.Empty:
|
||||||
continue
|
continue
|
||||||
# If we're not blinking, set position
|
|
||||||
|
|
||||||
print(eye_info.blink)
|
print(eye_info.blink)
|
||||||
if not eye_info.blink:
|
if not eye_info.blink:
|
||||||
if eye_id in [EyeId.RIGHT, EyeId.BOTH]:
|
if eye_id in [EyeId.RIGHT, EyeId.BOTH]:
|
||||||
|
sx = eye_info.x
|
||||||
self.client.send_message(
|
self.client.send_message(
|
||||||
"/avatar/parameters/RightEyeX", eye_info.x
|
"/avatar/parameters/RightEyeX", eye_info.x
|
||||||
)
|
)
|
||||||
@ -49,11 +56,11 @@ class VRChatOSC:
|
|||||||
# "/avatar/parameters/EyesDilation", eye_info.pupil_dialation
|
# "/avatar/parameters/EyesDilation", eye_info.pupil_dialation
|
||||||
#)
|
#)
|
||||||
if eye_id in [EyeId.LEFT, EyeId.BOTH]:
|
if eye_id in [EyeId.LEFT, EyeId.BOTH]:
|
||||||
|
sx = eye_info.x
|
||||||
self.client.send_message(
|
self.client.send_message(
|
||||||
"/avatar/parameters/LeftEyeX", eye_info.x
|
"/avatar/parameters/LeftEyeX", eye_info.x
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
if eye_id in [EyeId.LEFT, EyeId.BOTH]:
|
if eye_id in [EyeId.LEFT, EyeId.BOTH]:
|
||||||
yl = eye_info.y
|
yl = eye_info.y
|
||||||
print('left y', yl)
|
print('left y', yl)
|
||||||
@ -65,9 +72,15 @@ class VRChatOSC:
|
|||||||
try:
|
try:
|
||||||
y = abs((yl + yr) / 2)
|
y = abs((yl + yr) / 2)
|
||||||
self.client.send_message("/avatar/parameters/EyesY", y)
|
self.client.send_message("/avatar/parameters/EyesY", y)
|
||||||
|
se = 0
|
||||||
except:
|
except:
|
||||||
print('Y ERROR')
|
se = 1
|
||||||
|
self.client.send_message("/avatar/parameters/LeftEyeX", sx) # only one eye is detected or there is an error. Send mirrored data to both eyes.
|
||||||
|
self.client.send_message("/avatar/parameters/RightEyeX", sx)
|
||||||
|
self.client.send_message("/avatar/parameters/RightEyeLid", float(0))
|
||||||
|
self.client.send_message("/avatar/parameters/LeftEyeLid", float(0))
|
||||||
|
|
||||||
|
|
||||||
if eye_id in [EyeId.LEFT, EyeId.BOTH]:
|
if eye_id in [EyeId.LEFT, EyeId.BOTH]:
|
||||||
|
|
||||||
self.client.send_message(
|
self.client.send_message(
|
||||||
@ -79,6 +92,8 @@ class VRChatOSC:
|
|||||||
"/avatar/parameters/RightEyeLid", float(0)
|
"/avatar/parameters/RightEyeLid", float(0)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if eye_id in [EyeId.LEFT, EyeId.BOTH]:
|
if eye_id in [EyeId.LEFT, EyeId.BOTH]:
|
||||||
|
|
||||||
@ -90,4 +105,8 @@ class VRChatOSC:
|
|||||||
self.client.send_message(
|
self.client.send_message(
|
||||||
"/avatar/parameters/RightEyeLid", float(1)
|
"/avatar/parameters/RightEyeLid", float(1)
|
||||||
)
|
)
|
||||||
|
if se == 1:
|
||||||
|
self.client.send_message("/avatar/parameters/RightEyeLid", float(1))
|
||||||
|
self.client.send_message("/avatar/parameters/LeftEyeLid", float(1))
|
||||||
|
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user