Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -196,8 +196,8 @@ def pano_depth_to_world_points(depth, scale):
|
|
196 |
lon, lat = np.meshgrid(lon, lat)
|
197 |
|
198 |
i = 0
|
199 |
-
pts3d = [
|
200 |
-
uv = [
|
201 |
while i < 9:
|
202 |
d_lon = (np.random.rand(depth.shape[0]*depth.shape[1]) - 0.5) * np.pi*2 / depth.shape[1]
|
203 |
d_lat = (np.random.rand(depth.shape[0]*depth.shape[1]) - 0.5) * np.pi / depth.shape[0]
|
@@ -209,8 +209,11 @@ def pano_depth_to_world_points(depth, scale):
|
|
209 |
y = radius * np.cos(lat)
|
210 |
z = radius * np.sin(lon) * np.sin(lat)
|
211 |
|
212 |
-
|
213 |
-
|
|
|
|
|
|
|
214 |
i = i+1
|
215 |
|
216 |
return [pts3d, uv]
|
@@ -235,8 +238,11 @@ def get_mesh(image, depth, scale):
|
|
235 |
#print('triangles - ok')
|
236 |
rgba = cv2.cvtColor(image, cv2.COLOR_RGB2RGBA)
|
237 |
colors = rgba.reshape(-1, 4)
|
238 |
-
|
239 |
-
|
|
|
|
|
|
|
240 |
#mesh = trimesh.Trimesh(vertices=verts, faces=triangles, vertex_colors=colors)
|
241 |
mesh = trimesh.PointCloud(verts, colors=clrs)
|
242 |
#material = trimesh.visual.texture.SimpleMaterial(image=image)
|
|
|
196 |
lon, lat = np.meshgrid(lon, lat)
|
197 |
|
198 |
i = 0
|
199 |
+
pts3d = []
|
200 |
+
uv = []
|
201 |
while i < 9:
|
202 |
d_lon = (np.random.rand(depth.shape[0]*depth.shape[1]) - 0.5) * np.pi*2 / depth.shape[1]
|
203 |
d_lat = (np.random.rand(depth.shape[0]*depth.shape[1]) - 0.5) * np.pi / depth.shape[0]
|
|
|
209 |
y = radius * np.cos(lat)
|
210 |
z = radius * np.sin(lon) * np.sin(lat)
|
211 |
|
212 |
+
pts = np.stack([x, y, z], axis=1)
|
213 |
+
uvs = np.stack([lon, lat], axis=1)
|
214 |
+
|
215 |
+
pts3d = np.concatenate((pts3d, pts), axis=0)
|
216 |
+
uv = np.concatenate((uv, uvs), axis=0)
|
217 |
i = i+1
|
218 |
|
219 |
return [pts3d, uv]
|
|
|
238 |
#print('triangles - ok')
|
239 |
rgba = cv2.cvtColor(image, cv2.COLOR_RGB2RGBA)
|
240 |
colors = rgba.reshape(-1, 4)
|
241 |
+
clrs = []
|
242 |
+
i = 0
|
243 |
+
while i < 9:
|
244 |
+
clrs = np.concatenate((clrs, colors), axis=0)
|
245 |
+
i = i+1
|
246 |
#mesh = trimesh.Trimesh(vertices=verts, faces=triangles, vertex_colors=colors)
|
247 |
mesh = trimesh.PointCloud(verts, colors=clrs)
|
248 |
#material = trimesh.visual.texture.SimpleMaterial(image=image)
|