From 9cf2e1c4c2972399318433cfbe04cfdafb364c89 Mon Sep 17 00:00:00 2001 From: samfreund Date: Wed, 22 Oct 2025 19:48:15 -0500 Subject: [PATCH 1/2] take calib snapshots in a loop --- .../cameras/CameraCalibrationCard.vue | 18 +++++++++++++ .../stores/settings/CameraSettingsStore.ts | 26 +++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/photon-client/src/components/cameras/CameraCalibrationCard.vue b/photon-client/src/components/cameras/CameraCalibrationCard.vue index c664357f8f..f6a0274018 100644 --- a/photon-client/src/components/cameras/CameraCalibrationCard.vue +++ b/photon-client/src/components/cameras/CameraCalibrationCard.vue @@ -196,6 +196,7 @@ const calibCanceled = ref(false); const calibSuccess = ref(undefined); const calibEndpointFail = ref(false); const endCalibration = () => { + useCameraSettingsStore().stopCalibrationSnapshotLoop(); calibSuccess.value = undefined; calibEndpointFail.value = false; @@ -505,6 +506,7 @@ const setSelectedVideoFormat = (format: VideoFormat) => { { useStateStore().calibrationData.hasEnoughImages ? "Finish Calibration" : "Cancel Calibration" }} + + mdi-autorenew + Start Snapshot Loop + diff --git a/photon-client/src/stores/settings/CameraSettingsStore.ts b/photon-client/src/stores/settings/CameraSettingsStore.ts index 32c3f94edf..8670dc270c 100644 --- a/photon-client/src/stores/settings/CameraSettingsStore.ts +++ b/photon-client/src/stores/settings/CameraSettingsStore.ts @@ -422,6 +422,32 @@ export const useCameraSettingsStore = defineStore("cameraSettings", { }; useStateStore().websocket?.send(payload, true); }, + + /** + * Start repeatedly calling takeCalibrationSnapshot every intervalMs milliseconds. + * No-op if already running. Call stopCalibrationSnapshotLoop() to stop. + * + * @param intervalMs interval in milliseconds between snapshots (default 1000) + * @param cameraUniqueName camera to snapshot (captured when the loop starts) + */ + startCalibrationSnapshotLoop(intervalMs = 500, cameraUniqueName: string = useStateStore().currentCameraUniqueName) { + // store the interval id on the store instance (avoid changing state shape) + if ((this as any)._calibrationSnapshotInterval != null) return; + // take one immediately then schedule + this.takeCalibrationSnapshot(cameraUniqueName); + (this as any)._calibrationSnapshotInterval = window.setInterval(() => { + this.takeCalibrationSnapshot(cameraUniqueName); + }, intervalMs); + }, + + /** + * Stop a running calibration snapshot loop started with startCalibrationSnapshotLoop(). + */ + stopCalibrationSnapshotLoop() { + if ((this as any)._calibrationSnapshotInterval == null) return; + clearInterval((this as any)._calibrationSnapshotInterval); + (this as any)._calibrationSnapshotInterval = null; + }, /** * Save a snapshot of the input frame of the camera. * From 7284ec24b5e9e25e88692dfe5eebb6a55e3a888f Mon Sep 17 00:00:00 2001 From: samfreund Date: Wed, 22 Oct 2025 22:08:33 -0500 Subject: [PATCH 2/2] add docs --- docs/source/docs/calibration/calibration.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/source/docs/calibration/calibration.md b/docs/source/docs/calibration/calibration.md index 874e701d9d..6f442623f2 100644 --- a/docs/source/docs/calibration/calibration.md +++ b/docs/source/docs/calibration/calibration.md @@ -55,7 +55,11 @@ We'll next select a resolution to calibrate and populate our pattern spacing, ma If you have a [calib.io](https://calib.io/) CharuCo Target you will have to enter the paramaters of your target. For example if your target says "9x12 | Checker Size: 30 mm | Marker Size: 22 mm | Dictionary: AruCo DICT 5x5", you would have to set the board type to Dict_5x5_1000, the pattern spacing to 1.1811 in (30 mm converted to inches), the marker size 0.866142 in (22 mm converted to inches), the board width to 12 and the board height to 9. If you chose the wrong tag family the board wont be detected during calibration. If you swap the width and height your calibration will have a very high error. ::: -### 4. Take at calibration images from various angles. +::{note} +Using the `Snapshot Loop` feature can help speed up the image capture process. This feature will continuously take snapshots at a set interval until the user stops it. This is useful for capturing images from different angles quickly without having to manually click the snapshot button each time. +::: + +### 4. Take calibration images from various angles. Now, we'll capture images of our board from various angles. It's important to check that the board overlay matches the board in your image. The further the overdrawn points are from the true position of the chessboard corners, the less accurate the final calibration will be. We'll want to capture enough images to cover the whole camera's FOV (with a minimum of 12). Once we've got our images, we'll click "Finish calibration" and wait for the calibration process to complete. If all goes well, the mean error and FOVs will be shown in the table on the right. The FOV should be close to the camera's specified FOV (usually found in a datasheet) usually within + or - 10 degrees. The mean error should also be low, usually less than 1 pixel.