-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample2.py
More file actions
25 lines (18 loc) · 1.07 KB
/
Copy pathexample2.py
File metadata and controls
25 lines (18 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from unitycommunicator import UnityCommunicator
from PIL import Image
# Specify location of unity executable build
unity_build_path = 'UCGeometrics/Builds/UCGeometricsBuild.app'
#initialize UC class
UC = UnityCommunicator(unity_build_path, use_with_unity_build=True)
#Render the data
json_data = UC.read_json_file('ParameterFiles/parameters_geometrics0.json')
scene_img, meta_data_dict = UC.render_parameters(json_data)
Image.fromarray(scene_img).save('SavedScenes/Rendered_Scene_ID-{:3}.png'.format(str(meta_data_dict['sceneID']).zfill(3)))
json_data = UC.read_json_file('ParameterFiles/parameters_geometrics1.json')
scene_img, meta_data_dict = UC.render_parameters(json_data)
Image.fromarray(scene_img).save('SavedScenes/Rendered_Scene_ID-{:3}.png'.format(str(meta_data_dict['sceneID']).zfill(3)))
json_data = UC.read_json_file('ParameterFiles/parameters_geometrics2.json')
scene_img, meta_data_dict = UC.render_parameters(json_data)
Image.fromarray(scene_img).save('SavedScenes/Rendered_Scene_ID-{:3}.png'.format(str(meta_data_dict['sceneID']).zfill(3)))
#Close connection
UC.close()