Skip to content

padex.calibration

Interactive court calibration for mapping pixel coordinates to real-world meters.

padex.calibration.interactive_calibrate(video_path, save_path=None)

Run the full interactive calibration workflow.

Opens a video, lets the user select a frame and click court keypoints, then computes the homography and optionally saves to JSON.

Parameters:

Name Type Description Default
video_path str | Path

Path to the video file.

required
save_path str | Path | None

Where to save the calibration JSON. Defaults to <video_stem>_calibration.json next to the video.

None

Returns:

Type Description
CourtCalibration | None

CourtCalibration if successful, None if cancelled.

padex.calibration.FrameSelector

Phase 1: Let the user browse frames and pick a good one.

run()

Show frames, return (frame, frame_id) or None if user quits.

padex.calibration.KeypointLabeler

Phase 2: Let the user click keypoints on the selected frame.

run()

Run the labeling loop. Returns keypoint dict or None if quit.

padex.calibration.verify_calibration(frame, calibration_data)

Show the frame with all 12 keypoints projected back for visual verification.