Spaces:
Starting
Starting
Update app.py
Browse files
app.py
CHANGED
@@ -269,25 +269,21 @@ def get_mesh(image, depth):
|
|
269 |
|
270 |
def blur_image(image, depth, blur_data):
|
271 |
fnum = frame_selected
|
|
|
272 |
|
273 |
blur_frame = image[fnum][0].copy()
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
while j <= 8:
|
278 |
blur_lo = np.array([i,i,i])
|
279 |
-
blur_hi = np.array([i+
|
280 |
blur_mask = cv2.inRange(depth[fnum][0], blur_lo, blur_hi)
|
281 |
-
|
282 |
-
print(f'kernel size {j}')
|
283 |
-
blur = cv2.GaussianBlur(image[fnum][0], (j, j), 0)
|
284 |
|
285 |
blur_frame[blur_mask>0] = blur[blur_mask>0]
|
286 |
-
|
287 |
-
l = l + 1
|
288 |
-
if l == 4:
|
289 |
-
l = 0
|
290 |
-
j = j + 2
|
291 |
|
292 |
image[fnum][0] = blur_frame
|
293 |
return image
|
@@ -486,7 +482,7 @@ with gr.Blocks(css=css) as demo:
|
|
486 |
def on_submit(uploaded_video,model_type):
|
487 |
|
488 |
# Process the video and get the path of the output video
|
489 |
-
output_video_path = make_video(
|
490 |
|
491 |
return output_video_path
|
492 |
|
|
|
269 |
|
270 |
def blur_image(image, depth, blur_data):
|
271 |
fnum = frame_selected
|
272 |
+
blur_a = blur_data.split()
|
273 |
|
274 |
blur_frame = image[fnum][0].copy()
|
275 |
+
j = 0
|
276 |
+
while j < 256:
|
277 |
+
i = 255 - j
|
|
|
278 |
blur_lo = np.array([i,i,i])
|
279 |
+
blur_hi = np.array([i+1,i+1,i+1])
|
280 |
blur_mask = cv2.inRange(depth[fnum][0], blur_lo, blur_hi)
|
281 |
+
|
282 |
+
print(f'kernel size {int(blur_a[j])}')
|
283 |
+
blur = cv2.GaussianBlur(image[fnum][0], (int(blur_a[j]), int(blur_a[j])), 0)
|
284 |
|
285 |
blur_frame[blur_mask>0] = blur[blur_mask>0]
|
286 |
+
j = j + 1
|
|
|
|
|
|
|
|
|
287 |
|
288 |
image[fnum][0] = blur_frame
|
289 |
return image
|
|
|
482 |
def on_submit(uploaded_video,model_type):
|
483 |
|
484 |
# Process the video and get the path of the output video
|
485 |
+
output_video_path = make_video(uploaded_video,encoder=model_type)
|
486 |
|
487 |
return output_video_path
|
488 |
|