freealise commited on
Commit
328e50b
1 Parent(s): ce8da40

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -12
app.py CHANGED
@@ -149,17 +149,20 @@ def make_video(video_path, outdir='./vis_video_depth', encoder='vits'):
149
  depth = depth.cpu().numpy().astype(np.uint8)
150
  depth_color = cv2.applyColorMap(depth, cv2.COLORMAP_BONE)
151
  depth_gray = cv2.cvtColor(depth_color, cv2.COLOR_RGBA2GRAY)
152
- depth_color = cv2.cvtColor(depth_gray, cv2.COLOR_GRAY2BGR)
153
 
154
  # Remove white border around map:
155
  # define lower and upper limits of white
156
- white_lo = np.array([250,250,250])
157
- white_hi = np.array([255,255,255])
158
  # mask image to only select white
159
- mask = cv2.inRange(depth_color, white_lo, white_hi)
160
  # change image to black where we found white
161
- depth_color[mask>0] = (0,0,0)
162
-
 
 
 
 
163
  # split_region = np.ones((frame_height, margin_width, 3), dtype=np.uint8) * 255
164
  # combined_frame = cv2.hconcat([raw_frame, split_region, depth_color])
165
 
@@ -225,12 +228,6 @@ def pano_depth_to_world_points(depth):
225
  latitude : -pi/2 to pi/2
226
  """
227
 
228
- depth[depth.shape[0]-1:depth.shape[0], 0:depth.shape[1]] = 255
229
- mask = cv2.inRange(depth, 192, 255)
230
- depth[mask>0] = 255
231
- mask = cv2.inRange(depth[int(depth.shape[0]/8*6.5):depth.shape[0]-1, 0:depth.shape[1]], 160, 254)
232
- depth[int(depth.shape[0]/8*6.5):depth.shape[0]-1, 0:depth.shape[1]][mask>0] = 160
233
-
234
  # Convert depth to radius
235
  radius = (255 - depth.flatten())
236
 
 
149
  depth = depth.cpu().numpy().astype(np.uint8)
150
  depth_color = cv2.applyColorMap(depth, cv2.COLORMAP_BONE)
151
  depth_gray = cv2.cvtColor(depth_color, cv2.COLOR_RGBA2GRAY)
 
152
 
153
  # Remove white border around map:
154
  # define lower and upper limits of white
155
+ #white_lo = np.array([250,250,250])
156
+ #white_hi = np.array([255,255,255])
157
  # mask image to only select white
158
+ mask = cv2.inRange(depth_gray, 250, 255)
159
  # change image to black where we found white
160
+ depth_gray[mask>0] = 0
161
+
162
+ mask = cv2.inRange(depth_gray[int(depth_gray.shape[0]/8*6.5):depth_gray.shape[0]-1, 0:depth_gray.shape[1]], 160, 255)
163
+ depth_gray[int(depth_gray.shape[0]/8*6.5):depth_gray.shape[0]-1, 0:depth_gray.shape[1]][mask>0] = 160
164
+
165
+ depth_color = cv2.cvtColor(depth_gray, cv2.COLOR_GRAY2BGR)
166
  # split_region = np.ones((frame_height, margin_width, 3), dtype=np.uint8) * 255
167
  # combined_frame = cv2.hconcat([raw_frame, split_region, depth_color])
168
 
 
228
  latitude : -pi/2 to pi/2
229
  """
230
 
 
 
 
 
 
 
231
  # Convert depth to radius
232
  radius = (255 - depth.flatten())
233