Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -180,14 +180,14 @@ def make_video(video_path, outdir='./vis_video_depth', encoder='vits'):
|
|
180 |
depths = depth_frames
|
181 |
|
182 |
if depth_color.shape[0] == 4096:
|
183 |
-
masks[len(masks)-1] =
|
184 |
-
depth_frames[len(masks)-1] =
|
185 |
elif depth_color.shape[0] == 2048:
|
186 |
-
masks[len(masks)-1] =
|
187 |
-
depth_frames[len(masks)-1] =
|
188 |
else:
|
189 |
-
masks[len(masks)-1] =
|
190 |
-
depth_frames[len(masks)-1] =
|
191 |
|
192 |
return final_vid, final_zip, frames, masks[frame_selected] #output_path
|
193 |
|
@@ -354,7 +354,7 @@ def draw_mask(th, v, d, evt: gr.EventData):
|
|
354 |
pts = pts.reshape((-1,1,2))
|
355 |
|
356 |
bg = cv2.cvtColor(d["background"], cv2.COLOR_RGB2GRAY)
|
357 |
-
gd = ((cv2.cvtColor(masks[len(masks)-1], cv2.COLOR_RGB2GRAY)-th)*2)
|
358 |
diff = abs(bg-gd).astype(np.uint8)
|
359 |
mask = cv2.inRange(diff, 0, 5)
|
360 |
d["background"][mask>0] = (0,0,0,255)
|
|
|
180 |
depths = depth_frames
|
181 |
|
182 |
if depth_color.shape[0] == 4096:
|
183 |
+
masks[len(masks)-1] = './gradient_large.png'
|
184 |
+
depth_frames[len(masks)-1] = './gradient_large.png'
|
185 |
elif depth_color.shape[0] == 2048:
|
186 |
+
masks[len(masks)-1] = './gradient.png'
|
187 |
+
depth_frames[len(masks)-1] = './gradient.png'
|
188 |
else:
|
189 |
+
masks[len(masks)-1] = './gradient_small.png'
|
190 |
+
depth_frames[len(masks)-1] = './gradient_small.png'
|
191 |
|
192 |
return final_vid, final_zip, frames, masks[frame_selected] #output_path
|
193 |
|
|
|
354 |
pts = pts.reshape((-1,1,2))
|
355 |
|
356 |
bg = cv2.cvtColor(d["background"], cv2.COLOR_RGB2GRAY)
|
357 |
+
gd = ((cv2.cvtColor(cv2.imread(masks[len(masks)-1]).astype(np.uint8), cv2.COLOR_RGB2GRAY)-th)*2)
|
358 |
diff = abs(bg-gd).astype(np.uint8)
|
359 |
mask = cv2.inRange(diff, 0, 5)
|
360 |
d["background"][mask>0] = (0,0,0,255)
|