Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -6,7 +6,10 @@ import io
|
|
6 |
|
7 |
def modify_texture():
|
8 |
# Load the GLB file
|
9 |
-
mesh = trimesh.load_mesh("train.glb"
|
|
|
|
|
|
|
10 |
|
11 |
# Open the texture image
|
12 |
im = Image.open("defect.jpg")
|
@@ -15,7 +18,7 @@ def modify_texture():
|
|
15 |
material = trimesh.visual.texture.SimpleMaterial(image=im)
|
16 |
|
17 |
# Get the uv coordinates from the mesh
|
18 |
-
uv =
|
19 |
|
20 |
# Create TextureVisuals with the uv coordinates and the texture image
|
21 |
color_visuals = trimesh.visual.TextureVisuals(uv=uv, image=im, material=material)
|
|
|
6 |
|
7 |
def modify_texture():
|
8 |
# Load the GLB file
|
9 |
+
mesh = trimesh.load_mesh("train.glb")
|
10 |
+
geometries = list(scene.geometry.values())
|
11 |
+
geometry = geometries[0]
|
12 |
+
adjacency_matrix = geometry.edges_sparse
|
13 |
|
14 |
# Open the texture image
|
15 |
im = Image.open("defect.jpg")
|
|
|
18 |
material = trimesh.visual.texture.SimpleMaterial(image=im)
|
19 |
|
20 |
# Get the uv coordinates from the mesh
|
21 |
+
uv = adjacency_matrix.visual.uv
|
22 |
|
23 |
# Create TextureVisuals with the uv coordinates and the texture image
|
24 |
color_visuals = trimesh.visual.TextureVisuals(uv=uv, image=im, material=material)
|