Spaces:
Starting
Starting
Update app.py
Browse files
app.py
CHANGED
@@ -29,6 +29,7 @@ depths = []
|
|
29 |
masks = []
|
30 |
locations = []
|
31 |
mesh = []
|
|
|
32 |
|
33 |
def zip_files(files_in, files_out):
|
34 |
with ZipFile("depth_result.zip", "w") as zipObj:
|
@@ -266,6 +267,7 @@ def rgb2gray(rgb):
|
|
266 |
def get_mesh(image, depth, blur_data, loadall):
|
267 |
global locations
|
268 |
global mesh
|
|
|
269 |
if loadall == False:
|
270 |
mesh = []
|
271 |
fnum = frame_selected
|
@@ -304,13 +306,13 @@ def get_mesh(image, depth, blur_data, loadall):
|
|
304 |
#texture = trimesh.visual.TextureVisuals(uv=uv, image=image, material=material)
|
305 |
#mesh.visual = texture
|
306 |
|
307 |
-
|
308 |
print('mesh - ok')
|
309 |
|
310 |
# Save as glb
|
311 |
glb_file = tempfile.NamedTemporaryFile(suffix='.glb', delete=False)
|
312 |
glb_path = glb_file.name
|
313 |
-
|
314 |
print('file - ok')
|
315 |
return glb_path
|
316 |
|
|
|
29 |
masks = []
|
30 |
locations = []
|
31 |
mesh = []
|
32 |
+
scene = None
|
33 |
|
34 |
def zip_files(files_in, files_out):
|
35 |
with ZipFile("depth_result.zip", "w") as zipObj:
|
|
|
267 |
def get_mesh(image, depth, blur_data, loadall):
|
268 |
global locations
|
269 |
global mesh
|
270 |
+
global scene
|
271 |
if loadall == False:
|
272 |
mesh = []
|
273 |
fnum = frame_selected
|
|
|
306 |
#texture = trimesh.visual.TextureVisuals(uv=uv, image=image, material=material)
|
307 |
#mesh.visual = texture
|
308 |
|
309 |
+
scene = trimesh.Scene(mesh)
|
310 |
print('mesh - ok')
|
311 |
|
312 |
# Save as glb
|
313 |
glb_file = tempfile.NamedTemporaryFile(suffix='.glb', delete=False)
|
314 |
glb_path = glb_file.name
|
315 |
+
scene.export(glb_path)
|
316 |
print('file - ok')
|
317 |
return glb_path
|
318 |
|