Easy - Head Visualization
At this stage, it is assumed that you have completed the 3D Face Reconstruction and 3D Hair Reconstruction piplines and obtained uv.png , head_config.json and head.glb files.
token="ENTER_YOUR_TOKEN"
curl -X 'POST' 'https://api.metahumansdk.io/glb_const/assemble' \
-H 'accept: application/json' \
-H 'Content-Type: multipart/form-data' \
-F "token=$token" \
-F '[email protected];type=image/png' \
-F 'head_config=@head_config.json;type=application/json' \
-F '[email protected];type=image/png' \
-F 'add_facs=true' > head.glbimport io
import json
import requests
token = "ENTER_YOUR_TOKEN"
if __name__ == "__main__":
service_url = "https://api.metahumansdk.io/glb_const"
service_headers = {'accept': 'application/json'}
with open('uv.png', 'rb') as out:
head_uv = out.read()
with open('head_config.json', 'r') as out:
head_config = json.loads(out.read())
with open('hair.glb', 'rb') as out:
custom_hair = out.read()
files = {
'token': (None, token),
'head_uv': ('head_model', head_uv, 'image/png'),
'head_config': ('head_config', json.dumps(head_config), 'application/json'),
'custom_models': ('custom_models', io.BytesIO(custom_hair), 'application/json'),
'add_facs': (None, True),
}
response = requests.post(service_url + "/assemble", headers=service_headers, files=files)
assert (response.status_code == 200)
with open("head.glb", "wb") as f:
f.write(response.content)
After completing all stages, you will get a GLB model head.glb .
Last updated