Track trail and track list overlays.
TrackListOverlay(labels: sleap.io.dataset.Labels = None, player: sleap.gui.widgets.video.QtVideoPlayer = None, text_box: Optional[sleap.gui.widgets.video.QtTextWithBackground] = None)¶
Class to show track number and names in overlay.
Gets or set whether overlay is visible.
TrackTrailOverlay(labels: sleap.io.dataset.Labels = None, player: sleap.gui.widgets.video.QtVideoPlayer = None, trail_length: int = 0, show: bool = True, max_node_count: Optional[int] = None)¶
Class to show track trails as overlay on video frame.
Initialize this object with both its data source and its visual output scene, and it handles both extracting the relevant data for a given frame and plotting it in the output.
Labelsdataset from which to get overlay data.
The video player in which to show overlay.
The maximum number of frames to include in trail.
After class is instantiated, call
add_to_scene(frame_idx)()to plot the trails in scene.
add_to_scene(video: sleap.io.video.Video, frame_idx: int)¶
Plot the trail on a given frame.
video – current video
frame_idx – index of the frame to which the trail is attached
get_frame_selection(video: sleap.io.video.Video, frame_idx: int)¶
Return LabeledFrame objects to include in trail for specified frame.
Get data needed to draw track trail.
frame_selection – an iterable with the
LabeledFrameobjects to include in trail.
- Dictionary keyed by track, value is list of lists of (x, y) tuples
i.e., for every node in instance, we get a list of positions
get_tracks_in_frame(video: sleap.io.video.Video, frame_idx: int, include_trails: bool = False) → List[sleap.instance.Track]¶
Returns list of tracks that have instance in specified frame.
video – Video for which we want tracks.
frame_idx – Frame index for which we want tracks.
include_trails – Whether to include tracks which aren’t in current frame but would be included in trail (i.e., previous frames within trail_length).
List of tracks.
Converts a list of (x, y)-tuples to a QPainterPath.