From 1c0d92641f4766b735c6b5b53bc05a5ef69cbb50 Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 12 Feb 2024 15:55:31 -0500 Subject: [PATCH] Check empty mean errors in calibration card (#1229) Fixes calibration card disappearing if calibdb calibration was used --- .../src/components/cameras/CameraCalibrationCard.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/photon-client/src/components/cameras/CameraCalibrationCard.vue b/photon-client/src/components/cameras/CameraCalibrationCard.vue index d9eca1a369..62dfb83ab4 100644 --- a/photon-client/src/components/cameras/CameraCalibrationCard.vue +++ b/photon-client/src/components/cameras/CameraCalibrationCard.vue @@ -26,7 +26,9 @@ const getUniqueVideoFormatsByResolution = (): VideoFormat[] => { const calib = useCameraSettingsStore().getCalibrationCoeffs(format.resolution); if (calib !== undefined) { // For each error, square it, sum the squares, and divide by total points N - format.mean = calib.meanErrors.reduce((a, b) => a + b) / calib.meanErrors.length; + if (calib.meanErrors.length) + format.mean = calib.meanErrors.reduce((a, b) => a + b, 0) / calib.meanErrors.length; + else format.mean = NaN; format.horizontalFOV = 2 * Math.atan2(format.resolution.width / 2, calib.cameraIntrinsics.data[0]) * (180 / Math.PI); @@ -256,7 +258,7 @@ const setSelectedVideoFormat = (format: VideoFormat) => { > {{ getResolutionString(value.resolution) }} - {{ value.mean !== undefined ? (isNaN(value.mean) ? "NaN" : value.mean.toFixed(2) + "px") : "-" }} + {{ value.mean !== undefined ? (isNaN(value.mean) ? "Unknown" : value.mean.toFixed(2) + "px") : "-" }} {{ value.horizontalFOV !== undefined ? value.horizontalFOV.toFixed(2) + "°" : "-" }} {{ value.verticalFOV !== undefined ? value.verticalFOV.toFixed(2) + "°" : "-" }}