Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -212,7 +212,7 @@ def pano_depth_to_world_points(depth, scale):
|
|
212 |
|
213 |
pts3d = np.stack([x_, y_, z_, _x, _y, _z], axis=1)
|
214 |
uv = np.stack([lon, lat], axis=1)
|
215 |
-
lines = np.arange(0, depth.shape[0]*depth.shape[1]
|
216 |
|
217 |
return [pts3d, uv, lines]
|
218 |
|
@@ -235,13 +235,13 @@ def get_mesh(image, depth, scale):
|
|
235 |
verts = pts3d.reshape(-1, 3)
|
236 |
#triangles = create_triangles(image.shape[0], image.shape[1])
|
237 |
#print('triangles - ok')
|
238 |
-
segments = trimesh.path.entities.Line(lines
|
239 |
rgba = cv2.cvtColor(image, cv2.COLOR_RGB2RGBA)
|
240 |
colors = rgba.reshape(-1, 4)
|
241 |
print(segments[0])
|
242 |
print(colors[0])
|
243 |
#mesh = trimesh.Trimesh(vertices=verts, faces=triangles, vertex_colors=colors)
|
244 |
-
mesh = trimesh.path.path.Path3D(vertices=verts, entities=segments, colors=colors)
|
245 |
#mesh = trimesh.PointCloud(verts, colors=colors)
|
246 |
#material = trimesh.visual.texture.SimpleMaterial(image=image)
|
247 |
#texture = trimesh.visual.TextureVisuals(uv=uv, image=image, material=material)
|
|
|
212 |
|
213 |
pts3d = np.stack([x_, y_, z_, _x, _y, _z], axis=1)
|
214 |
uv = np.stack([lon, lat], axis=1)
|
215 |
+
lines = np.arange(0, depth.shape[0]*depth.shape[1], 1)
|
216 |
|
217 |
return [pts3d, uv, lines]
|
218 |
|
|
|
235 |
verts = pts3d.reshape(-1, 3)
|
236 |
#triangles = create_triangles(image.shape[0], image.shape[1])
|
237 |
#print('triangles - ok')
|
238 |
+
segments = trimesh.path.entities.Line(lines).explode()
|
239 |
rgba = cv2.cvtColor(image, cv2.COLOR_RGB2RGBA)
|
240 |
colors = rgba.reshape(-1, 4)
|
241 |
print(segments[0])
|
242 |
print(colors[0])
|
243 |
#mesh = trimesh.Trimesh(vertices=verts, faces=triangles, vertex_colors=colors)
|
244 |
+
mesh = trimesh.path.path.Path3D(vertices=verts, entities=[segments], colors=[colors])
|
245 |
#mesh = trimesh.PointCloud(verts, colors=colors)
|
246 |
#material = trimesh.visual.texture.SimpleMaterial(image=image)
|
247 |
#texture = trimesh.visual.TextureVisuals(uv=uv, image=image, material=material)
|