APose and local

This commit is contained in:
Arkadiy Strelnikov
2021-12-03 19:17:49 +07:00
parent f653da2092
commit f5812f28bd
7 changed files with 730 additions and 362 deletions

View File

@@ -27,6 +27,8 @@ output_method = data_yaml["output_method"]
crop = data_yaml["crop_image"]
mirror_image = data_yaml["mirror_image"]
show_image = data_yaml["show_image"]
apose = data_yaml["apose"]
world = data_yaml["world"]
# OSC client
client = udp_client.SimpleUDPClient(osc_address, osc_port)
@@ -73,13 +75,25 @@ while True:
# Output
if output_method == 'file':
# JSON
res = mp_cl.getJSON()
res = mp_cl.getJSON(apose=apose, world=world)
with open('hierarchy_data.json', 'w', encoding='utf-8') as f:
json.dump(res, f, ensure_ascii=False, indent=4)
else:
# OSC
res = mp_cl.getJSON()
client.send_message(osc_message_address, res)
res = mp_cl.getJSON(apose=apose, world=world)
res_list = []
for val in res.keys():
stroka = str(val)
for val2 in res[val]:
if val2 == 'visible':
stroka += " " + str(val2) + " " + str(res[val][val2])
# res_list.append(str(val) + " " + str(val2) + " " + str(res[val][val2]))
else:
for val3 in res[val][val2]:
stroka += " " + str(val2) + "_" + str(val3) + " " + str(res[val][val2][val3])
# res_list.append(str(val) + " " + str(val2) + " " + str(val3) + " " + str(res[val][val2][val3]))
res_list.append(stroka)
client.send_message(osc_message_address, res_list)
# Interface
key = cv2.waitKey(1)