mirror of
https://github.com/Project-Babble/ProjectBabble.git
synced 2026-12-03 23:32:20 -08:00
Add New Shapes
tongue go brr
This commit is contained in:
1 parent
2baf74ff88
commit
a9eaaea7d7
2 files changed
+156
-118
No files matched your search
+69
-78
@@ -57,13 +57,16 @@ class Calibration(object):
|
||||
self.calib = json.load(user_file)
|
||||
self._last_update = os.fstat(user_file.fileno()).st_mtime
|
||||
self.jsonminmax = [
|
||||
[self.calib["cheekPuff"]["min"],self.calib["cheekPuff"]["max"]], # CheekPuff
|
||||
[self.calib["noseSneerLeft"]["min"],self.calib["noseSneerLeft"]["max"]], # noseSneerLeft
|
||||
[self.calib["noseSneerRight"]["min"],self.calib["noseSneerRight"]["max"]], # noseSneerRight
|
||||
[self.calib["cheekPuffLeft"]["min"],self.calib["cheekPuffLeft"]["max"]], # CheekPuff
|
||||
[self.calib["cheekPuffRight"]["min"],self.calib["cheekPuffRight"]["max"]], # CheekPuff
|
||||
[self.calib["cheekSuckLeft"]["min"],self.calib["cheekSuckLeft"]["max"]], # CheekPuff
|
||||
[self.calib["cheekSuckRight"]["min"],self.calib["cheekSuckRight"]["max"]], # CheekPuff
|
||||
[self.calib["jawOpen"]["min"],self.calib["jawOpen"]["max"]], # jawOpen
|
||||
[self.calib["jawForward"]["min"],self.calib["jawForward"]["max"]], # jawForward
|
||||
[self.calib["jawLeft"]["min"],self.calib["jawLeft"]["max"]], # jawLeft
|
||||
[self.calib["jawRight"]["min"],self.calib["jawRight"]["max"]], # jawRight
|
||||
[self.calib["noseSneerLeft"]["min"],self.calib["noseSneerLeft"]["max"]], # noseSneerLeft
|
||||
[self.calib["noseSneerRight"]["min"],self.calib["noseSneerRight"]["max"]], # noseSneerRight
|
||||
[self.calib["mouthFunnel"]["min"],self.calib["mouthFunnel"]["max"]], # mouthFunnel
|
||||
[self.calib["mouthPucker"]["min"],self.calib["mouthPucker"]["max"]], # mouthPucker
|
||||
[self.calib["mouthLeft"]["min"],self.calib["mouthLeft"]["max"]], # mouthLeft
|
||||
@@ -88,49 +91,20 @@ class Calibration(object):
|
||||
[self.calib["mouthStretchLeft"]["min"],self.calib["mouthStretchLeft"]["max"]], # mouthStretchLeft
|
||||
[self.calib["mouthStretchRight"]["min"],self.calib["mouthStretchRight"]["max"]], # mouthStretchRight
|
||||
[self.calib["tongueOut"]["min"],self.calib["tongueOut"]["max"]], # tongueOut
|
||||
[self.calib["tongueUp"]["min"],self.calib["tongueUp"]["max"]], # tongueOut
|
||||
[self.calib["tongueDown"]["min"],self.calib["tongueDown"]["max"]], # tongueOut
|
||||
[self.calib["tongueLeft"]["min"],self.calib["tongueLeft"]["max"]], # tongueOut
|
||||
[self.calib["tongueRight"]["min"],self.calib["tongueRight"]["max"]], # tongueOut
|
||||
[self.calib["tongueRoll"]["min"],self.calib["tongueRoll"]["max"]], # tongueOut
|
||||
[self.calib["tongueBendDown"]["min"],self.calib["tongueBendDown"]["max"]], # tongueOut
|
||||
[self.calib["tongueCurlUp"]["min"],self.calib["tongueCurlUp"]["max"]], # tongueOut
|
||||
[self.calib["tongueSquish"]["min"],self.calib["tongueSquish"]["max"]], # tongueOut
|
||||
[self.calib["tongueFlat"]["min"],self.calib["tongueFlat"]["max"]], # tongueOut
|
||||
[self.calib["tongueTwistLeft"]["min"],self.calib["tongueTwistLeft"]["max"]], # tongueOut
|
||||
[self.calib["tongueTwistRight"]["min"],self.calib["tongueTwistRight"]["max"]], # tongueOut
|
||||
]
|
||||
return self.jsonminmax
|
||||
|
||||
|
||||
def onesizefitsallminmaxarray(): # Some predefined ranges in stored values instead of the generated ones
|
||||
stored_values = [
|
||||
[0.2, 0.6], # CheekPuff
|
||||
[0, 1], # cheekSquintLeft
|
||||
[0, 1], # cheekSquintRight
|
||||
[0, 1], # noseSneerLeft
|
||||
[0, 1], # noseSneerRight
|
||||
[0.03, 0.6], # jawOpen
|
||||
[0.1, 0.8], # jawForward
|
||||
[0.05, 0.5], # jawLeft
|
||||
[0.05, 0.5], # jawRight
|
||||
[0.1, 0.6], # mouthFunnel
|
||||
[0.4, 1], # mouthPucker
|
||||
[0.05, 0.5], # mouthLeft
|
||||
[0.05, 0.5], # mouthRight
|
||||
[0, 0.5], # mouthRollUpper
|
||||
[0, 0.3], # mouthRollLower
|
||||
[0.03, 0.5], # mouthShrugUpper
|
||||
[0.03, 0.5], # mouthShrugLower
|
||||
[0, 0.5], # mouthClose
|
||||
[0.1, 1], # mouthSmileLeft
|
||||
[0.1, 1], # mouthSmileRight
|
||||
[0, 0.6], # mouthFrownLeft
|
||||
[0, 0.6], # mouthFrownRight
|
||||
[0, 1], # mouthDimpleLeft
|
||||
[0, 1], # mouthDimpleRight
|
||||
[0.02, 0.8], # mouthUpperUpLeft
|
||||
[0.02, 0.8], # mouthUpperUpRight
|
||||
[0.02, 0.8], # mouthLowerDownLeft
|
||||
[0.02, 0.8], # mouthLowerDownRight
|
||||
[0, 1], # mouthPressLeft
|
||||
[0, 1], # mouthPressRight
|
||||
[0.3, 1], # mouthStretchLeft
|
||||
[0.3, 1], # mouthStretchRight
|
||||
[0.2, 0.8], # tongueOut
|
||||
]
|
||||
return stored_values
|
||||
|
||||
|
||||
|
||||
def makeminmaxarray(amount):
|
||||
stored_values = []
|
||||
@@ -168,11 +142,11 @@ sg.theme('DarkAmber') # Add a touch of color
|
||||
layout = [
|
||||
[sg.Image(key = '-IMAGE-')],
|
||||
[sg.Text('Enter Webcam URL or Number (Defualts to 0)'), sg.Input(key = '-URL-', size = (30, 1))],
|
||||
[sg.Text('Enter Onnx model name (Defualts to EffnetB0300K.onnx)'), sg.Input(key = '-MODEL-', size = (30, 1))],
|
||||
[sg.Text('Enter Onnx model name (Defualts to EFV2300K45E57.onnx)'), sg.Input(key = '-MODEL-', size = (30, 1))],
|
||||
[sg.Text('OSC Location Address'), sg.Input(key = '-LOC-', size = (30, 1))],
|
||||
[sg.Text('Output Mutiplier (defualts to 1. Please use 100 if you are using the unity demo.)'), sg.Input(key = '-MULT-', size = (30, 1))],
|
||||
[sg.Text('Enter OSC IP (Defualts to 127.0.0.1)'), sg.Input(key = '-OSC-', size = (30, 1))],
|
||||
[sg.Text('Enter OSC Port (Defualts to 9000)'), sg.Input(key = '-PORT-', size = (30, 1))],
|
||||
[sg.Text('Enter OSC Port (Defualts to 8888)'), sg.Input(key = '-PORT-', size = (30, 1))],
|
||||
[sg.Text('Enter Calibration file name (Defaults to calib.json)'), sg.Input(key = '-JSON_FILE-', size = (30, 1))],
|
||||
[sg.Text('Press Ok to start the webcam')],
|
||||
[sg.Checkbox('Flip 180', key = '-FLIP180-')],
|
||||
@@ -199,7 +173,9 @@ while True:
|
||||
OSCip="127.0.0.1"
|
||||
OSCport= values['-PORT-'] #VR Chat OSC port
|
||||
if OSCport == '':
|
||||
OSCport = 9000
|
||||
OSCport = 8888
|
||||
else:
|
||||
OSCport = int(OSCport)
|
||||
multi = values['-MULT-']
|
||||
if multi == '':
|
||||
multi = 1
|
||||
@@ -208,7 +184,7 @@ while True:
|
||||
client = udp_client.SimpleUDPClient(OSCip, OSCport)
|
||||
model = values['-MODEL-']
|
||||
if model == '':
|
||||
model = 'EffnetB0300K.onnx'
|
||||
model = 'EFV2300K45E57.onnx'
|
||||
if calibjson == '':
|
||||
calibjson = 'calib.json'
|
||||
usegpu = values['-GPU-']
|
||||
@@ -254,6 +230,7 @@ while True:
|
||||
if flip90r:
|
||||
frame = cv2.rotate(frame, cv2.ROTATE_90_COUNTERCLOCKWISE)
|
||||
frame2 = frame
|
||||
#frame = cv2.flip(frame, 1)
|
||||
calibration.update_calib(calibjson) # Checks and updates values of the json file
|
||||
stored_values = calibration.jsonminmax
|
||||
frame = cv2.resize(frame, (256, 256))
|
||||
@@ -282,37 +259,51 @@ while True:
|
||||
array = output
|
||||
for i in range(len(output)): # Clip values between 0 - 1
|
||||
output[i] = max(min(output[i], 1), 0)
|
||||
client.send_message(location + "/cheekPuff", array[0] * multi)
|
||||
client.send_message(location + "/noseSneerLeft", output[5] * multi)
|
||||
client.send_message(location + "/noseSneerRight", output[6] * multi)
|
||||
client.send_message(location + "/jawOpen", array[1] * multi)
|
||||
client.send_message(location + "/jawForward", array[2] * multi)
|
||||
client.send_message(location + "/jawLeft", array[3] * multi)
|
||||
client.send_message(location + "/jawRight", array[4] * multi)
|
||||
client.send_message(location + "/mouthFunnel", array[7] * multi)
|
||||
client.send_message(location + "/mouthPucker", array[8] * multi)
|
||||
client.send_message(location + "/mouthLeft", array[9] * multi)
|
||||
client.send_message(location + "/mouthRight", array[10] * multi)
|
||||
client.send_message(location + "/mouthRollUpper", array[11] * multi)
|
||||
client.send_message(location + "/mouthRollLower", array[12] * multi)
|
||||
client.send_message(location + "/mouthShrugUpper", array[13] * multi)
|
||||
client.send_message(location + "/mouthShrugLower", array[14] * multi)
|
||||
client.send_message(location + "/mouthClose", output[15] * multi)
|
||||
client.send_message(location + "/mouthSmileLeft", array[16] * multi)
|
||||
client.send_message(location + "/mouthSmileRight", array[17] * multi)
|
||||
client.send_message(location + "/mouthFrownLeft", array[18] * multi)
|
||||
client.send_message(location + "/mouthFrownRight", array[19] * multi)
|
||||
client.send_message(location + "/mouthDimpleLeft", array[20] * multi)
|
||||
client.send_message(location + "/mouthDimpleRight", array[21] * multi)
|
||||
client.send_message(location + "/mouthUpperUpLeft", array[22] * multi)
|
||||
client.send_message(location + "/mouthUpperUpRight", array[23] * multi)
|
||||
client.send_message(location + "/mouthLowerDownLeft", array[24] * multi)
|
||||
client.send_message(location + "/mouthLowerDownRight", array[25] * multi)
|
||||
client.send_message(location + "/mouthPressLeft", array[26] * multi)
|
||||
client.send_message(location + "/mouthPressRight", array[27] * multi)
|
||||
client.send_message(location + "/mouthStretchLeft", array[28] * multi)
|
||||
client.send_message(location + "/mouthStretchRight", array[29] * multi)
|
||||
client.send_message(location + "/tongueOut", array[30] * multi)
|
||||
client.send_message(location + "/cheekPuffLeft", array[0] * multi)
|
||||
client.send_message(location + "/cheekPuffRight", array[1] * multi)
|
||||
client.send_message(location + "/cheekSuckLeft", array[2] * multi)
|
||||
client.send_message(location + "/cheekSuckRight", array[3] * multi)
|
||||
client.send_message(location + "/jawOpen", array[4] * multi)
|
||||
client.send_message(location + "/jawForward", array[5] * multi)
|
||||
client.send_message(location + "/jawLeft", array[6] * multi)
|
||||
client.send_message(location + "/jawRight", array[7] * multi)
|
||||
client.send_message(location + "/noseSneerLeft", array[8] * multi)
|
||||
client.send_message(location + "/noseSneerRight", array[9] * multi)
|
||||
client.send_message(location + "/mouthFunnel", array[10] * multi)
|
||||
client.send_message(location + "/mouthPucker", array[11] * multi)
|
||||
client.send_message(location + "/mouthLeft", array[12] * multi)
|
||||
client.send_message(location + "/mouthRight", array[13] * multi)
|
||||
client.send_message(location + "/mouthRollUpper", array[14] * multi)
|
||||
client.send_message(location + "/mouthRollLower", array[15] * multi)
|
||||
client.send_message(location + "/mouthShrugUpper", array[16] * multi)
|
||||
client.send_message(location + "/mouthShrugLower", array[17] * multi)
|
||||
client.send_message(location + "/mouthClose", output[18] * multi)
|
||||
client.send_message(location + "/mouthSmileLeft", array[19] * multi)
|
||||
client.send_message(location + "/mouthSmileRight", array[20] * multi)
|
||||
client.send_message(location + "/mouthFrownLeft", array[21] * multi)
|
||||
client.send_message(location + "/mouthFrownRight", array[22] * multi)
|
||||
client.send_message(location + "/mouthDimpleLeft", array[23] * multi)
|
||||
client.send_message(location + "/mouthDimpleRight", array[24] * multi)
|
||||
client.send_message(location + "/mouthUpperUpLeft", array[25] * multi)
|
||||
client.send_message(location + "/mouthUpperUpRight", array[26] * multi)
|
||||
client.send_message(location + "/mouthLowerDownLeft", array[27] * multi)
|
||||
client.send_message(location + "/mouthLowerDownRight", array[28] * multi)
|
||||
client.send_message(location + "/mouthPressLeft", array[29] * multi)
|
||||
client.send_message(location + "/mouthPressRight", array[30] * multi)
|
||||
client.send_message(location + "/mouthStretchLeft", array[31] * multi)
|
||||
client.send_message(location + "/mouthStretchRight", array[32] * multi)
|
||||
client.send_message(location + "/tongueOut", array[33] * multi)
|
||||
client.send_message(location + "/tongueUp", array[34] * multi)
|
||||
client.send_message(location + "/tongueDown", array[35] * multi)
|
||||
client.send_message(location + "/tongueLeft", array[36] * multi)
|
||||
client.send_message(location + "/tongueRight", array[37] * multi)
|
||||
client.send_message(location + "/tongueRoll", array[38] * multi)
|
||||
client.send_message(location + "/tongueBendDown", array[39] * multi)
|
||||
client.send_message(location + "/tongueCurlUp", array[40] * multi)
|
||||
client.send_message(location + "/tongueSquish", array[41] * multi)
|
||||
client.send_message(location + "/tongueFlat", array[42] * multi)
|
||||
client.send_message(location + "/tongueTwistLeft", array[43] * multi)
|
||||
client.send_message(location + "/tongueTwistRight", array[44] * multi)
|
||||
frame2 = cv2.cvtColor(frame2, cv2.COLOR_BGR2GRAY)
|
||||
imgbytes = cv2.imencode('.png', frame2)[1].tobytes() # ditto
|
||||
window['-IMAGE-'].update(data=imgbytes)
|
||||
|
||||
+87
-40
@@ -1,13 +1,33 @@
|
||||
{
|
||||
"cheekPuff": {
|
||||
"min": 0.0,
|
||||
"max": 0.5
|
||||
"cheekPuffLeft": {
|
||||
"min": 0.1,
|
||||
"max": 1.0
|
||||
},
|
||||
"cheekSquintLeft": {
|
||||
"cheekPuffRight": {
|
||||
"min": 0.1,
|
||||
"max": 1.0
|
||||
},
|
||||
"cheekSuckLeft": {
|
||||
"min": 0.1,
|
||||
"max": 1.0
|
||||
},
|
||||
"cheekSuckRight": {
|
||||
"min": 0.1,
|
||||
"max": 1.0
|
||||
},
|
||||
"jawOpen": {
|
||||
"min": 0.0,
|
||||
"max": 1.0
|
||||
},
|
||||
"jawForward": {
|
||||
"min": 0.0,
|
||||
"max": 1.0
|
||||
},
|
||||
"cheekSquintRight": {
|
||||
"jawLeft": {
|
||||
"min": 0.0,
|
||||
"max": 1.0
|
||||
},
|
||||
"jawRight": {
|
||||
"min": 0.0,
|
||||
"max": 1.0
|
||||
},
|
||||
@@ -19,57 +39,41 @@
|
||||
"min": 0.0,
|
||||
"max": 1.0
|
||||
},
|
||||
"jawOpen": {
|
||||
"min": 0.0,
|
||||
"max": 0.7
|
||||
},
|
||||
"jawForward": {
|
||||
"min": 0.1,
|
||||
"max": 0.8
|
||||
},
|
||||
"jawLeft": {
|
||||
"min": 0.0,
|
||||
"max": 0.5
|
||||
},
|
||||
"jawRight": {
|
||||
"min": 0.0,
|
||||
"max": 0.5
|
||||
},
|
||||
"mouthFunnel": {
|
||||
"min": 0.05,
|
||||
"max": 0.8
|
||||
"max": 1.0
|
||||
},
|
||||
"mouthPucker": {
|
||||
"min": 0.0,
|
||||
"max": 0.8
|
||||
"max": 1.0
|
||||
},
|
||||
"mouthLeft": {
|
||||
"min": 0.05,
|
||||
"max": 0.7
|
||||
"max": 1.0
|
||||
},
|
||||
"mouthRight": {
|
||||
"min": 0.05,
|
||||
"max": 0.7
|
||||
"max": 1.0
|
||||
},
|
||||
"mouthRollUpper": {
|
||||
"min": 0.0,
|
||||
"max": 0.7
|
||||
"max": 1.0
|
||||
},
|
||||
"mouthRollLower": {
|
||||
"min": 0.0,
|
||||
"max": 0.7
|
||||
"max": 1.0
|
||||
},
|
||||
"mouthShrugUpper": {
|
||||
"min": 0.03,
|
||||
"max": 0.6
|
||||
"min": 0.0,
|
||||
"max": 1.0
|
||||
},
|
||||
"mouthShrugLower": {
|
||||
"min": 0.03,
|
||||
"max": 0.6
|
||||
"min": 0.0,
|
||||
"max": 1.0
|
||||
},
|
||||
"mouthClose": {
|
||||
"min": 0.2,
|
||||
"max": 0.7
|
||||
"min": 0.0,
|
||||
"max": 1.0
|
||||
},
|
||||
"mouthSmileLeft": {
|
||||
"min": 0.0,
|
||||
@@ -81,11 +85,11 @@
|
||||
},
|
||||
"mouthFrownLeft": {
|
||||
"min": 0.0,
|
||||
"max": 0.7
|
||||
"max": 1.0
|
||||
},
|
||||
"mouthFrownRight": {
|
||||
"min": 0.0,
|
||||
"max": 0.7
|
||||
"max": 1.0
|
||||
},
|
||||
"mouthDimpleLeft": {
|
||||
"min": 0.0,
|
||||
@@ -120,16 +124,59 @@
|
||||
"max": 1.0
|
||||
},
|
||||
"mouthStretchLeft": {
|
||||
"min": 0.3,
|
||||
"min": 0.05,
|
||||
"max": 1.0
|
||||
},
|
||||
"mouthStretchRight": {
|
||||
"min": 0.3,
|
||||
"min": 0.05,
|
||||
"max": 1.0
|
||||
},
|
||||
"tongueOut": {
|
||||
"min": 0.2,
|
||||
"max": 0.8
|
||||
"min": 0.05,
|
||||
"max": 1.0
|
||||
},
|
||||
"tongueUp": {
|
||||
"min": 0.05,
|
||||
"max": 1.0
|
||||
},
|
||||
"tongueDown": {
|
||||
"min": 0.05,
|
||||
"max": 1.0
|
||||
},
|
||||
"tongueLeft": {
|
||||
"min": 0.05,
|
||||
"max": 1.0
|
||||
},
|
||||
"tongueRight": {
|
||||
"min": 0.05,
|
||||
"max": 1.0
|
||||
},
|
||||
"tongueRoll": {
|
||||
"min": 0.05,
|
||||
"max": 1.0
|
||||
},
|
||||
"tongueBendDown": {
|
||||
"min": 0.05,
|
||||
"max": 1.0
|
||||
},
|
||||
"tongueCurlUp": {
|
||||
"min": 0.05,
|
||||
"max": 1.0
|
||||
},
|
||||
"tongueSquish": {
|
||||
"min": 0.05,
|
||||
"max": 1.0
|
||||
},
|
||||
"tongueFlat": {
|
||||
"min": 0.05,
|
||||
"max": 1.0
|
||||
},
|
||||
"tongueTwistLeft": {
|
||||
"min": 0.05,
|
||||
"max": 1.0
|
||||
},
|
||||
"tongueTwistRight": {
|
||||
"min": 0.05,
|
||||
"max": 1.0
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user