PadelVisualizer
PadelVisualizer is PadelKit's interactive Three.js 3D court studio, multi-camera inspector, and synthetic computer vision pass renderer (RGB, Semantic Segmentation, Depth Map, and 17 Court Landmarks). It renders MatchTimeline recordings from .parquet or .csv files, streams real-time FrameState updates over Server-Sent Events, and supports both Mixamo .glb skeletal clips and baked 17-joint H36M 3D skeletons.
Constructor & Attributes
- Name
court- Type
- Court | None
- Description
Courtinstance defining dimensions, enclosure variant, turf color, and 17 3D landmarks. Defaults totimeline.courtorCourt.fip_standard().
- Name
cameras- Type
- list[Camera] | None
- Description
List of
Camerapresets available in the studio's camera selector dropdown. Defaults to 5 standard presets (broadcast_near,broadcast_far,overhead_zenith,corner_near_left,side_net_right).
- Name
timeline- Type
- MatchTimeline | None
- Description
MatchTimelineloaded into the scrubber. Defaults toMatchTimeline.demo_rally().
- Name
animation_library_dir- Type
- str | Path | None
- Description
Optional directory containing
manifest.jsonand.glbstroke animations exported bypadelkit-animator.
Create from Parquet or CSV
Constructs a PadelVisualizer directly from a Universal Match Format (.parquet) or .csv file.
When loading a .parquet file via PadelVisualizer.from_parquet(), the Court configuration (turf color, dimensions, indoor/outdoor setting) is automatically restored from the Parquet padelkit_metadata header, and any baked 17-joint 3D skeletons (keypoints_3d) are rendered directly in Three.js without requiring external .glb files.
Factory Classmethods
- Name
from_parquet(parquet_path, court=None, cameras=None, animation_library_dir=None)- Type
- PadelVisualizer
- Description
Loads a
.parquetmatch recording and initializes the 3D visualizer with its embedded court and skeletal/trajectory data.
- Name
from_csv(csv_path, court=None, cameras=None, animation_library_dir=None)- Type
- PadelVisualizer
- Description
Loads a
.csvtimeline recording into a newPadelVisualizer.
Load Parquet in 3D Studio
from padelkit import MatchTimeline, PadelVisualizer
# 1. Generate and save a match with baked 17-joint 3D skeletons
timeline = MatchTimeline.demo_rally(bake_skeleton=True)
timeline.to_parquet("match_baked.parquet")
# 2. Load directly from .parquet and export standalone HTML
viz = PadelVisualizer.from_parquet("match_baked.parquet")
viz.export_html("match_studio.html")
Export HTML, Serve & Stream
- Name
export_html(output_path)- Type
- Path
- Description
Writes a self-contained
.htmlfile embedding the court geometry, cameras, timeline frames, and (if configured) base64-encoded.glbanimations.
- Name
to_html(live_stream_url=None)- Type
- str
- Description
Returns the complete HTML string for the 3D studio.
- Name
serve(host='127.0.0.1', port=8765, open_browser=True, background=False)- Type
- ThreadingHTTPServer | None
- Description
Starts a local HTTP + Server-Sent Events (
/events) server. Whenbackground=True, runs on a daemon thread so Python code can push frames viapush_frame().
- Name
push_frame(frame)- Type
- None
- Description
Appends a
FrameStatetoself.timelineand broadcasts it immediately to all connected browser clients.
- Name
stop()- Type
- None
- Description
Stops the background HTTP server started by
serve(background=True).
- Name
load_parquet(parquet_path) / load_csv(csv_path)- Type
- PadelVisualizer
- Description
Replaces the active
timelinein-place from a.parquetor.csvfile and returnsself.
- Name
load_animation_library(animation_library_dir)- Type
- PadelVisualizer
- Description
Attaches a
padelkit-animator.glblibrary directory and returnsself.
- Name
add_camera(camera)- Type
- PadelVisualizer
- Description
Registers an additional
Cameraviewpoint in the 3D scene and returnsself.
Interactive Server & Jupyter
from padelkit import Camera, PadelVisualizer
viz = PadelVisualizer.from_parquet("match_baked.parquet")
viz.add_camera(Camera.overhead_zenith())
# In a Jupyter Notebook cell, returning `viz` renders an iframe automatically:
# viz
# Or launch the local interactive server:
# viz.serve(port=8765, open_browser=True)