mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-25 01:41:40 +00:00
Raise minimum images for calibration to 100 (#2437)
This commit is contained in:
@@ -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