freealise commited on
Commit
394988b
1 Parent(s): c74f275

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -21
app.py CHANGED
@@ -200,26 +200,26 @@ def pano_depth_to_world_points(depth, scale):
200
  pts3d = [[0,0,0]]
201
  uv = [[0,0]]
202
  while i < 2:
203
- while j < 2:
204
- rnd_lon = 0 #(np.random.rand(depth.shape[0]*depth.shape[1]) - 0.5) / 8
205
- rnd_lat = 0 #(np.random.rand(depth.shape[0]*depth.shape[1]) - 0.5) / 8
206
- d_lon = (i/2 + rnd_lon) * np.pi*2 / depth.shape[1]
207
- d_lat = (j/2 + rnd_lat) * np.pi / depth.shape[0]
208
- lon = lon.flatten() + d_lon
209
- lat = lat.flatten() + d_lat
210
-
211
- # Convert to cartesian coordinates
212
- x = radius * np.cos(lon) * np.sin(lat)
213
- y = radius * np.cos(lat)
214
- z = radius * np.sin(lon) * np.sin(lat)
215
-
216
- pts = np.stack([x, y, z], axis=1)
217
- uvs = np.stack([lon, lat], axis=1)
218
-
219
- pts3d = np.concatenate((pts3d, pts), axis=0)
220
- uv = np.concatenate((uv, uvs), axis=0)
221
- j = j+1
222
- i = i+1
223
 
224
  return [pts3d, uv]
225
 
@@ -243,7 +243,7 @@ def get_mesh(image, depth, scale):
243
  #print('triangles - ok')
244
  rgba = cv2.cvtColor(image, cv2.COLOR_RGB2RGBA)
245
  colors = rgba.reshape(-1, 4)
246
- clrs = [[0,0,0,0]]
247
  i = 0
248
  while i < 4:
249
  clrs = np.concatenate((clrs, colors), axis=0)
 
200
  pts3d = [[0,0,0]]
201
  uv = [[0,0]]
202
  while i < 2:
203
+ while j < 2:
204
+ rnd_lon = 0 #(np.random.rand(depth.shape[0]*depth.shape[1]) - 0.5) / 8
205
+ rnd_lat = 0 #(np.random.rand(depth.shape[0]*depth.shape[1]) - 0.5) / 8
206
+ d_lon = (i/2 + rnd_lon) * np.pi*2 / depth.shape[1]
207
+ d_lat = (j/2 + rnd_lat) * np.pi / depth.shape[0]
208
+ lon = lon.flatten() + d_lon
209
+ lat = lat.flatten() + d_lat
210
+
211
+ # Convert to cartesian coordinates
212
+ x = radius * np.cos(lon) * np.sin(lat)
213
+ y = radius * np.cos(lat)
214
+ z = radius * np.sin(lon) * np.sin(lat)
215
+
216
+ pts = np.stack([x, y, z], axis=1)
217
+ uvs = np.stack([lon, lat], axis=1)
218
+
219
+ pts3d = np.concatenate((pts3d, pts), axis=0)
220
+ uv = np.concatenate((uv, uvs), axis=0)
221
+ j = j+1
222
+ i = i+1
223
 
224
  return [pts3d, uv]
225
 
 
243
  #print('triangles - ok')
244
  rgba = cv2.cvtColor(image, cv2.COLOR_RGB2RGBA)
245
  colors = rgba.reshape(-1, 4)
246
+ clrs = [[0.5, 0.5, 0.5, 0.0]]
247
  i = 0
248
  while i < 4:
249
  clrs = np.concatenate((clrs, colors), axis=0)