Update app.py
Browse files
app.py
CHANGED
|
@@ -41,6 +41,7 @@ gradient = None
|
|
| 41 |
params = { "fnum":0 }
|
| 42 |
pcolors = []
|
| 43 |
frame_selected = 0
|
|
|
|
| 44 |
frames = []
|
| 45 |
backups = []
|
| 46 |
depths = []
|
|
@@ -150,7 +151,8 @@ def make_video(video_path, outdir='./vis_video_depth', encoder='vits', blur_data
|
|
| 150 |
#out = cv2.VideoWriter(output_path, cv2.VideoWriter_fourcc(*"avc1"), frame_rate, (output_width, frame_height))
|
| 151 |
#fourcc = cv2.VideoWriter_fourcc(*'mp4v')
|
| 152 |
#out = cv2.VideoWriter(output_path, fourcc, frame_rate, (output_width, frame_height))
|
| 153 |
-
|
|
|
|
| 154 |
count = 0
|
| 155 |
n = 0
|
| 156 |
depth_frames = []
|
|
@@ -455,6 +457,9 @@ def draw_mask(o, b, v, d, evt: gr.EventData):
|
|
| 455 |
depth = cv2.imread(depths[frame_selected], cv2.IMREAD_UNCHANGED).astype(np.uint8)
|
| 456 |
depth[mask>0] = (0,0,0,0)
|
| 457 |
cv2.imwrite(depths[frame_selected], depth)
|
|
|
|
|
|
|
|
|
|
| 458 |
|
| 459 |
return gr.ImageEditor(value=d)
|
| 460 |
|
|
@@ -474,8 +479,8 @@ def get_mean_and_std(x):
|
|
| 474 |
|
| 475 |
def color_transfer(base):
|
| 476 |
global frames
|
| 477 |
-
|
| 478 |
-
|
| 479 |
for n in range(len(frames)):
|
| 480 |
targets.append(frames[base])
|
| 481 |
if n != base:
|
|
|
|
| 41 |
params = { "fnum":0 }
|
| 42 |
pcolors = []
|
| 43 |
frame_selected = 0
|
| 44 |
+
comb_frames = []
|
| 45 |
frames = []
|
| 46 |
backups = []
|
| 47 |
depths = []
|
|
|
|
| 151 |
#out = cv2.VideoWriter(output_path, cv2.VideoWriter_fourcc(*"avc1"), frame_rate, (output_width, frame_height))
|
| 152 |
#fourcc = cv2.VideoWriter_fourcc(*'mp4v')
|
| 153 |
#out = cv2.VideoWriter(output_path, fourcc, frame_rate, (output_width, frame_height))
|
| 154 |
+
|
| 155 |
+
global comb_frames
|
| 156 |
count = 0
|
| 157 |
n = 0
|
| 158 |
depth_frames = []
|
|
|
|
| 457 |
depth = cv2.imread(depths[frame_selected], cv2.IMREAD_UNCHANGED).astype(np.uint8)
|
| 458 |
depth[mask>0] = (0,0,0,0)
|
| 459 |
cv2.imwrite(depths[frame_selected], depth)
|
| 460 |
+
|
| 461 |
+
comb_frame = np.concatenate(frame, depth, axis=0)
|
| 462 |
+
cv2.imwrite(comb_frames[frame_selected], comb_frame)
|
| 463 |
|
| 464 |
return gr.ImageEditor(value=d)
|
| 465 |
|
|
|
|
| 479 |
|
| 480 |
def color_transfer(base):
|
| 481 |
global frames
|
| 482 |
+
targets = []
|
| 483 |
+
|
| 484 |
for n in range(len(frames)):
|
| 485 |
targets.append(frames[base])
|
| 486 |
if n != base:
|