From dad7f0a82d2ce9780dcae931ee1c1c09f802f908 Mon Sep 17 00:00:00 2001 From: Sam Freund Date: Sun, 2 Nov 2025 15:17:22 -0600 Subject: [PATCH] Add support for removing calib coefficients (#2150) ## Description Adds the ability to remove old calibrations. This might be helpful if you have a bad calibration. closes #1262 ## Meta Merge checklist: - [x] Pull Request title is [short, imperative summary](https://cbea.ms/git-commit/) of proposed changes - [x] The description documents the _what_ and _why_ - [ ] If this PR changes behavior or adds a feature, user documentation is updated - [ ] If this PR touches photon-serde, all messages have been regenerated and hashes have not changed unexpectedly - [ ] If this PR touches configuration, this is backwards compatible with settings back to v2025.3.2 - [ ] If this PR touches pipeline settings or anything related to data exchange, the frontend typing is updated - [ ] If this PR addresses a bug, a regression test for it is added --------- Co-authored-by: Gold856 <117957790+Gold856@users.noreply.github.com> --- .../cameras/CameraCalibrationInfoCard.vue | 65 ++++++++++++++++--- .../configuration/CameraConfiguration.java | 18 +++++ .../vision/processes/VisionModule.java | 10 +++ .../processes/VisionSourceSettables.java | 6 ++ .../photonvision/server/RequestHandler.java | 41 ++++++++++++ .../java/org/photonvision/server/Server.java | 1 + 6 files changed, 133 insertions(+), 8 deletions(-) diff --git a/photon-client/src/components/cameras/CameraCalibrationInfoCard.vue b/photon-client/src/components/cameras/CameraCalibrationInfoCard.vue index 166820227..b92734fde 100644 --- a/photon-client/src/components/cameras/CameraCalibrationInfoCard.vue +++ b/photon-client/src/components/cameras/CameraCalibrationInfoCard.vue @@ -3,7 +3,7 @@ import type { CameraCalibrationResult, VideoFormat } from "@/types/SettingTypes" import { useCameraSettingsStore } from "@/stores/settings/CameraSettingsStore"; import { useStateStore } from "@/stores/StateStore"; import { computed, inject, ref } from "vue"; -import { getResolutionString, parseJsonFile } from "@/lib/PhotonUtils"; +import { axiosPost, getResolutionString, parseJsonFile } from "@/lib/PhotonUtils"; import { useTheme } from "vuetify"; const theme = useTheme(); @@ -12,6 +12,18 @@ const props = defineProps<{ videoFormat: VideoFormat; }>(); +const confirmRemoveDialog = ref({ show: false, vf: {} as VideoFormat }); + +const removeCalibration = (vf: VideoFormat) => { + axiosPost("/calibration/remove", "delete a camera calibration", { + cameraUniqueName: useCameraSettingsStore().currentCameraSettings.uniqueName, + width: vf.resolution.width, + height: vf.resolution.height + }); + + confirmRemoveDialog.value.show = false; +}; + const exportCalibration = ref(); const openExportCalibrationPrompt = () => { exportCalibration.value.click(); @@ -93,18 +105,30 @@ const calibrationImageURL = (index: number) =>