mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-19 00:41:41 +00:00
Raise minimum images for calibration to 100 (#2437)
This commit is contained in:
@@ -242,7 +242,7 @@ const endCalibration = () => {
|
||||
calibSuccess.value = undefined;
|
||||
calibEndpointFail.value = false;
|
||||
|
||||
if (!useStateStore().calibrationData.hasEnoughImages) {
|
||||
if (!hasEnoughImages.value) {
|
||||
calibCanceled.value = true;
|
||||
}
|
||||
|
||||
@@ -270,6 +270,10 @@ const endCalibration = () => {
|
||||
|
||||
const drawAllSnapshots = ref(true);
|
||||
|
||||
const bypassVal = ref(false);
|
||||
const minCount = computed(() => (bypassVal.value ? 10 : 100));
|
||||
const hasEnoughImages = computed(() => useStateStore().calibrationData.imageCount >= minCount.value);
|
||||
|
||||
const showCalDialog = ref(false);
|
||||
const selectedVideoFormat = ref<VideoFormat | undefined>(undefined);
|
||||
const setSelectedVideoFormat = (format: VideoFormat) => {
|
||||
@@ -540,11 +544,22 @@ const setSelectedVideoFormat = (format: VideoFormat) => {
|
||||
<v-chip
|
||||
:variant="theme.global.current.value.dark ? 'tonal' : 'elevated'"
|
||||
label
|
||||
:color="useStateStore().calibrationData.hasEnoughImages ? 'buttonPassive' : 'light-grey'"
|
||||
:color="hasEnoughImages ? 'buttonPassive' : 'light-grey'"
|
||||
>
|
||||
Snapshots: {{ useStateStore().calibrationData.imageCount }} of at least
|
||||
{{ useStateStore().calibrationData.minimumImageCount }}
|
||||
{{ minCount }}
|
||||
</v-chip>
|
||||
<v-spacer />
|
||||
<pv-switch
|
||||
v-model="bypassVal"
|
||||
color="error"
|
||||
hide-details
|
||||
class="ml-4"
|
||||
label="Bypass minimum"
|
||||
:label-cols="6"
|
||||
:switch-cols="6"
|
||||
tooltip="Bypass the minimum recommended amount of snapshots for a calibration. Should only be used for dev work or temporary tests not competitions. Still requires 10 images to calibrate."
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<v-btn
|
||||
@@ -589,16 +604,14 @@ const setSelectedVideoFormat = (format: VideoFormat) => {
|
||||
size="small"
|
||||
block
|
||||
:variant="theme.global.current.value.dark ? 'outlined' : 'elevated'"
|
||||
:color="useStateStore().calibrationData.hasEnoughImages ? 'buttonActive' : 'error'"
|
||||
:color="hasEnoughImages ? 'buttonActive' : 'error'"
|
||||
:disabled="!isCalibrating || !settingsValid"
|
||||
@click="endCalibration"
|
||||
>
|
||||
<v-icon start class="calib-btn-icon" size="large">
|
||||
{{ useStateStore().calibrationData.hasEnoughImages ? "mdi-flag-checkered" : "mdi-flag-off-outline" }}
|
||||
{{ hasEnoughImages ? "mdi-flag-checkered" : "mdi-flag-off-outline" }}
|
||||
</v-icon>
|
||||
<span class="calib-btn-label">{{
|
||||
useStateStore().calibrationData.hasEnoughImages ? "Finish Calibration" : "Cancel Calibration"
|
||||
}}</span>
|
||||
<span class="calib-btn-label">{{ hasEnoughImages ? "Finish Calibration" : "Cancel Calibration" }}</span>
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</div>
|
||||
|
||||
@@ -40,8 +40,6 @@ interface StateStore {
|
||||
calibrationData: {
|
||||
imageCount: number;
|
||||
videoFormatIndex: number;
|
||||
minimumImageCount: number;
|
||||
hasEnoughImages: boolean;
|
||||
};
|
||||
|
||||
snackbarData: {
|
||||
@@ -89,9 +87,7 @@ export const useStateStore = defineStore("state", {
|
||||
|
||||
calibrationData: {
|
||||
imageCount: 0,
|
||||
videoFormatIndex: 0,
|
||||
minimumImageCount: 12,
|
||||
hasEnoughImages: false
|
||||
videoFormatIndex: 0
|
||||
},
|
||||
|
||||
snackbarData: {
|
||||
@@ -162,9 +158,7 @@ export const useStateStore = defineStore("state", {
|
||||
updateCalibrationStateValuesFromWebsocket(data: WebsocketCalibrationData) {
|
||||
this.calibrationData = {
|
||||
imageCount: data.count,
|
||||
videoFormatIndex: data.videoModeIndex,
|
||||
minimumImageCount: data.minCount,
|
||||
hasEnoughImages: data.hasEnough
|
||||
videoFormatIndex: data.videoModeIndex
|
||||
};
|
||||
},
|
||||
updateDiscoveredCameras(data: VsmState) {
|
||||
|
||||
@@ -385,8 +385,6 @@ export const useCameraSettingsStore = defineStore("cameraSettings", {
|
||||
const payload = {
|
||||
startPnpCalibration: {
|
||||
count: stateCalibData.imageCount,
|
||||
minCount: stateCalibData.minimumImageCount,
|
||||
hasEnough: stateCalibData.hasEnoughImages,
|
||||
videoModeIndex: stateCalibData.videoFormatIndex,
|
||||
...calibrationInitData
|
||||
},
|
||||
|
||||
@@ -63,21 +63,14 @@ public class Calibrate3dPipeline
|
||||
/// Output of the calibration, getter method is set for this.
|
||||
private CVPipeResult<CameraCalibrationCoefficients> calibrationOutput;
|
||||
|
||||
private final int minSnapshots;
|
||||
|
||||
private boolean calibrating = false;
|
||||
|
||||
private static final FrameThresholdType PROCESSING_TYPE = FrameThresholdType.NONE;
|
||||
|
||||
public Calibrate3dPipeline() {
|
||||
this(12);
|
||||
}
|
||||
|
||||
public Calibrate3dPipeline(int minSnapshots) {
|
||||
super(PROCESSING_TYPE);
|
||||
this.settings = new Calibration3dPipelineSettings();
|
||||
this.foundCornersList = new ArrayList<>();
|
||||
this.minSnapshots = minSnapshots;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -164,21 +157,7 @@ public class Calibrate3dPipeline
|
||||
return foundCornersList.stream().map(it -> it.imagePoints.toList()).toList();
|
||||
}
|
||||
|
||||
public boolean hasEnough() {
|
||||
return foundCornersList.size() >= minSnapshots;
|
||||
}
|
||||
|
||||
public CameraCalibrationCoefficients tryCalibration(Path imageSavePath) {
|
||||
if (!hasEnough()) {
|
||||
logger.info(
|
||||
"Not enough snapshots! Only got "
|
||||
+ foundCornersList.size()
|
||||
+ " of "
|
||||
+ minSnapshots
|
||||
+ " -- returning null..");
|
||||
return null;
|
||||
}
|
||||
|
||||
this.calibrating = true;
|
||||
|
||||
/*
|
||||
@@ -216,8 +195,6 @@ public class Calibrate3dPipeline
|
||||
new UICalibrationData(
|
||||
foundCornersList.size(),
|
||||
settings.cameraVideoModeIndex,
|
||||
minSnapshots,
|
||||
hasEnough(),
|
||||
Units.metersToInches(settings.gridSize),
|
||||
Units.metersToInches(settings.markerSize),
|
||||
settings.boardWidth,
|
||||
|
||||
@@ -22,8 +22,6 @@ import org.opencv.objdetect.Objdetect;
|
||||
public class UICalibrationData {
|
||||
public int videoModeIndex;
|
||||
public int count;
|
||||
public int minCount;
|
||||
public boolean hasEnough;
|
||||
public double squareSizeIn;
|
||||
public int patternWidth;
|
||||
public int patternHeight;
|
||||
@@ -37,8 +35,6 @@ public class UICalibrationData {
|
||||
public UICalibrationData(
|
||||
int count,
|
||||
int videoModeIndex,
|
||||
int minCount,
|
||||
boolean hasEnough,
|
||||
double squareSizeIn,
|
||||
double markerSizeIn,
|
||||
int patternWidth,
|
||||
@@ -47,9 +43,7 @@ public class UICalibrationData {
|
||||
boolean useOldPattern,
|
||||
TagFamily tagFamily) {
|
||||
this.count = count;
|
||||
this.minCount = minCount;
|
||||
this.videoModeIndex = videoModeIndex;
|
||||
this.hasEnough = hasEnough;
|
||||
this.squareSizeIn = squareSizeIn;
|
||||
this.markerSizeIn = markerSizeIn;
|
||||
this.patternWidth = patternWidth;
|
||||
@@ -90,10 +84,6 @@ public class UICalibrationData {
|
||||
+ videoModeIndex
|
||||
+ ", count="
|
||||
+ count
|
||||
+ ", minCount="
|
||||
+ minCount
|
||||
+ ", hasEnough="
|
||||
+ hasEnough
|
||||
+ ", squareSizeIn="
|
||||
+ squareSizeIn
|
||||
+ ", markerSizeIn="
|
||||
|
||||
@@ -216,7 +216,7 @@ public class Calibrate3dPipeTest {
|
||||
|
||||
assertTrue(directoryListing.length >= 12);
|
||||
|
||||
Calibrate3dPipeline calibration3dPipeline = new Calibrate3dPipeline(10);
|
||||
Calibrate3dPipeline calibration3dPipeline = new Calibrate3dPipeline();
|
||||
calibration3dPipeline.getSettings().boardType = boardType;
|
||||
calibration3dPipeline.getSettings().markerSize = markerSize;
|
||||
calibration3dPipeline.getSettings().tagFamily = tagFamily;
|
||||
|
||||
Reference in New Issue
Block a user