Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -170,7 +170,7 @@ def make_video(video_path, outdir='./vis_video_depth', encoder='vits'):
|
|
170 |
|
171 |
cv2.imwrite(f"f{count}_dmap.png", depth_color)
|
172 |
depth_frames.append(f"f{count}_dmap.png")
|
173 |
-
masks.append(
|
174 |
count += 1
|
175 |
|
176 |
final_vid = create_video(depth_frames, frame_rate, "depth")
|
@@ -401,12 +401,12 @@ def apply_mask(d, b):
|
|
401 |
dilation = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (2 * b + 1, 2 * b + 1), (b, b))
|
402 |
mask = cv2.dilate(mask, dilation)
|
403 |
d["background"][mask==255] = (255,255,255,255)
|
|
|
404 |
|
405 |
for k, mk in enumerate(masks):
|
406 |
if k != frame_selected:
|
407 |
-
|
408 |
-
|
409 |
-
masks[k] = m
|
410 |
|
411 |
masks[frame_selected] = d["background"]
|
412 |
cv2.imwrite(f"f{frame_selected}_dmap.png", masks[frame_selected])
|
|
|
170 |
|
171 |
cv2.imwrite(f"f{count}_dmap.png", depth_color)
|
172 |
depth_frames.append(f"f{count}_dmap.png")
|
173 |
+
masks.append(f"f{count}_dmap.png")
|
174 |
count += 1
|
175 |
|
176 |
final_vid = create_video(depth_frames, frame_rate, "depth")
|
|
|
401 |
dilation = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (2 * b + 1, 2 * b + 1), (b, b))
|
402 |
mask = cv2.dilate(mask, dilation)
|
403 |
d["background"][mask==255] = (255,255,255,255)
|
404 |
+
mask = cv2.cvtColor(d["background"], cv2.COLOR_RGBA2GRAY)
|
405 |
|
406 |
for k, mk in enumerate(masks):
|
407 |
if k != frame_selected:
|
408 |
+
masks[k] = cv2.imread(depths[k])
|
409 |
+
masks[k][mask!=255] = (255,255,255)
|
|
|
410 |
|
411 |
masks[frame_selected] = d["background"]
|
412 |
cv2.imwrite(f"f{frame_selected}_dmap.png", masks[frame_selected])
|