kodokan.viz

Visualize a PoseSequence.

Two outputs, both requested by the project:

  • render_skeleton_video() — bake a shareable MP4 with the skeleton drawn either on the original video (overlay) or on a blank canvas (skeleton only).

  • log_to_rerun() — log frames + 2D skeletons to a Rerun recording for interactive, scrubbable inspection (and side-by-side compare of two sequences).

Persons are drawn in distinct colors (slot 0 green, slot 1 magenta) so tori/uke are visually separable.

kodokan.viz.DEFAULT_PERSON_COLORS = ((0, 255, 0), (255, 0, 255), (255, 255, 0), (0, 165, 255))

BGR colors per person slot (green, magenta, cyan, yellow…).

kodokan.viz.log_to_rerun(pose_seq: PoseSequence, *, source_video: str | Path | None = None, save: str | Path | None = None, spawn: bool = False, blank_canvas: bool = True, frame_scale: float = 0.5, conf_thresh: float = 0.3, entity_prefix: str = '') None[source]

Log frames + 2D skeletons to Rerun (overlay-on-video and skeleton-only views).

Parameters:
  • pose_seq – The sequence to log.

  • source_video – If given, downscaled frames are logged under video/ as a backdrop.

  • save – Write a standalone .rrd recording to this path.

  • spawn – Launch the Rerun viewer.

  • blank_canvas – Also log a skeleton-only view under skeleton/.

  • frame_scale – Downscale factor for logged video frames (keypoints scaled to match).

  • conf_thresh – Hide keypoints below this confidence.

  • entity_prefix – Prefix all entity paths (use distinct prefixes to compare two sequences side-by-side in one recording, e.g. "demoA/", "demoB/").

kodokan.viz.render_skeleton_video(pose_seq: PoseSequence, *, out_path: str | Path, source_video: str | Path | None = None, blank_canvas: bool = False, conf_thresh: float = 0.3, fps: float | None = None, person_colors=((0, 255, 0), (255, 0, 255), (255, 255, 0), (0, 165, 255)), background=(0, 0, 0), thickness: int = 2, radius: int = 4) Path[source]

Render skeletons to an MP4.

Parameters:
  • pose_seq – The pose sequence to draw.

  • out_path – Output .mp4 path.

  • source_video – Source clip; required (and used as backdrop) unless blank_canvas=True.

  • blank_canvas – If True, draw on a solid background instead of the video.

  • conf_thresh – Hide keypoints/edges below this confidence.

  • fps – Output fps (defaults to the sequence’s source fps).

  • person_colors – BGR colors per person slot.

  • background – BGR background color for the blank canvas.

  • thickness – Edge thickness / joint radius in pixels.

  • radius – Edge thickness / joint radius in pixels.

Returns:

The output path.