freealise commited on
Commit
f5e153d
1 Parent(s): c4a7493

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -193,11 +193,14 @@ def make_video(video_path, outdir='./vis_video_depth', encoder='vits', remove_bg
193
  n = 0 #n = count-int(cframes/2)
194
  depth_color_bg = cv2.imread(f"f{n}_dmap.png").astype(np.uint8)
195
  raw_frame_bg = cv2.imread(f"f{n}.png").astype(np.uint8)
196
- print(np.abs(depth_color.astype(np.int16)-depth_color_bg.astype(np.int16)))
197
- print(np.abs(raw_frame_bg.astype(np.int16)-raw_frame.astype(np.int16)))
198
 
199
- mask_bg = cv2.inRange(np.abs(depth_color.astype(np.int16)-depth_color_bg.astype(np.int16)), np.array([0,0,0]), np.array([32,32,32]))
200
- mask_no_shadow = cv2.inRange(np.abs(raw_frame_bg.astype(np.int16)-raw_frame.astype(np.int16)), np.array([0,0,0]), np.array([4,4,4]))
 
 
 
 
 
201
 
202
  depth_gray[cv2.bitwise_and(mask_no_shadow, mask_bg)>0] = 0
203
  depth_color[cv2.bitwise_and(mask_no_shadow, mask_bg)>0] = (0,0,0)
 
193
  n = 0 #n = count-int(cframes/2)
194
  depth_color_bg = cv2.imread(f"f{n}_dmap.png").astype(np.uint8)
195
  raw_frame_bg = cv2.imread(f"f{n}.png").astype(np.uint8)
 
 
196
 
197
+ diff_d = np.abs(depth_color.astype(np.int16)-depth_color_bg.astype(np.int16))
198
+ diff_c = np.abs(raw_frame.astype(np.int16)-raw_frame_bg.astype(np.int16))
199
+ print(diff_d)
200
+ print(diff_c)
201
+
202
+ mask_bg = cv2.inRange(diff_d, np.array([0,0,0]), np.array([16,16,16]))
203
+ mask_no_shadow = cv2.inRange(diff_c, np.array([0,0,0]), np.array([2,2,2]))
204
 
205
  depth_gray[cv2.bitwise_and(mask_no_shadow, mask_bg)>0] = 0
206
  depth_color[cv2.bitwise_and(mask_no_shadow, mask_bg)>0] = (0,0,0)