2023-08-21 01:51:35 -04:00
|
|
|
<script setup lang="ts">
|
|
|
|
|
import PhotonCameraStream from "@/components/app/photon-camera-stream.vue";
|
|
|
|
|
import { computed } from "vue";
|
|
|
|
|
import { useCameraSettingsStore } from "@/stores/settings/CameraSettingsStore";
|
|
|
|
|
import { PipelineType } from "@/types/PipelineTypes";
|
|
|
|
|
import { useStateStore } from "@/stores/StateStore";
|
|
|
|
|
import { useSettingsStore } from "@/stores/settings/GeneralSettingsStore";
|
|
|
|
|
|
2025-05-06 18:21:41 -04:00
|
|
|
const value = defineModel<number[]>({ required: true });
|
2023-08-21 01:51:35 -04:00
|
|
|
|
|
|
|
|
const driverMode = computed<boolean>({
|
|
|
|
|
get: () => useCameraSettingsStore().isDriverMode,
|
2023-08-31 16:56:58 -04:00
|
|
|
set: (v) =>
|
|
|
|
|
useCameraSettingsStore().changeCurrentPipelineIndex(
|
|
|
|
|
v ? -1 : useCameraSettingsStore().currentCameraSettings.lastPipelineIndex || 0,
|
|
|
|
|
true
|
|
|
|
|
)
|
2023-08-21 01:51:35 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const fpsTooLow = computed<boolean>(() => {
|
2023-10-17 10:20:00 -04:00
|
|
|
const currFPS = useStateStore().currentPipelineResults?.fps || 0;
|
2023-08-21 01:51:35 -04:00
|
|
|
const targetFPS = useCameraSettingsStore().currentVideoFormat.fps;
|
|
|
|
|
const driverMode = useCameraSettingsStore().isDriverMode;
|
|
|
|
|
const gpuAccel = useSettingsStore().general.gpuAcceleration !== undefined;
|
|
|
|
|
const isReflective = useCameraSettingsStore().currentPipelineSettings.pipelineType === PipelineType.Reflective;
|
|
|
|
|
|
2023-08-31 16:56:58 -04:00
|
|
|
return currFPS - targetFPS < -5 && currFPS !== 0 && !driverMode && gpuAccel && isReflective;
|
2023-08-21 01:51:35 -04:00
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
2025-01-07 08:45:39 -05:00
|
|
|
<v-card id="camera-settings-camera-view-card" class="camera-settings-camera-view-card" color="primary" dark>
|
|
|
|
|
<v-card-title class="justify-space-between align-content-center pa-0 pl-6 pr-6">
|
|
|
|
|
<div class="d-flex flex-wrap pt-4 pb-4">
|
2023-08-21 01:51:35 -04:00
|
|
|
<div>
|
2023-08-31 16:56:58 -04:00
|
|
|
<span class="mr-4" style="white-space: nowrap"> Cameras </span>
|
2023-08-21 01:51:35 -04:00
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<v-chip
|
2025-01-01 03:04:20 -05:00
|
|
|
v-if="useCameraSettingsStore().currentCameraSettings.isConnected"
|
2023-08-21 01:51:35 -04:00
|
|
|
label
|
|
|
|
|
:color="fpsTooLow ? 'error' : 'transparent'"
|
2023-08-31 16:56:58 -04:00
|
|
|
style="font-size: 1rem; padding: 0; margin: 0"
|
2023-08-21 01:51:35 -04:00
|
|
|
>
|
2025-05-06 18:21:41 -04:00
|
|
|
<span class="pr-1" :style="{ color: fpsTooLow ? '#C7EA46' : '#ff4d00' }">
|
2023-10-17 10:20:00 -04:00
|
|
|
{{ Math.round(useStateStore().currentPipelineResults?.fps || 0) }} FPS –
|
|
|
|
|
{{ Math.min(Math.round(useStateStore().currentPipelineResults?.latency || 0), 9999) }} ms latency
|
2023-08-21 01:51:35 -04:00
|
|
|
</span>
|
|
|
|
|
</v-chip>
|
2025-05-06 18:21:41 -04:00
|
|
|
<v-chip v-else label color="red" variant="text" style="font-size: 1rem; padding: 0; margin: 0">
|
2025-01-07 08:45:39 -05:00
|
|
|
<span class="pr-1">Camera not connected</span>
|
2025-01-01 03:04:20 -05:00
|
|
|
</v-chip>
|
2023-08-21 01:51:35 -04:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2025-01-07 08:45:39 -05:00
|
|
|
<div class="d-flex align-center">
|
2023-08-21 01:51:35 -04:00
|
|
|
<v-switch
|
|
|
|
|
v-model="driverMode"
|
2023-10-21 10:46:53 -04:00
|
|
|
:disabled="useCameraSettingsStore().isCalibrationMode || useCameraSettingsStore().pipelineNames.length === 0"
|
2023-08-21 01:51:35 -04:00
|
|
|
label="Driver Mode"
|
2023-08-31 16:56:58 -04:00
|
|
|
style="margin-left: auto"
|
2023-08-21 01:51:35 -04:00
|
|
|
color="accent"
|
2025-01-07 08:45:39 -05:00
|
|
|
class="pt-2 pb-2"
|
|
|
|
|
hide-details="auto"
|
2023-08-21 01:51:35 -04:00
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</v-card-title>
|
2025-01-07 08:45:39 -05:00
|
|
|
<v-card-text class="stream-container">
|
2023-08-21 01:51:35 -04:00
|
|
|
<div class="stream">
|
2023-11-20 21:24:49 -05:00
|
|
|
<photon-camera-stream
|
2024-10-05 22:26:14 -07:00
|
|
|
v-if="value.includes(0)"
|
2023-11-20 21:24:49 -05:00
|
|
|
id="input-camera-stream"
|
2025-01-01 03:04:20 -05:00
|
|
|
:camera-settings="useCameraSettingsStore().currentCameraSettings"
|
2023-11-20 21:24:49 -05:00
|
|
|
stream-type="Raw"
|
|
|
|
|
style="max-width: 100%"
|
|
|
|
|
/>
|
2023-08-21 01:51:35 -04:00
|
|
|
</div>
|
|
|
|
|
<div class="stream">
|
2023-11-20 21:24:49 -05:00
|
|
|
<photon-camera-stream
|
2024-10-05 22:26:14 -07:00
|
|
|
v-if="value.includes(1)"
|
2023-11-20 21:24:49 -05:00
|
|
|
id="output-camera-stream"
|
2025-01-01 03:04:20 -05:00
|
|
|
:camera-settings="useCameraSettingsStore().currentCameraSettings"
|
2023-11-20 21:24:49 -05:00
|
|
|
stream-type="Processed"
|
|
|
|
|
style="max-width: 100%"
|
|
|
|
|
/>
|
2023-08-21 01:51:35 -04:00
|
|
|
</div>
|
2025-01-07 08:45:39 -05:00
|
|
|
</v-card-text>
|
|
|
|
|
<v-card-text class="pt-0">
|
2025-05-06 18:21:41 -04:00
|
|
|
<v-btn-toggle
|
|
|
|
|
v-model="value"
|
|
|
|
|
:multiple="true"
|
|
|
|
|
mandatory
|
|
|
|
|
class="fill"
|
|
|
|
|
style="width: 100%"
|
|
|
|
|
base-color="surface-variant"
|
|
|
|
|
>
|
2023-08-21 01:51:35 -04:00
|
|
|
<v-btn
|
|
|
|
|
color="secondary"
|
|
|
|
|
class="fill"
|
|
|
|
|
:disabled="useCameraSettingsStore().isDriverMode || useCameraSettingsStore().isCalibrationMode"
|
|
|
|
|
>
|
2025-05-06 18:21:41 -04:00
|
|
|
<v-icon start class="mode-btn-icon">mdi-import</v-icon>
|
2024-01-02 11:03:16 -05:00
|
|
|
<span class="mode-btn-label">Raw</span>
|
2023-08-21 01:51:35 -04:00
|
|
|
</v-btn>
|
|
|
|
|
<v-btn
|
|
|
|
|
color="secondary"
|
|
|
|
|
class="fill"
|
|
|
|
|
:disabled="useCameraSettingsStore().isDriverMode || useCameraSettingsStore().isCalibrationMode"
|
|
|
|
|
>
|
2025-05-06 18:21:41 -04:00
|
|
|
<v-icon start class="mode-btn-icon">mdi-export</v-icon>
|
2024-01-02 11:03:16 -05:00
|
|
|
<span class="mode-btn-label">Processed</span>
|
2023-08-21 01:51:35 -04:00
|
|
|
</v-btn>
|
|
|
|
|
</v-btn-toggle>
|
2025-01-07 08:45:39 -05:00
|
|
|
</v-card-text>
|
2023-08-21 01:51:35 -04:00
|
|
|
</v-card>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
.v-btn-toggle.fill {
|
|
|
|
|
width: 100%;
|
|
|
|
|
}
|
|
|
|
|
.v-btn-toggle.fill > .v-btn {
|
|
|
|
|
width: 50%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
}
|
|
|
|
|
th {
|
|
|
|
|
width: 80px;
|
|
|
|
|
text-align: center;
|
|
|
|
|
}
|
|
|
|
|
|
2025-01-08 16:46:31 -05:00
|
|
|
.v-input--switch {
|
|
|
|
|
margin-top: 0;
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-21 01:51:35 -04:00
|
|
|
.stream-container {
|
|
|
|
|
display: flex;
|
2023-10-21 11:09:55 -04:00
|
|
|
justify-content: center;
|
2023-08-21 01:51:35 -04:00
|
|
|
flex-wrap: wrap;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 12px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.stream {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
2024-10-05 22:26:14 -07:00
|
|
|
width: 100%;
|
2023-08-21 01:51:35 -04:00
|
|
|
}
|
|
|
|
|
|
2024-03-21 15:39:07 -04:00
|
|
|
@media only screen and (min-width: 960px) {
|
|
|
|
|
#camera-settings-camera-view-card {
|
|
|
|
|
position: sticky;
|
|
|
|
|
top: 12px;
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-08-21 01:51:35 -04:00
|
|
|
@media only screen and (min-width: 512px) and (max-width: 960px) {
|
|
|
|
|
.stream-container {
|
|
|
|
|
flex-wrap: nowrap;
|
2023-10-17 09:08:25 -04:00
|
|
|
justify-content: center;
|
2023-08-21 01:51:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.stream {
|
2023-10-17 09:08:25 -04:00
|
|
|
max-width: 50%;
|
2023-08-21 01:51:35 -04:00
|
|
|
}
|
|
|
|
|
}
|
2024-01-02 11:03:16 -05:00
|
|
|
@media only screen and (max-width: 351px) {
|
|
|
|
|
.mode-btn-icon {
|
|
|
|
|
margin: 0 !important;
|
|
|
|
|
}
|
|
|
|
|
.mode-btn-label {
|
|
|
|
|
display: none;
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-08-21 01:51:35 -04:00
|
|
|
</style>
|