Rahatara commited on
Commit
80a7dd4
·
verified ·
1 Parent(s): cb15d28

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
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", force = 'mesh')
 
 
 
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 = mesh.visual.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)