Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -201,12 +201,12 @@ def pano_depth_to_world_points(depth, scale):
|
|
201 |
|
202 |
pts3d = [[0,0,0]]
|
203 |
uv = [[0,0]]
|
204 |
-
|
205 |
-
|
206 |
#rnd_lon = (np.random.rand(depth.shape[0]*depth.shape[1]) - 0.5) / 8
|
207 |
#rnd_lat = (np.random.rand(depth.shape[0]*depth.shape[1]) - 0.5) / 8
|
208 |
-
d_lon = lon
|
209 |
-
d_lat = lat
|
210 |
|
211 |
# Convert to cartesian coordinates
|
212 |
x = radius * np.cos(d_lon) * np.sin(d_lat)
|
@@ -219,8 +219,8 @@ def pano_depth_to_world_points(depth, scale):
|
|
219 |
pts3d = np.concatenate((pts3d, pts), axis=0)
|
220 |
uv = np.concatenate((uv, uvs), axis=0)
|
221 |
#print(f'i: {i}, j: {j}')
|
222 |
-
|
223 |
-
|
224 |
|
225 |
return [pts3d, uv]
|
226 |
|
@@ -247,9 +247,9 @@ def get_mesh(image, depth):
|
|
247 |
colors = rgba.reshape(-1, 4)
|
248 |
clrs = [[128, 128, 128, 0]]
|
249 |
|
250 |
-
|
251 |
clrs = np.concatenate((clrs, colors), axis=0)
|
252 |
-
|
253 |
|
254 |
#mesh = trimesh.Trimesh(vertices=verts, faces=triangles, vertex_colors=colors)
|
255 |
mesh = trimesh.PointCloud(verts, colors=clrs)
|
|
|
201 |
|
202 |
pts3d = [[0,0,0]]
|
203 |
uv = [[0,0]]
|
204 |
+
for i in range(0, 1): #(0,2)
|
205 |
+
for j in range(0, 1): #(0,2)
|
206 |
#rnd_lon = (np.random.rand(depth.shape[0]*depth.shape[1]) - 0.5) / 8
|
207 |
#rnd_lat = (np.random.rand(depth.shape[0]*depth.shape[1]) - 0.5) / 8
|
208 |
+
d_lon = lon + i/2 * np.pi*2 / depth.shape[1]
|
209 |
+
d_lat = lat + j/2 * np.pi / depth.shape[0]
|
210 |
|
211 |
# Convert to cartesian coordinates
|
212 |
x = radius * np.cos(d_lon) * np.sin(d_lat)
|
|
|
219 |
pts3d = np.concatenate((pts3d, pts), axis=0)
|
220 |
uv = np.concatenate((uv, uvs), axis=0)
|
221 |
#print(f'i: {i}, j: {j}')
|
222 |
+
j = j+1
|
223 |
+
i = i+1
|
224 |
|
225 |
return [pts3d, uv]
|
226 |
|
|
|
247 |
colors = rgba.reshape(-1, 4)
|
248 |
clrs = [[128, 128, 128, 0]]
|
249 |
|
250 |
+
for i in range(0,1): #(0,4)
|
251 |
clrs = np.concatenate((clrs, colors), axis=0)
|
252 |
+
i = i+1
|
253 |
|
254 |
#mesh = trimesh.Trimesh(vertices=verts, faces=triangles, vertex_colors=colors)
|
255 |
mesh = trimesh.PointCloud(verts, colors=clrs)
|