@@ -57,13 +57,16 @@ def _load_calibration(self, filename):
57
57
self .calib = json .load (user_file )
58
58
self ._last_update = os .fstat (user_file .fileno ()).st_mtime
59
59
self .jsonminmax = [
60
- [self .calib ["cheekPuff" ]["min" ],self .calib ["cheekPuff" ]["max" ]], # CheekPuff
61
- [self .calib ["noseSneerLeft" ]["min" ],self .calib ["noseSneerLeft" ]["max" ]], # noseSneerLeft
62
- [self .calib ["noseSneerRight" ]["min" ],self .calib ["noseSneerRight" ]["max" ]], # noseSneerRight
60
+ [self .calib ["cheekPuffLeft" ]["min" ],self .calib ["cheekPuffLeft" ]["max" ]], # CheekPuff
61
+ [self .calib ["cheekPuffRight" ]["min" ],self .calib ["cheekPuffRight" ]["max" ]], # CheekPuff
62
+ [self .calib ["cheekSuckLeft" ]["min" ],self .calib ["cheekSuckLeft" ]["max" ]], # CheekPuff
63
+ [self .calib ["cheekSuckRight" ]["min" ],self .calib ["cheekSuckRight" ]["max" ]], # CheekPuff
63
64
[self .calib ["jawOpen" ]["min" ],self .calib ["jawOpen" ]["max" ]], # jawOpen
64
65
[self .calib ["jawForward" ]["min" ],self .calib ["jawForward" ]["max" ]], # jawForward
65
66
[self .calib ["jawLeft" ]["min" ],self .calib ["jawLeft" ]["max" ]], # jawLeft
66
67
[self .calib ["jawRight" ]["min" ],self .calib ["jawRight" ]["max" ]], # jawRight
68
+ [self .calib ["noseSneerLeft" ]["min" ],self .calib ["noseSneerLeft" ]["max" ]], # noseSneerLeft
69
+ [self .calib ["noseSneerRight" ]["min" ],self .calib ["noseSneerRight" ]["max" ]], # noseSneerRight
67
70
[self .calib ["mouthFunnel" ]["min" ],self .calib ["mouthFunnel" ]["max" ]], # mouthFunnel
68
71
[self .calib ["mouthPucker" ]["min" ],self .calib ["mouthPucker" ]["max" ]], # mouthPucker
69
72
[self .calib ["mouthLeft" ]["min" ],self .calib ["mouthLeft" ]["max" ]], # mouthLeft
@@ -88,49 +91,20 @@ def _load_calibration(self, filename):
88
91
[self .calib ["mouthStretchLeft" ]["min" ],self .calib ["mouthStretchLeft" ]["max" ]], # mouthStretchLeft
89
92
[self .calib ["mouthStretchRight" ]["min" ],self .calib ["mouthStretchRight" ]["max" ]], # mouthStretchRight
90
93
[self .calib ["tongueOut" ]["min" ],self .calib ["tongueOut" ]["max" ]], # tongueOut
94
+ [self .calib ["tongueUp" ]["min" ],self .calib ["tongueUp" ]["max" ]], # tongueOut
95
+ [self .calib ["tongueDown" ]["min" ],self .calib ["tongueDown" ]["max" ]], # tongueOut
96
+ [self .calib ["tongueLeft" ]["min" ],self .calib ["tongueLeft" ]["max" ]], # tongueOut
97
+ [self .calib ["tongueRight" ]["min" ],self .calib ["tongueRight" ]["max" ]], # tongueOut
98
+ [self .calib ["tongueRoll" ]["min" ],self .calib ["tongueRoll" ]["max" ]], # tongueOut
99
+ [self .calib ["tongueBendDown" ]["min" ],self .calib ["tongueBendDown" ]["max" ]], # tongueOut
100
+ [self .calib ["tongueCurlUp" ]["min" ],self .calib ["tongueCurlUp" ]["max" ]], # tongueOut
101
+ [self .calib ["tongueSquish" ]["min" ],self .calib ["tongueSquish" ]["max" ]], # tongueOut
102
+ [self .calib ["tongueFlat" ]["min" ],self .calib ["tongueFlat" ]["max" ]], # tongueOut
103
+ [self .calib ["tongueTwistLeft" ]["min" ],self .calib ["tongueTwistLeft" ]["max" ]], # tongueOut
104
+ [self .calib ["tongueTwistRight" ]["min" ],self .calib ["tongueTwistRight" ]["max" ]], # tongueOut
91
105
]
92
106
return self .jsonminmax
93
107
94
-
95
- def onesizefitsallminmaxarray (): # Some predefined ranges in stored values instead of the generated ones
96
- stored_values = [
97
- [0.2 , 0.6 ], # CheekPuff
98
- [0 , 1 ], # cheekSquintLeft
99
- [0 , 1 ], # cheekSquintRight
100
- [0 , 1 ], # noseSneerLeft
101
- [0 , 1 ], # noseSneerRight
102
- [0.03 , 0.6 ], # jawOpen
103
- [0.1 , 0.8 ], # jawForward
104
- [0.05 , 0.5 ], # jawLeft
105
- [0.05 , 0.5 ], # jawRight
106
- [0.1 , 0.6 ], # mouthFunnel
107
- [0.4 , 1 ], # mouthPucker
108
- [0.05 , 0.5 ], # mouthLeft
109
- [0.05 , 0.5 ], # mouthRight
110
- [0 , 0.5 ], # mouthRollUpper
111
- [0 , 0.3 ], # mouthRollLower
112
- [0.03 , 0.5 ], # mouthShrugUpper
113
- [0.03 , 0.5 ], # mouthShrugLower
114
- [0 , 0.5 ], # mouthClose
115
- [0.1 , 1 ], # mouthSmileLeft
116
- [0.1 , 1 ], # mouthSmileRight
117
- [0 , 0.6 ], # mouthFrownLeft
118
- [0 , 0.6 ], # mouthFrownRight
119
- [0 , 1 ], # mouthDimpleLeft
120
- [0 , 1 ], # mouthDimpleRight
121
- [0.02 , 0.8 ], # mouthUpperUpLeft
122
- [0.02 , 0.8 ], # mouthUpperUpRight
123
- [0.02 , 0.8 ], # mouthLowerDownLeft
124
- [0.02 , 0.8 ], # mouthLowerDownRight
125
- [0 , 1 ], # mouthPressLeft
126
- [0 , 1 ], # mouthPressRight
127
- [0.3 , 1 ], # mouthStretchLeft
128
- [0.3 , 1 ], # mouthStretchRight
129
- [0.2 , 0.8 ], # tongueOut
130
- ]
131
- return stored_values
132
-
133
-
134
108
135
109
def makeminmaxarray (amount ):
136
110
stored_values = []
@@ -168,11 +142,11 @@ def normalize_value(array):
168
142
layout = [
169
143
[sg .Image (key = '-IMAGE-' )],
170
144
[sg .Text ('Enter Webcam URL or Number (Defualts to 0)' ), sg .Input (key = '-URL-' , size = (30 , 1 ))],
171
- [sg .Text ('Enter Onnx model name (Defualts to EffnetB0300K .onnx)' ), sg .Input (key = '-MODEL-' , size = (30 , 1 ))],
145
+ [sg .Text ('Enter Onnx model name (Defualts to EFV2300K45E57 .onnx)' ), sg .Input (key = '-MODEL-' , size = (30 , 1 ))],
172
146
[sg .Text ('OSC Location Address' ), sg .Input (key = '-LOC-' , size = (30 , 1 ))],
173
147
[sg .Text ('Output Mutiplier (defualts to 1. Please use 100 if you are using the unity demo.)' ), sg .Input (key = '-MULT-' , size = (30 , 1 ))],
174
148
[sg .Text ('Enter OSC IP (Defualts to 127.0.0.1)' ), sg .Input (key = '-OSC-' , size = (30 , 1 ))],
175
- [sg .Text ('Enter OSC Port (Defualts to 9000 )' ), sg .Input (key = '-PORT-' , size = (30 , 1 ))],
149
+ [sg .Text ('Enter OSC Port (Defualts to 8888 )' ), sg .Input (key = '-PORT-' , size = (30 , 1 ))],
176
150
[sg .Text ('Enter Calibration file name (Defaults to calib.json)' ), sg .Input (key = '-JSON_FILE-' , size = (30 , 1 ))],
177
151
[sg .Text ('Press Ok to start the webcam' )],
178
152
[sg .Checkbox ('Flip 180' , key = '-FLIP180-' )],
@@ -199,7 +173,9 @@ def normalize_value(array):
199
173
OSCip = "127.0.0.1"
200
174
OSCport = values ['-PORT-' ] #VR Chat OSC port
201
175
if OSCport == '' :
202
- OSCport = 9000
176
+ OSCport = 8888
177
+ else :
178
+ OSCport = int (OSCport )
203
179
multi = values ['-MULT-' ]
204
180
if multi == '' :
205
181
multi = 1
@@ -208,7 +184,7 @@ def normalize_value(array):
208
184
client = udp_client .SimpleUDPClient (OSCip , OSCport )
209
185
model = values ['-MODEL-' ]
210
186
if model == '' :
211
- model = 'EffnetB0300K .onnx'
187
+ model = 'EFV2300K45E57 .onnx'
212
188
if calibjson == '' :
213
189
calibjson = 'calib.json'
214
190
usegpu = values ['-GPU-' ]
@@ -254,6 +230,7 @@ def normalize_value(array):
254
230
if flip90r :
255
231
frame = cv2 .rotate (frame , cv2 .ROTATE_90_COUNTERCLOCKWISE )
256
232
frame2 = frame
233
+ #frame = cv2.flip(frame, 1)
257
234
calibration .update_calib (calibjson ) # Checks and updates values of the json file
258
235
stored_values = calibration .jsonminmax
259
236
frame = cv2 .resize (frame , (256 , 256 ))
@@ -282,37 +259,51 @@ def normalize_value(array):
282
259
array = output
283
260
for i in range (len (output )): # Clip values between 0 - 1
284
261
output [i ] = max (min (output [i ], 1 ), 0 )
285
- client .send_message (location + "/cheekPuff" , array [0 ] * multi )
286
- client .send_message (location + "/noseSneerLeft" , output [5 ] * multi )
287
- client .send_message (location + "/noseSneerRight" , output [6 ] * multi )
288
- client .send_message (location + "/jawOpen" , array [1 ] * multi )
289
- client .send_message (location + "/jawForward" , array [2 ] * multi )
290
- client .send_message (location + "/jawLeft" , array [3 ] * multi )
291
- client .send_message (location + "/jawRight" , array [4 ] * multi )
292
- client .send_message (location + "/mouthFunnel" , array [7 ] * multi )
293
- client .send_message (location + "/mouthPucker" , array [8 ] * multi )
294
- client .send_message (location + "/mouthLeft" , array [9 ] * multi )
295
- client .send_message (location + "/mouthRight" , array [10 ] * multi )
296
- client .send_message (location + "/mouthRollUpper" , array [11 ] * multi )
297
- client .send_message (location + "/mouthRollLower" , array [12 ] * multi )
298
- client .send_message (location + "/mouthShrugUpper" , array [13 ] * multi )
299
- client .send_message (location + "/mouthShrugLower" , array [14 ] * multi )
300
- client .send_message (location + "/mouthClose" , output [15 ] * multi )
301
- client .send_message (location + "/mouthSmileLeft" , array [16 ] * multi )
302
- client .send_message (location + "/mouthSmileRight" , array [17 ] * multi )
303
- client .send_message (location + "/mouthFrownLeft" , array [18 ] * multi )
304
- client .send_message (location + "/mouthFrownRight" , array [19 ] * multi )
305
- client .send_message (location + "/mouthDimpleLeft" , array [20 ] * multi )
306
- client .send_message (location + "/mouthDimpleRight" , array [21 ] * multi )
307
- client .send_message (location + "/mouthUpperUpLeft" , array [22 ] * multi )
308
- client .send_message (location + "/mouthUpperUpRight" , array [23 ] * multi )
309
- client .send_message (location + "/mouthLowerDownLeft" , array [24 ] * multi )
310
- client .send_message (location + "/mouthLowerDownRight" , array [25 ] * multi )
311
- client .send_message (location + "/mouthPressLeft" , array [26 ] * multi )
312
- client .send_message (location + "/mouthPressRight" , array [27 ] * multi )
313
- client .send_message (location + "/mouthStretchLeft" , array [28 ] * multi )
314
- client .send_message (location + "/mouthStretchRight" , array [29 ] * multi )
315
- client .send_message (location + "/tongueOut" , array [30 ] * multi )
262
+ client .send_message (location + "/cheekPuffLeft" , array [0 ] * multi )
263
+ client .send_message (location + "/cheekPuffRight" , array [1 ] * multi )
264
+ client .send_message (location + "/cheekSuckLeft" , array [2 ] * multi )
265
+ client .send_message (location + "/cheekSuckRight" , array [3 ] * multi )
266
+ client .send_message (location + "/jawOpen" , array [4 ] * multi )
267
+ client .send_message (location + "/jawForward" , array [5 ] * multi )
268
+ client .send_message (location + "/jawLeft" , array [6 ] * multi )
269
+ client .send_message (location + "/jawRight" , array [7 ] * multi )
270
+ client .send_message (location + "/noseSneerLeft" , array [8 ] * multi )
271
+ client .send_message (location + "/noseSneerRight" , array [9 ] * multi )
272
+ client .send_message (location + "/mouthFunnel" , array [10 ] * multi )
273
+ client .send_message (location + "/mouthPucker" , array [11 ] * multi )
274
+ client .send_message (location + "/mouthLeft" , array [12 ] * multi )
275
+ client .send_message (location + "/mouthRight" , array [13 ] * multi )
276
+ client .send_message (location + "/mouthRollUpper" , array [14 ] * multi )
277
+ client .send_message (location + "/mouthRollLower" , array [15 ] * multi )
278
+ client .send_message (location + "/mouthShrugUpper" , array [16 ] * multi )
279
+ client .send_message (location + "/mouthShrugLower" , array [17 ] * multi )
280
+ client .send_message (location + "/mouthClose" , output [18 ] * multi )
281
+ client .send_message (location + "/mouthSmileLeft" , array [19 ] * multi )
282
+ client .send_message (location + "/mouthSmileRight" , array [20 ] * multi )
283
+ client .send_message (location + "/mouthFrownLeft" , array [21 ] * multi )
284
+ client .send_message (location + "/mouthFrownRight" , array [22 ] * multi )
285
+ client .send_message (location + "/mouthDimpleLeft" , array [23 ] * multi )
286
+ client .send_message (location + "/mouthDimpleRight" , array [24 ] * multi )
287
+ client .send_message (location + "/mouthUpperUpLeft" , array [25 ] * multi )
288
+ client .send_message (location + "/mouthUpperUpRight" , array [26 ] * multi )
289
+ client .send_message (location + "/mouthLowerDownLeft" , array [27 ] * multi )
290
+ client .send_message (location + "/mouthLowerDownRight" , array [28 ] * multi )
291
+ client .send_message (location + "/mouthPressLeft" , array [29 ] * multi )
292
+ client .send_message (location + "/mouthPressRight" , array [30 ] * multi )
293
+ client .send_message (location + "/mouthStretchLeft" , array [31 ] * multi )
294
+ client .send_message (location + "/mouthStretchRight" , array [32 ] * multi )
295
+ client .send_message (location + "/tongueOut" , array [33 ] * multi )
296
+ client .send_message (location + "/tongueUp" , array [34 ] * multi )
297
+ client .send_message (location + "/tongueDown" , array [35 ] * multi )
298
+ client .send_message (location + "/tongueLeft" , array [36 ] * multi )
299
+ client .send_message (location + "/tongueRight" , array [37 ] * multi )
300
+ client .send_message (location + "/tongueRoll" , array [38 ] * multi )
301
+ client .send_message (location + "/tongueBendDown" , array [39 ] * multi )
302
+ client .send_message (location + "/tongueCurlUp" , array [40 ] * multi )
303
+ client .send_message (location + "/tongueSquish" , array [41 ] * multi )
304
+ client .send_message (location + "/tongueFlat" , array [42 ] * multi )
305
+ client .send_message (location + "/tongueTwistLeft" , array [43 ] * multi )
306
+ client .send_message (location + "/tongueTwistRight" , array [44 ] * multi )
316
307
frame2 = cv2 .cvtColor (frame2 , cv2 .COLOR_BGR2GRAY )
317
308
imgbytes = cv2 .imencode ('.png' , frame2 )[1 ].tobytes () # ditto
318
309
window ['-IMAGE-' ].update (data = imgbytes )
0 commit comments