From 0b29f59cda169167e4784c3319cf84805b7b5a14 Mon Sep 17 00:00:00 2001 From: q Date: Thu, 7 Aug 2025 22:03:18 +0300 Subject: [PATCH] interpolated age --- tsmark/video_annotator.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tsmark/video_annotator.py b/tsmark/video_annotator.py index 2ab6685..049b493 100755 --- a/tsmark/video_annotator.py +++ b/tsmark/video_annotator.py @@ -417,7 +417,7 @@ class Marker: } def get_interpolated_point(self, nr=None, index=None): - """{x0,y0,x1,y1, cx, cy, visible,type}""" + """{x0,y0,x1,y1, cx, cy, visible, type, age}""" if nr is None: nr = self.nr if index is None: @@ -434,7 +434,7 @@ class Marker: ) return value - return {"x0": None, "y0": None, "x1": None, "y1": None, "cx": None, "cy": None, "visible": 0, "type": None} + return {"x0": None, "y0": None, "x1": None, "y1": None, "cx": None, "cy": None, "visible": 0, "type": None, "age": None} def modify_point(self, position, x, y): """position: tl topleft, br bottomright, c center""" @@ -623,8 +623,8 @@ class World: post: after any keyframes """ - def i_point(x0=None, y0=None, x1=None, y1=None, t=None, visible=None): - return {"x0": x0, "y0": y0, "x1": x1, "y1": y1, "type": t, "visible": visible} + def i_point(x0=None, y0=None, x1=None, y1=None, t=None, visible=None, age=None): + return {"x0": x0, "y0": y0, "x1": x1, "y1": y1, "type": t, "visible": visible, "age"=age} def point2array(p): @@ -683,6 +683,13 @@ class World: # clicked points (not necessary, could determine at draw time!) for key in point_keys: self.points_interpolated[self.point_index][key]["type"] = "key" + age=0 + for key in self.points_interpolated[self.point_index]: + if self.points_interpolated[self.point_index][key]["type"] == "key": + age = 0 + if self.points_interpolated[self.point_index][key]["type"] == "interp": + age += 1 + self.points_interpolated[self.point_index][key]["type"] = age def draw_help(self, frame):