Spaces:
Running
on
Zero
Running
on
Zero
Update
Browse files
app.py
CHANGED
@@ -586,12 +586,14 @@ def preprocess_image_end(image_end):
|
|
586 |
|
587 |
|
588 |
def add_drag(tracking_points):
|
589 |
-
tracking_points
|
|
|
590 |
return tracking_points
|
591 |
|
592 |
|
593 |
def delete_last_drag(tracking_points, first_frame_path, last_frame_path):
|
594 |
-
tracking_points
|
|
|
595 |
transparent_background = Image.open(first_frame_path).convert("RGBA")
|
596 |
transparent_background_end = Image.open(last_frame_path).convert("RGBA")
|
597 |
w, h = transparent_background.size
|
@@ -633,13 +635,16 @@ def delete_last_drag(tracking_points, first_frame_path, last_frame_path):
|
|
633 |
|
634 |
|
635 |
def delete_last_step(tracking_points, first_frame_path, last_frame_path):
|
636 |
-
tracking_points[-1]
|
|
|
637 |
transparent_background = Image.open(first_frame_path).convert("RGBA")
|
638 |
transparent_background_end = Image.open(last_frame_path).convert("RGBA")
|
639 |
w, h = transparent_background.size
|
640 |
transparent_layer = np.zeros((h, w, 4))
|
641 |
|
642 |
for track in tracking_points:
|
|
|
|
|
643 |
if len(track) > 1:
|
644 |
for i in range(len(track) - 1):
|
645 |
start_point = track[i]
|
|
|
586 |
|
587 |
|
588 |
def add_drag(tracking_points):
|
589 |
+
if not tracking_points or tracking_points[-1]:
|
590 |
+
tracking_points.append([])
|
591 |
return tracking_points
|
592 |
|
593 |
|
594 |
def delete_last_drag(tracking_points, first_frame_path, last_frame_path):
|
595 |
+
if tracking_points:
|
596 |
+
tracking_points.pop()
|
597 |
transparent_background = Image.open(first_frame_path).convert("RGBA")
|
598 |
transparent_background_end = Image.open(last_frame_path).convert("RGBA")
|
599 |
w, h = transparent_background.size
|
|
|
635 |
|
636 |
|
637 |
def delete_last_step(tracking_points, first_frame_path, last_frame_path):
|
638 |
+
if tracking_points and tracking_points[-1]:
|
639 |
+
tracking_points[-1].pop()
|
640 |
transparent_background = Image.open(first_frame_path).convert("RGBA")
|
641 |
transparent_background_end = Image.open(last_frame_path).convert("RGBA")
|
642 |
w, h = transparent_background.size
|
643 |
transparent_layer = np.zeros((h, w, 4))
|
644 |
|
645 |
for track in tracking_points:
|
646 |
+
if not track:
|
647 |
+
continue
|
648 |
if len(track) > 1:
|
649 |
for i in range(len(track) - 1):
|
650 |
start_point = track[i]
|