send callibration

This commit is contained in:
chk
2026-06-10 12:13:34 +02:00
parent f1b20a2dc8
commit 2ebe7b709b
3 changed files with 71 additions and 2 deletions

View File

@@ -235,7 +235,7 @@
</select>
<button id="btn-compute-calib">Kalibrierung berechnen</button>
<button disabled title="Folgt später">NPZ speichern</button>
<button id="btn-upload-npz">NPZ speichern</button>
</div>
</div>
@@ -451,6 +451,27 @@
}
});
// "NPZ speichern" → an Webcam-Service übertragen
document.getElementById('btn-upload-npz').addEventListener('click', async () => {
const camera = document.getElementById('cam-select-calib').value;
if (!camera) { logC('⚠ Bitte zuerst eine Kamera auswählen.'); return; }
logC(`NPZ wird an Webcam-Service übertragen (${camera}) …`);
try {
const r = await fetch('/api/calibration/upload-npz', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ camera }),
});
const d = await r.json();
if (d.error) { logC(`❌ Fehler: ${d.error}`); return; }
logC(`✅ Gespeichert: ${d.webcam?.saved} (${d.size} Bytes)`);
logC(` calibrationUrl: ${d.webcam?.calibrationUrl}`);
} catch (err) {
logC(`❌ Fehler: ${err}`);
}
});
// "Kalibrierung berechnen" SSE-Stream lesen
document.getElementById('btn-compute-calib').addEventListener('click', async () => {
const camera = document.getElementById('cam-select-calib').value;