mirror of
https://github.com/EyeTrackVR/EyeTrackVR.git
synced 2025-11-04 14:39:42 +08:00
osc
This commit is contained in:
parent
7b869abc3b
commit
4e8db0d0d0
@ -6,7 +6,7 @@ from pythonosc import udp_client
|
|||||||
#higher intensity means more closed/ more white/less pupil
|
#higher intensity means more closed/ more white/less pupil
|
||||||
|
|
||||||
#Hm I need an acronym for this, any ideas?
|
#Hm I need an acronym for this, any ideas?
|
||||||
#IBO Intensity Based Openess
|
#IBO Intensity Based Openess
|
||||||
|
|
||||||
|
|
||||||
# HOW THIS WORKS:
|
# HOW THIS WORKS:
|
||||||
@ -80,8 +80,8 @@ def intense(x, y, frame):
|
|||||||
#eyeopen = (intensity - minp) / (maxp - minp)
|
#eyeopen = (intensity - minp) / (maxp - minp)
|
||||||
eyeopen = (intensity - maxp) / (minp - maxp)
|
eyeopen = (intensity - maxp) / (minp - maxp)
|
||||||
eyeopen = 1 - eyeopen
|
eyeopen = 1 - eyeopen
|
||||||
print(intensity, maxp, minp, x, y)
|
# print(intensity, maxp, minp, x, y)
|
||||||
# print(f"EYEOPEN: {eyeopen}")
|
print(f"EYEOPEN: {eyeopen}")
|
||||||
|
|
||||||
except:
|
except:
|
||||||
print('[INFO] Something went wrong, assuming blink.')
|
print('[INFO] Something went wrong, assuming blink.')
|
||||||
|
|||||||
@ -123,11 +123,9 @@ class VRChatOSC:
|
|||||||
|
|
||||||
if eye_id in [EyeId.RIGHT]:
|
if eye_id in [EyeId.RIGHT]:
|
||||||
rb = True
|
rb = True
|
||||||
if last_blink > 0.7:
|
self.client.send_message("/avatar/parameters/RightEyeLid", float(1))
|
||||||
for i in range(5):
|
self.client.send_message("/avatar/parameters/RightEyeLidExpandedSqueeze", float(eye_info.blink)) # close eye
|
||||||
self.client.send_message("/avatar/parameters/RightEyeLid", float(1))
|
|
||||||
self.client.send_message("/avatar/parameters/RightEyeLidExpandedSqueeze", float(eye_info.blink)) # close eye
|
|
||||||
last_blink = time.time() - last_blink
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if eye_id in [EyeId.LEFT]:
|
if eye_id in [EyeId.LEFT]:
|
||||||
@ -143,13 +141,10 @@ class VRChatOSC:
|
|||||||
self.client.send_message("/avatar/parameters/LeftEyeLid", float(0))# old param open left
|
self.client.send_message("/avatar/parameters/LeftEyeLid", float(0))# old param open left
|
||||||
self.client.send_message("/avatar/parameters/LeftEyeLidExpandedSqueeze", float(eye_info.blink)) # open left eye
|
self.client.send_message("/avatar/parameters/LeftEyeLidExpandedSqueeze", float(eye_info.blink)) # open left eye
|
||||||
if rb and lb: # If both eyes are closed, blink
|
if rb and lb: # If both eyes are closed, blink
|
||||||
if last_blink > 0.5:
|
self.client.send_message("/avatar/parameters/RightEyeLid", float(1)) #close eye
|
||||||
for i in range(4):
|
self.client.send_message("/avatar/parameters/LeftEyeLid", float(1))
|
||||||
self.client.send_message("/avatar/parameters/RightEyeLid", float(1)) #close eye
|
self.client.send_message("/avatar/parameters/RightEyeLidExpandedSqueeze", float(eye_info.blink)) # close eye
|
||||||
self.client.send_message("/avatar/parameters/LeftEyeLid", float(1))
|
self.client.send_message("/avatar/parameters/LeftEyeLidExpandedSqueeze", float(eye_info.blink))
|
||||||
self.client.send_message("/avatar/parameters/RightEyeLidExpandedSqueeze", float(eye_info.blink)) # close eye
|
|
||||||
self.client.send_message("/avatar/parameters/LeftEyeLidExpandedSqueeze", float(eye_info.blink))
|
|
||||||
last_blink = time.time() - last_blink
|
|
||||||
|
|
||||||
|
|
||||||
class VRChatOSCReceiver:
|
class VRChatOSCReceiver:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user