|
|
|
@ -105,7 +105,7 @@ class AnnotationIR:
|
|
|
|
if scoped_shapes:
|
|
|
|
if scoped_shapes:
|
|
|
|
if not scoped_shapes[0]['keyframe']:
|
|
|
|
if not scoped_shapes[0]['keyframe']:
|
|
|
|
segment_shapes.insert(0, scoped_shapes[0])
|
|
|
|
segment_shapes.insert(0, scoped_shapes[0])
|
|
|
|
if not scoped_shapes[-1]['keyframe'] and \
|
|
|
|
if scoped_shapes[-1]['keyframe'] and \
|
|
|
|
scoped_shapes[-1]['outside']:
|
|
|
|
scoped_shapes[-1]['outside']:
|
|
|
|
segment_shapes.append(scoped_shapes[-1])
|
|
|
|
segment_shapes.append(scoped_shapes[-1])
|
|
|
|
elif stop + 1 < len(interpolated_shapes) and \
|
|
|
|
elif stop + 1 < len(interpolated_shapes) and \
|
|
|
|
@ -737,11 +737,18 @@ class TrackManager(ObjectManager):
|
|
|
|
return shapes
|
|
|
|
return shapes
|
|
|
|
|
|
|
|
|
|
|
|
shapes = []
|
|
|
|
shapes = []
|
|
|
|
curr_frame = track["shapes"][0]["frame"]
|
|
|
|
|
|
|
|
prev_shape = {}
|
|
|
|
prev_shape = {}
|
|
|
|
for shape in track["shapes"]:
|
|
|
|
for shape in sorted(track["shapes"], key=lambda shape: shape["frame"]):
|
|
|
|
|
|
|
|
curr_frame = shape["frame"]
|
|
|
|
|
|
|
|
if end_frame <= curr_frame:
|
|
|
|
|
|
|
|
if not prev_shape:
|
|
|
|
|
|
|
|
shape["keyframe"] = True
|
|
|
|
|
|
|
|
shapes.append(shape)
|
|
|
|
|
|
|
|
prev_shape = shape
|
|
|
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
|
|
if prev_shape:
|
|
|
|
if prev_shape:
|
|
|
|
assert shape["frame"] > curr_frame
|
|
|
|
assert shape["frame"] > prev_shape["frame"]
|
|
|
|
for attr in prev_shape["attributes"]:
|
|
|
|
for attr in prev_shape["attributes"]:
|
|
|
|
if attr["spec_id"] not in map(lambda el: el["spec_id"], shape["attributes"]):
|
|
|
|
if attr["spec_id"] not in map(lambda el: el["spec_id"], shape["attributes"]):
|
|
|
|
shape["attributes"].append(deepcopy(attr))
|
|
|
|
shape["attributes"].append(deepcopy(attr))
|
|
|
|
@ -750,13 +757,8 @@ class TrackManager(ObjectManager):
|
|
|
|
|
|
|
|
|
|
|
|
shape["keyframe"] = True
|
|
|
|
shape["keyframe"] = True
|
|
|
|
shapes.append(shape)
|
|
|
|
shapes.append(shape)
|
|
|
|
curr_frame = shape["frame"]
|
|
|
|
|
|
|
|
prev_shape = shape
|
|
|
|
prev_shape = shape
|
|
|
|
|
|
|
|
|
|
|
|
# keep at least 1 shape
|
|
|
|
|
|
|
|
if end_frame <= curr_frame:
|
|
|
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not prev_shape["outside"]:
|
|
|
|
if not prev_shape["outside"]:
|
|
|
|
shape = deepcopy(prev_shape)
|
|
|
|
shape = deepcopy(prev_shape)
|
|
|
|
shape["frame"] = end_frame
|
|
|
|
shape["frame"] = end_frame
|
|
|
|
|