Skip to content

Commit 8807195

Browse files
GGreenixmcm001
authored andcommitted
working cropping with fixed WPI tag detection
1 parent 44f78cb commit 8807195

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+680
-779
lines changed

photon-client/src/App.vue

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -76,24 +76,6 @@ if (!is_demo) {
7676
}
7777
}
7878
79-
/* Custom scrollbar styles */
80-
::-webkit-scrollbar {
81-
width: 12px;
82-
}
83-
84-
::-webkit-scrollbar-track {
85-
background: #232c37;
86-
}
87-
88-
::-webkit-scrollbar-thumb {
89-
background-color: #ffd843;
90-
border-radius: 10px;
91-
}
92-
93-
::-webkit-scrollbar-thumb:hover {
94-
background-color: #e4c33c;
95-
}
96-
9779
.main-container {
9880
background-color: #232c37;
9981
padding: 0 !important;

photon-client/src/components/app/photon-camera-stream.vue

Lines changed: 7 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -11,41 +11,27 @@ const props = defineProps<{
1111
id: string;
1212
}>();
1313
14-
const emptyStreamSrc = "//:0";
1514
const streamSrc = computed<string>(() => {
1615
const port =
1716
useCameraSettingsStore().currentCameraSettings.stream[props.streamType === "Raw" ? "inputPort" : "outputPort"];
1817
1918
if (!useStateStore().backendConnected || port === 0) {
20-
return emptyStreamSrc;
19+
return loadingImage;
2120
}
2221
2322
return `http://${inject("backendHostname")}:${port}/stream.mjpg`;
2423
});
2524
const streamDesc = computed<string>(() => `${props.streamType} Stream View`);
2625
const streamStyle = computed<StyleValue>(() => {
2726
if (useStateStore().colorPickingMode) {
28-
return { cursor: "crosshair" };
27+
return { width: "100%", cursor: "crosshair" };
2928
}
3029
31-
return {};
32-
});
33-
34-
const containerStyle = computed<StyleValue>(() => {
35-
const resolution = useCameraSettingsStore().currentVideoFormat.resolution;
36-
const rotation = useCameraSettingsStore().currentPipelineSettings.inputImageRotationMode;
37-
if (rotation === 1 || rotation === 3) {
38-
return {
39-
aspectRatio: `${resolution.height}/${resolution.width}`
40-
};
41-
}
42-
return {
43-
aspectRatio: `${resolution.width}/${resolution.height}`
44-
};
30+
return { width: "100%" };
4531
});
4632
4733
const overlayStyle = computed<StyleValue>(() => {
48-
if (useStateStore().colorPickingMode || streamSrc.value == emptyStreamSrc) {
34+
if (useStateStore().colorPickingMode || streamSrc.value == loadingImage) {
4935
return { display: "none" };
5036
} else {
5137
return {};
@@ -71,23 +57,13 @@ const handleFullscreenRequest = () => {
7157
const mjpgStream: any = ref(null);
7258
onBeforeUnmount(() => {
7359
if (!mjpgStream.value) return;
74-
mjpgStream.value["src"] = emptyStreamSrc;
60+
mjpgStream.value["src"] = "//:0";
7561
});
7662
</script>
7763

7864
<template>
79-
<div class="stream-container" :style="containerStyle">
80-
<img :src="loadingImage" class="stream-loading" />
81-
<img
82-
v-show="streamSrc !== emptyStreamSrc"
83-
:id="id"
84-
ref="mjpgStream"
85-
class="stream-video"
86-
crossorigin="anonymous"
87-
:src="streamSrc"
88-
:alt="streamDesc"
89-
:style="streamStyle"
90-
/>
65+
<div class="stream-container">
66+
<img :id="id" ref="mjpgStream" crossorigin="anonymous" :src="streamSrc" :alt="streamDesc" :style="streamStyle" />
9167
<div class="stream-overlay" :style="overlayStyle">
9268
<pv-icon
9369
icon-name="mdi-camera-image"
@@ -113,21 +89,7 @@ onBeforeUnmount(() => {
11389

11490
<style scoped>
11591
.stream-container {
116-
display: flex;
11792
position: relative;
118-
width: 100%;
119-
}
120-
121-
.stream-loading {
122-
position: absolute;
123-
width: 100%;
124-
height: 100%;
125-
}
126-
127-
.stream-video {
128-
position: absolute;
129-
width: 100%;
130-
height: 100%;
13193
}
13294
13395
.stream-overlay {

photon-client/src/components/app/photon-log-view.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const logs = computed<LogMessage[]>(() =>
2727
selectedLogLevels.value[message.level] &&
2828
message.message.toLowerCase().includes(searchQuery.value?.toLowerCase() || "") &&
2929
(timeInput.value === undefined ||
30-
message.timestamp.getTime() >=
30+
message.timestamp >=
3131
new Date().setHours(
3232
parseInt(timeInput.value.substring(0, 2)),
3333
parseInt(timeInput.value.substring(3, 5)),

photon-client/src/components/cameras/CameraCalibrationCard.vue

Lines changed: 27 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,15 @@ const patternHeight = ref(8);
8181
const boardType = ref<CalibrationBoardTypes>(CalibrationBoardTypes.Charuco);
8282
const useOldPattern = ref(false);
8383
const tagFamily = ref<CalibrationTagFamilies>(CalibrationTagFamilies.Dict_4X4_1000);
84-
85-
// Emperical testing - with stack size limit of 1MB, we can handle at -least- 700k points
86-
const tooManyPoints = computed(
87-
() => useStateStore().calibrationData.imageCount * patternWidth.value * patternHeight.value > 700000
88-
);
84+
const useMrCalRef = ref(true);
85+
const useMrCal = computed<boolean>({
86+
get() {
87+
return useMrCalRef.value && useSettingsStore().general.mrCalWorking;
88+
},
89+
set(value) {
90+
useMrCalRef.value = value && useSettingsStore().general.mrCalWorking;
91+
}
92+
});
8993
9094
const downloadCalibBoard = () => {
9195
const doc = new JsPDF({ unit: "in", format: "letter" });
@@ -165,6 +169,7 @@ const startCalibration = () => {
165169
patternHeight: patternHeight.value,
166170
patternWidth: patternWidth.value,
167171
boardType: boardType.value,
172+
useMrCal: useMrCal.value,
168173
useOldPattern: useOldPattern.value,
169174
tagFamily: tagFamily.value
170175
});
@@ -196,8 +201,6 @@ const endCalibration = () => {
196201
});
197202
};
198203
199-
let drawAllSnapshots = ref(true);
200-
201204
let showCalDialog = ref(false);
202205
let selectedVideoFormat = ref<VideoFormat | undefined>(undefined);
203206
const setSelectedVideoFormat = (format: VideoFormat) => {
@@ -248,7 +251,7 @@ const setSelectedVideoFormat = (format: VideoFormat) => {
248251
<pv-select
249252
v-model="useStateStore().calibrationData.videoFormatIndex"
250253
label="Resolution"
251-
:select-cols="8"
254+
:select-cols="7"
252255
:disabled="isCalibrating"
253256
tooltip="Resolution to calibrate at (you will have to calibrate every resolution you use 3D mode on)"
254257
:items="getUniqueVideoResolutionStrings()"
@@ -259,14 +262,14 @@ const setSelectedVideoFormat = (format: VideoFormat) => {
259262
label="Decimation"
260263
tooltip="Resolution to which camera frames are downscaled for detection. Calibration still uses full-res"
261264
:items="calibrationDivisors"
262-
:select-cols="8"
265+
:select-cols="7"
263266
@input="(v) => useCameraSettingsStore().changeCurrentPipelineSetting({ streamingFrameDivisor: v }, false)"
264267
/>
265268
<pv-select
266269
v-model="boardType"
267270
label="Board Type"
268271
tooltip="Calibration board pattern to use"
269-
:select-cols="8"
272+
:select-cols="7"
270273
:items="['Chessboard', 'Charuco']"
271274
:disabled="isCalibrating"
272275
/>
@@ -275,7 +278,7 @@ const setSelectedVideoFormat = (format: VideoFormat) => {
275278
v-model="tagFamily"
276279
label="Tag Family"
277280
tooltip="Dictionary of aruco markers on the charuco board"
278-
:select-cols="8"
281+
:select-cols="7"
279282
:items="['Dict_4X4_1000', 'Dict_5X5_1000', 'Dict_6X6_1000', 'Dict_7X7_1000']"
280283
:disabled="isCalibrating"
281284
/>
@@ -285,7 +288,7 @@ const setSelectedVideoFormat = (format: VideoFormat) => {
285288
tooltip="Spacing between pattern features in inches"
286289
:disabled="isCalibrating"
287290
:rules="[(v) => v > 0 || 'Size must be positive']"
288-
:label-cols="4"
291+
:label-cols="5"
289292
/>
290293
<pv-number-input
291294
v-show="boardType == CalibrationBoardTypes.Charuco"
@@ -294,42 +297,39 @@ const setSelectedVideoFormat = (format: VideoFormat) => {
294297
tooltip="Size of the tag markers in inches must be smaller than pattern spacing"
295298
:disabled="isCalibrating"
296299
:rules="[(v) => v > 0 || 'Size must be positive']"
297-
:label-cols="4"
300+
:label-cols="5"
298301
/>
299302
<pv-number-input
300303
v-model="patternWidth"
301304
label="Board Width (squares)"
302305
tooltip="Width of the board in dots or chessboard squares"
303306
:disabled="isCalibrating"
304307
:rules="[(v) => v >= 4 || 'Width must be at least 4']"
305-
:label-cols="4"
308+
:label-cols="5"
306309
/>
307310
<pv-number-input
308311
v-model="patternHeight"
309312
label="Board Height (squares)"
310313
tooltip="Height of the board in dots or chessboard squares"
311314
:disabled="isCalibrating"
312315
:rules="[(v) => v >= 4 || 'Height must be at least 4']"
313-
:label-cols="4"
316+
:label-cols="5"
314317
/>
315318
<pv-switch
316319
v-show="boardType == CalibrationBoardTypes.Charuco"
317320
v-model="useOldPattern"
318321
label="Old OpenCV Pattern"
319322
:disabled="isCalibrating"
320323
tooltip="If enabled, Photon will use the old OpenCV pattern for calibration."
321-
:label-cols="4"
324+
:label-cols="5"
325+
/>
326+
<pv-switch
327+
v-model="useMrCal"
328+
label="Try using MrCal over OpenCV"
329+
:disabled="!useSettingsStore().general.mrCalWorking || isCalibrating"
330+
tooltip="If enabled, Photon will (try to) use MrCal instead of OpenCV for camera calibration."
331+
:label-cols="5"
322332
/>
323-
<v-banner
324-
v-show="useSettingsStore().general.mrCalWorking"
325-
rounded
326-
color="secondary"
327-
text-color="white"
328-
class="mt-3"
329-
icon="mdi-alert-circle-outline"
330-
>
331-
Mrcal was successfully loaded, and will be used!
332-
</v-banner>
333333
<v-banner
334334
v-show="!useSettingsStore().general.mrCalWorking"
335335
rounded
@@ -418,17 +418,12 @@ const setSelectedVideoFormat = (format: VideoFormat) => {
418418
</v-col>
419419
</v-row>
420420
<v-row>
421-
<v-col v-if="tooManyPoints" :cols="12">
422-
<v-banner rounded color="red" text-color="white" class="mt-3" icon="mdi-alert-circle-outline">
423-
Too many corners - finish calibration now!
424-
</v-banner>
425-
</v-col>
426421
<v-col :cols="6">
427422
<v-btn
428423
small
429424
color="secondary"
430425
style="width: 100%"
431-
:disabled="!settingsValid || tooManyPoints"
426+
:disabled="!settingsValid"
432427
@click="isCalibrating ? useCameraSettingsStore().takeCalibrationSnapshot() : startCalibration()"
433428
>
434429
<v-icon left class="calib-btn-icon"> {{ isCalibrating ? "mdi-camera" : "mdi-flag-outline" }} </v-icon>
@@ -468,16 +463,6 @@ const setSelectedVideoFormat = (format: VideoFormat) => {
468463
</v-btn>
469464
</v-col>
470465
</v-row>
471-
<v-row v-if="isCalibrating" style="display: flex; flex-direction: column">
472-
<pv-switch
473-
v-model="drawAllSnapshots"
474-
class="pt-2"
475-
label="Draw Collected Corners"
476-
:switch-cols="8"
477-
tooltip="Draw all snapshots"
478-
@input="(args) => useCameraSettingsStore().changeCurrentPipelineSetting({ drawAllSnapshots: args }, false)"
479-
/>
480-
</v-row>
481466
</div>
482467
</v-card>
483468
<v-dialog v-model="showCalibEndDialog" width="500px" :persistent="true">

0 commit comments

Comments
 (0)