Update app.py
Browse files
app.py
CHANGED
|
@@ -15,7 +15,6 @@ from vincenty import vincenty
|
|
| 15 |
import json
|
| 16 |
from collections import Counter
|
| 17 |
import mediapy
|
| 18 |
-
from pymatting import cutout
|
| 19 |
|
| 20 |
#from depth_anything.dpt import DepthAnything
|
| 21 |
#from depth_anything.util.transform import Resize, NormalizeImage, PrepareForNet
|
|
@@ -234,26 +233,10 @@ def make_video(video_path, outdir='./vis_video_depth', encoder='vits', blur_data
|
|
| 234 |
depth_frames.append(f"f{count}_dmap.png")
|
| 235 |
|
| 236 |
depth_gray = seg_frame(depth_gray, o, b) + 128
|
| 237 |
-
print(depth_gray[depth_gray>128]-128)
|
| 238 |
|
| 239 |
cv2.imwrite(f"f{count}_mask.png", depth_gray)
|
| 240 |
-
masks.append(f"f{count}_mask.png")
|
| 241 |
-
|
| 242 |
-
depth_gray_trimap = np.zeros(depth_gray.shape[:2], np.uint8)
|
| 243 |
-
depth_gray_trimap[depth_gray==128] = 0
|
| 244 |
-
depth_gray_trimap[depth_gray==129] = 255
|
| 245 |
-
depth_gray_trimap[depth_gray==131] = 127
|
| 246 |
-
|
| 247 |
-
cv2.imwrite(f"f{count}_trimap.png", depth_gray_trimap)
|
| 248 |
-
|
| 249 |
-
cutout(
|
| 250 |
-
# input image path
|
| 251 |
-
f"f{count}.png",
|
| 252 |
-
# input trimap path
|
| 253 |
-
f"f{count}_trimap.png",
|
| 254 |
-
# output cutout path
|
| 255 |
-
f"f{count}.png")
|
| 256 |
-
|
| 257 |
count += 1
|
| 258 |
|
| 259 |
final_vid = create_video(orig_frames, frame_rate, "orig")
|
|
@@ -410,7 +393,7 @@ def get_mesh(image, depth, blur_data, loadall):
|
|
| 410 |
|
| 411 |
def blur_image(image, depth, blur_data):
|
| 412 |
blur_a = blur_data.split()
|
| 413 |
-
print(f'blur data {blur_data}')
|
| 414 |
|
| 415 |
blur_frame = image.copy()
|
| 416 |
j = 0
|
|
|
|
| 15 |
import json
|
| 16 |
from collections import Counter
|
| 17 |
import mediapy
|
|
|
|
| 18 |
|
| 19 |
#from depth_anything.dpt import DepthAnything
|
| 20 |
#from depth_anything.util.transform import Resize, NormalizeImage, PrepareForNet
|
|
|
|
| 233 |
depth_frames.append(f"f{count}_dmap.png")
|
| 234 |
|
| 235 |
depth_gray = seg_frame(depth_gray, o, b) + 128
|
| 236 |
+
#print(depth_gray[depth_gray>128]-128)
|
| 237 |
|
| 238 |
cv2.imwrite(f"f{count}_mask.png", depth_gray)
|
| 239 |
+
masks.append(f"f{count}_mask.png")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 240 |
count += 1
|
| 241 |
|
| 242 |
final_vid = create_video(orig_frames, frame_rate, "orig")
|
|
|
|
| 393 |
|
| 394 |
def blur_image(image, depth, blur_data):
|
| 395 |
blur_a = blur_data.split()
|
| 396 |
+
#print(f'blur data {blur_data}')
|
| 397 |
|
| 398 |
blur_frame = image.copy()
|
| 399 |
j = 0
|