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>
This commit is contained in:
Ruslan Bakiev
2026-03-22 14:49:45 +07:00
parent 2a7e285e70
commit 8ec4ccf109
2 changed files with 297 additions and 106 deletions

View File

@@ -509,16 +509,23 @@ function doCalibrate() {
errEl.style.display = 'none';
updateCalibrationStatus();
// Show computed camera positions
// Show computed camera positions and line stats
var posEl = document.getElementById('calPositions');
if (posEl && data.result) {
posEl.style.display = 'block';
for (var sid in data.result) {
var r = data.result[sid];
var el = document.getElementById('calPos' + sid);
if (!el) continue;
if (r.ok && r.camera_position) {
var p = r.camera_position;
var el = document.getElementById('calPos' + sid);
if (el) el.textContent = 'CAM' + sid + ': X=' + p[0].toFixed(2) + ' Y=' + p[1].toFixed(2) + ' Z=' + p[2].toFixed(2) + 'm';
var lines = r.lines_detected || {};
el.textContent = 'CAM' + sid + ': X=' + p[0].toFixed(2) + ' Y=' + p[1].toFixed(2) + ' Z=' + p[2].toFixed(2) + 'm'
+ ' (' + (r.points_matched || 0) + 'pts, ' + (lines.across || 0) + 'a+' + (lines.along || 0) + 'l)';
} else if (r.lines_detected) {
var lines = r.lines_detected;
el.textContent = 'CAM' + sid + ': ' + (lines.across || 0) + ' across + ' + (lines.along || 0) + ' along lines';
el.style.color = '#ff4444';
}
}
}