mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-28 02:11:40 +00:00
[Calibration] Fix iterator bound while creating object points (#188)
Fixes mismatched iterator bounds while creating object points. This addresses calibration failing for non square boards.
This commit is contained in:
@@ -88,7 +88,7 @@ public class FindBoardCornersPipe
|
||||
if (params.type == UICalibrationData.BoardType.CHESSBOARD) {
|
||||
// Here we can create an NxN grid since a chessboard is rectangular
|
||||
for (int heightIdx = 0; heightIdx < patternSize.height; heightIdx++) {
|
||||
for (int widthIdx = 0; widthIdx < patternSize.height; widthIdx++) {
|
||||
for (int widthIdx = 0; widthIdx < patternSize.width; widthIdx++) {
|
||||
double boardYCoord = heightIdx * params.gridSize;
|
||||
double boardXCoord = widthIdx * params.gridSize;
|
||||
objectPoints.push_back(new MatOfPoint3f(new Point3(boardXCoord, boardYCoord, 0.0)));
|
||||
|
||||
@@ -21,6 +21,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import edu.wpi.first.wpilibj.geometry.Rotation2d;
|
||||
import edu.wpi.first.wpilibj.util.Units;
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
@@ -182,6 +183,10 @@ public class Calibrate3dPipeTest {
|
||||
calibration3dPipeline.getSettings().boardType = UICalibrationData.BoardType.CHESSBOARD;
|
||||
calibration3dPipeline.getSettings().resolution = imgRes;
|
||||
|
||||
calibration3dPipeline.getSettings().boardWidth = 8;
|
||||
calibration3dPipeline.getSettings().boardHeight = 8;
|
||||
calibration3dPipeline.getSettings().gridSize = Units.inchesToMeters(1);
|
||||
|
||||
for (var file : directoryListing) {
|
||||
if (file.isFile()) {
|
||||
calibration3dPipeline.takeSnapshot();
|
||||
|
||||
Reference in New Issue
Block a user