diff --git a/docs/source/docs/quick-start/camera-focusing.md b/docs/source/docs/quick-start/camera-focusing.md new file mode 100644 index 000000000..f9498bd57 --- /dev/null +++ b/docs/source/docs/quick-start/camera-focusing.md @@ -0,0 +1,19 @@ +# Camera Focusing + +## Prepare Camera +:::{warning} +Refocusing your camera **will** make your calibration inaccurate, make sure to recalibrate after focusing. +::: +To ensure that your camera is focused properly, mount it to a secure surface and ensure it does not move drastically. Point your camera at a detailed surface like a calibration board, and make sure that it not too close to the camera. + +## Using Focus Mode +:::{important} +When you enable Focus Mode, it will assign a *Score* to the current focus, this score depends on your environment and the lighting. This score cannot be compared to a focus score collected from other environments. +::: +- In the Cameras tab, turn on Focus Mode. +- Rotate the lens on your camera to try and get the focus score as high as possible. +- Once you cannot get a higher score, this indicates that your camera is fully focused and can be set in place using glue if desired. + +```{image} images/focusModeExample.png +:scale: 50% +``` diff --git a/docs/source/docs/quick-start/images/focusModeExample.png b/docs/source/docs/quick-start/images/focusModeExample.png new file mode 100644 index 000000000..2ba492c2e Binary files /dev/null and b/docs/source/docs/quick-start/images/focusModeExample.png differ diff --git a/docs/source/docs/quick-start/index.md b/docs/source/docs/quick-start/index.md index 4b9a97e3d..7302ff93c 100644 --- a/docs/source/docs/quick-start/index.md +++ b/docs/source/docs/quick-start/index.md @@ -9,5 +9,6 @@ wiring networking camera-matching camera-calibration +camera-focusing quick-configure ``` diff --git a/photon-client/src/components/cameras/CameraSettingsCard.vue b/photon-client/src/components/cameras/CameraSettingsCard.vue index c819b60c2..cfab1a0e1 100644 --- a/photon-client/src/components/cameras/CameraSettingsCard.vue +++ b/photon-client/src/components/cameras/CameraSettingsCard.vue @@ -2,6 +2,7 @@ import PvSelect, { type SelectItem } from "@/components/common/pv-select.vue"; import PvInput from "@/components/common/pv-input.vue"; import PvNumberInput from "@/components/common/pv-number-input.vue"; +import PvSwitch from "@/components/common/pv-switch.vue"; import { useCameraSettingsStore } from "@/stores/settings/CameraSettingsStore"; import { useStateStore } from "@/stores/StateStore"; import { computed, ref, watchEffect } from "vue"; @@ -15,7 +16,14 @@ const tempSettingsStruct = ref({ fov: useCameraSettingsStore().currentCameraSettings.fov.value, quirksToChange: Object.assign({}, useCameraSettingsStore().currentCameraSettings.cameraQuirks.quirks) }); - +const focusMode = computed({ + get: () => useCameraSettingsStore().isFocusMode, + set: (v) => + useCameraSettingsStore().changeCurrentPipelineIndex( + v ? -3 : useCameraSettingsStore().currentCameraSettings.lastPipelineIndex || 0, + true + ) +}); const arducamSelectWrapper = computed({ get: () => { if (tempSettingsStruct.value.quirksToChange.ArduOV9281Controls) return 1; @@ -166,6 +174,11 @@ const wrappedCameras = computed(() => ]" :select-cols="8" /> + diff --git a/photon-client/src/components/cameras/CamerasView.vue b/photon-client/src/components/cameras/CamerasView.vue index d34df4223..6510bae02 100644 --- a/photon-client/src/components/cameras/CamerasView.vue +++ b/photon-client/src/components/cameras/CamerasView.vue @@ -58,6 +58,15 @@ const fpsTooLow = computed(() => { Camera not connected + + Focus: {{ Math.round(useStateStore().currentPipelineResults?.focus || 0) }} + (() => { color="buttonPassive" class="fill" :variant="theme.global.name.value === 'LightTheme' ? 'elevated' : 'outlined'" - :disabled="useCameraSettingsStore().isDriverMode || useCameraSettingsStore().isCalibrationMode" + :disabled=" + useCameraSettingsStore().isDriverMode || + useCameraSettingsStore().isCalibrationMode || + useCameraSettingsStore().isFocusMode + " > mdi-import Raw @@ -104,7 +117,11 @@ const fpsTooLow = computed(() => { color="buttonPassive" class="fill" :variant="theme.global.name.value === 'LightTheme' ? 'elevated' : 'outlined'" - :disabled="useCameraSettingsStore().isDriverMode || useCameraSettingsStore().isCalibrationMode" + :disabled=" + useCameraSettingsStore().isDriverMode || + useCameraSettingsStore().isCalibrationMode || + useCameraSettingsStore().isFocusMode + " > mdi-export Processed diff --git a/photon-client/src/components/dashboard/CameraAndPipelineSelectCard.vue b/photon-client/src/components/dashboard/CameraAndPipelineSelectCard.vue index 225535c42..215e0f6ff 100644 --- a/photon-client/src/components/dashboard/CameraAndPipelineSelectCard.vue +++ b/photon-client/src/components/dashboard/CameraAndPipelineSelectCard.vue @@ -92,6 +92,9 @@ const pipelineNamesWrapper = computed(() => { if (useCameraSettingsStore().isDriverMode) { pipelineNames.push({ name: "Driver Mode", value: WebsocketPipelineType.DriverMode }); } + if (useCameraSettingsStore().isFocusMode) { + pipelineNames.push({ name: "Focus Mode", value: WebsocketPipelineType.FocusCamera }); + } if (useCameraSettingsStore().isCalibrationMode) { pipelineNames.push({ name: "3D Calibration Mode", value: WebsocketPipelineType.Calib3d }); } @@ -177,6 +180,9 @@ const pipelineTypesWrapper = computed<{ name: string; value: number }[]>(() => { if (useCameraSettingsStore().isDriverMode) { pipelineTypes.push({ name: "Driver Mode", value: WebsocketPipelineType.DriverMode }); } + if (useCameraSettingsStore().isFocusMode) { + pipelineTypes.push({ name: "Focus Mode", value: WebsocketPipelineType.FocusCamera }); + } if (useCameraSettingsStore().isCalibrationMode) { pipelineTypes.push({ name: "3D Calibration Mode", value: WebsocketPipelineType.Calib3d }); } @@ -187,6 +193,7 @@ const pipelineType = ref(useCameraSettingsStore().current const currentPipelineType = computed({ get: () => { if (useCameraSettingsStore().isDriverMode) return WebsocketPipelineType.DriverMode; + if (useCameraSettingsStore().isFocusMode) return WebsocketPipelineType.FocusCamera; if (useCameraSettingsStore().isCalibrationMode) return WebsocketPipelineType.Calib3d; return pipelineType.value; }, @@ -290,6 +297,7 @@ const wrappedCameras = computed(() => tooltip="Each pipeline runs on a camera output and stores a unique set of processing settings" :disabled=" useCameraSettingsStore().isDriverMode || + useCameraSettingsStore().isFocusMode || useCameraSettingsStore().isCalibrationMode || !useCameraSettingsStore().hasConnected " @@ -366,6 +374,7 @@ const wrappedCameras = computed(() => tooltip="Changes the pipeline type, which changes the type of processing that will happen on input frames" :disabled=" useCameraSettingsStore().isDriverMode || + useCameraSettingsStore().isFocusMode || useCameraSettingsStore().isCalibrationMode || !useCameraSettingsStore().hasConnected " diff --git a/photon-client/src/components/dashboard/StreamConfigCard.vue b/photon-client/src/components/dashboard/StreamConfigCard.vue index ad0e88617..38e031e93 100644 --- a/photon-client/src/components/dashboard/StreamConfigCard.vue +++ b/photon-client/src/components/dashboard/StreamConfigCard.vue @@ -21,7 +21,9 @@ const processingMode = computed({