42 Commits

Author SHA1 Message Date
Ruslan Bakiev
f6f0e16d8e Make calibration report point-centric with visual overlays 2026-03-26 09:41:09 +07:00
Ruslan Bakiev
a3b57c5742 Remove Dagster pipeline and redesign calibration flow UI 2026-03-26 09:28:49 +07:00
Ruslan Bakiev
f14249dec9 Rewrite calibration: intersection matching + dual mapping strategy
The core calibration was broken because the green quad corners didn't
correspond to the correct court corners (giving Z=15m camera positions).

New approach:
1. Detect white line segments on green court surface
2. Merge into distinct lines, find intersections
3. Match intersections to known court template using initial
   homography from green quad (tries both left-right mirror mappings)
4. solvePnP with matched 2D-3D correspondences
5. Sanity check: camera Z must be 0-5m, prefers ~1m height
6. Fallback to quad-only calibration with both mappings if
   not enough intersections detected

Also: CameraCalibrator now uses findHomography for N>4 points,
and get_half_court_intersections() provides the 6 template keypoints.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 15:09:57 +07:00
Ruslan Bakiev
8add172f22 Rewrite calibration: green court surface segmentation instead of line angles
- Detect green court surface via HSV color thresholding
- Find court boundary as quadrilateral (contour approximation)
- Detect white line segments within the green area only
- Debug image: green overlay + court quad + white lines + camera XYZ
- Much more robust than angle-based line classification

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 14:58:58 +07:00
Ruslan Bakiev
6225809459 Click-to-fullscreen debug images + highlight detected lines on 3D scene
- Debug images clickable — opens fullscreen overlay (click to close)
- After calibration, detected court lines highlighted on 3D scene
  (blue for CAM0, pink for CAM1)
- Return matched_lines_3d from calibration (baseline, kitchen, sidelines, service)
- Show line names in calibration results

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 14:53:37 +07:00
Ruslan Bakiev
8ec4ccf109 Rewrite court detection: find ALL court lines, not just 4 corners
- Detect white lines via color threshold + Canny + Hough
- Group/merge nearby parallel segments into court lines
- Classify as 'across' (baseline, kitchen) and 'along' (sidelines, service)
- Match detected lines to known court geometry for solvePnP
- Debug image shows: raw segments (gray), merged across (yellow), along (magenta)
- Show line counts + matched points in calibration UI

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 14:49:45 +07:00
Ruslan Bakiev
2a7e285e70 Calibration tab: split layout — 3D left, debug images right
- Split view: 3D scene on left, camera debug images + controls on right
- Debug images show detected court quad + computed camera XYZ
- Camera positions displayed as colored cones with look-direction lines on 3D scene
- Cameras cleared and redrawn on re-calibration (no duplicates)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 14:44:11 +07:00
Ruslan Bakiev
ba70200353 Show computed camera 3D position after calibration
- Debug image shows only court quadrilateral + camera XYZ coords
- Remove all Hough line debug visualization noise
- Simplify _detect_court_corners — returns corners + error only
- Display camera positions in calibration card (CAM0/CAM1 X Y Z)
- Clean up auto_calibrate flow

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 14:33:30 +07:00
Ruslan Bakiev
e12edab19b Remove all fallbacks: show errors, draw debug lines on calibration
- Remove try-except in CameraCalibrator — errors propagate to UI
- Remove auto-load of saved calibrations — always start uncalibrated
- Remove hardcoded "Base Setup" card with fake values
- Remove addStereocameras/getCamParams dead code
- Draw all detected Hough lines + corners on debug frame during calibration
- Show debug images in calibration tab after attempt
- Show error messages in UI instead of swallowing them

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 14:27:53 +07:00
Ruslan Bakiev
ee73aa80d8 Rename tabs: Camera, Calibration, Trajectory — remove overlay
- Tab 1: Camera (raw feeds)
- Tab 2: Calibration (3D court + calibrate button, as before)
- Tab 3: Trajectory (disabled until calibrated)
- Remove unnecessary calibration overlay from Camera tab

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 14:13:28 +07:00
Ruslan Bakiev
1294747af2 Enforce calibration-first workflow: block detection and VAR until calibrated
- Remove fallback corner estimation (_estimate_corners_from_net)
- Gate YOLO detection behind calibration check in detection_loop
- Add calibration overlay UI with prominent Calibrate button
- Disable Court/Trajectory tabs until system_ready
- Skip trajectory/VAR/event polling when uncalibrated
- Add system_ready flag to calibration status API

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 14:05:47 +07:00
Ruslan Bakiev
43f11a7e40 fix: fixed header/footer, no scroll, 100vh layout
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 12:57:22 +07:00
Ruslan Bakiev
29d69fb550 fix: three equal 120x90 cards in bottom bar (cam, cam, info)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 12:54:03 +07:00
Ruslan Bakiev
0c6a0f4852 fix: bottom bar 100px, items aligned to bottom center
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 12:51:52 +07:00
Ruslan Bakiev
59203a7838 fix: fixed 80px bottom bar, compact cards same height as cam thumbs
- Bottom bar fixed height, all items aligned
- Cam card and VAR card compact vertical, fit within bar
- Trajectory same layout as court
- VAR snapshot removed from bottom bar (too large)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 12:49:51 +07:00
Ruslan Bakiev
08e280d617 feat: real URL routes for tabs (/detection, /court, /trajectory)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 12:45:03 +07:00
Ruslan Bakiev
22c24c0296 fix: vertical cam params card, URL-based tabs, all english
- Cam card vertical with Base Setup title and sensor info
- Calibrate button inside the card
- Tabs linked to URL hash (#detection, #court, #trajectory)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 12:43:38 +07:00
Ruslan Bakiev
aaa4199c85 fix: compact camera params card, text only, all english
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 12:40:38 +07:00
Ruslan Bakiev
99ccca3968 feat: editable camera params panel on Court tab with live 3D update
Position Y, Height, Stereo gap, Rotation angle, HFOV — all adjustable
in real time, 3D scene updates on change.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 12:10:16 +07:00
Ruslan Bakiev
4605ed1e2c fix: correct HFOV to 128° (IMX219 160° diagonal on 4:3 sensor)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 12:00:13 +07:00
Ruslan Bakiev
39159f804f fix: FOV rays originate from actual camera position (Y=-1), not court edge
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 11:54:42 +07:00
Ruslan Bakiev
2ff8a87037 fix: correct FOV projection origin from camera position on court edge
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 11:49:57 +07:00
Ruslan Bakiev
014cc03677 fix: smooth polygon coverage, angle 15°, overlap blends to purple
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 11:44:06 +07:00
Ruslan Bakiev
72e6d1c191 fix: rasterized court coverage with 3 distinct colors
- Blue = cam0 only, Pink = cam1 only, Purple = overlap
- Grid-based fill, no dashed lines or edge artifacts
- White court lines on top

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 11:42:02 +07:00
Ruslan Bakiev
d34c25a6d7 fix: bright colored court coverage, all white court lines
- Camera FOV coverage fills court with visible color (opacity 0.4)
- All court lines now white (no more red/grey)
- Lines raised above coverage so they stay visible

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 11:37:45 +07:00
Ruslan Bakiev
fedf46670a fix: project camera FOV coverage directly onto court surface
- FOV clipped to court boundaries (0,0)-(13.4,6.1)
- Colored overlay shows which court areas each camera covers
- Dashed center line shows each camera's look direction
- cam0 (blue) -28° from +Y, cam1 (pink) +28° from +Y

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 11:31:39 +07:00
Ruslan Bakiev
d8cc3904e6 feat: stereo camera rig on net line with 160° FOV projection
- Cameras at net line (X=6.7), 1m outside court (Y=-1), 1m height
- Stereo pair 6cm apart, each rotated 28° outward
- FOV cones projected onto court surface showing coverage
- cam0 (blue) looks left, cam1 (pink) looks right

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 11:28:45 +07:00
Ruslan Bakiev
7c8a87f9be feat: add physical camera marker on 3D court (1m from net, center, 1m height)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 11:18:37 +07:00
Ruslan Bakiev
dc79763dab fix: cameras side by side, panels next to them, zoom out 3D view
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 11:15:24 +07:00
Ruslan Bakiev
8dd1573d0e fix: court/trajectory layout, net orientation, camera position
- Court and Trajectory tabs: 3D viewport full screen, cameras small
  at bottom center as horizontal thumbnails
- Fix net orientation (was perpendicular, now spans court width)
- Default camera: center line, 1m from net, 1m height

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 11:11:44 +07:00
Ruslan Bakiev
9ebee2a529 fix: swap cam0/cam1 order and horizontal camera layout on all tabs
Cameras now display as a horizontal panorama (cam1 left, cam0 right)
on Detection, Court, and Trajectory tabs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 11:06:00 +07:00
Ruslan Bakiev
b87665e8bc Simplify calibration status text in sidebar
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 13:57:35 +07:00
Ruslan Bakiev
f54bc165f6 Move calibration controls into Court sidebar
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 13:52:32 +07:00
Ruslan Bakiev
85623454b6 Info panel only visible on Trajectory tab
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 13:49:11 +07:00
Ruslan Bakiev
351e3818f9 Court + Trajectory: split layout — 3D 80% left, cam previews + VAR in sidebar right
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 13:39:58 +07:00
Ruslan Bakiev
6fbc17c6e0 Remove all camera labels — overlaps with debug overlay
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 13:37:57 +07:00
Ruslan Bakiev
0785cb3296 Remove camera labels from Court tab small previews
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 13:25:25 +07:00
Ruslan Bakiev
2f0eb81dce Court tab: 3D scene primary, cameras small at bottom
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 13:21:08 +07:00
Ruslan Bakiev
0aae067e95 Remove auto-imports from src/__init__.py to avoid inference_sdk dependency
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 13:17:20 +07:00
Ruslan Bakiev
4c9b48e057 Add referee system architecture: 3-tab web UI, physics, VAR detection
- src/calibration: 3D camera calibration (solvePnP, homography)
- src/physics: trajectory model with gravity/drag, close call event detector
- src/streaming: camera reader + ring buffer for VAR clips
- src/web: Flask app with 3-tab UI (Detection, Court, Trajectory) + Three.js
- jetson/main.py: unified entry point wiring all components

Court tab: one-click calibration button, 3D scene with camera positions
Trajectory tab: accumulated ball path, VAR panel with snapshot + timer

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 13:16:12 +07:00
Ruslan Bakiev
d61d6b3636 Add dual CSI camera web detection stream for Jetson
GStreamer hardware ISP capture, YOLOv8n CUDA inference,
JPEG snapshot-based web UI for both cameras simultaneously.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 11:25:49 +07:00
Ruslan Bakiev
549fd1da9d Initial commit 2026-03-06 09:43:52 +07:00