freealise commited on
Commit
df5eae9
1 Parent(s): 5d73312

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -20,6 +20,7 @@ from depth_anything.dpt import DepthAnything
20
  from depth_anything.util.transform import Resize, NormalizeImage, PrepareForNet
21
  from moviepy.editor import *
22
 
 
23
  gradient = None
24
  params = { "fnum":0, "l":16, "c":3, "k":7 }
25
  frame_selected = 0
@@ -358,6 +359,7 @@ def draw_mask(f, l, c, k, v, d, evt: gr.EventData):
358
  global frame_selected
359
  global masks
360
  global gradient
 
361
 
362
  points = json.loads(v)
363
  pts = np.array(points, np.int32)
@@ -407,8 +409,9 @@ def draw_mask(f, l, c, k, v, d, evt: gr.EventData):
407
  params["k"] = k
408
 
409
  d["layers"][0] = cv2.cvtColor(bg, cv2.COLOR_GRAY2RGBA)
 
410
  else:
411
- mask = cv2.inRange(cv2.cvtColor(d["layers"][0], cv2.COLOR_RGBA2GRAY), 255, 255)
412
 
413
  x = points[len(points)-1][0]
414
  y = points[len(points)-1][1]
 
20
  from depth_anything.util.transform import Resize, NormalizeImage, PrepareForNet
21
  from moviepy.editor import *
22
 
23
+ edge = None
24
  gradient = None
25
  params = { "fnum":0, "l":16, "c":3, "k":7 }
26
  frame_selected = 0
 
359
  global frame_selected
360
  global masks
361
  global gradient
362
+ global edge
363
 
364
  points = json.loads(v)
365
  pts = np.array(points, np.int32)
 
409
  params["k"] = k
410
 
411
  d["layers"][0] = cv2.cvtColor(bg, cv2.COLOR_GRAY2RGBA)
412
+ edge = mask.copy()
413
  else:
414
+ mask = edge.copy()
415
 
416
  x = points[len(points)-1][0]
417
  y = points[len(points)-1][1]