use of boofcv.alg.fiducial.calib.squares.SquareGridTools in project BoofCV by lessthanoptimal.
the class TestDetectChessboardSquarePoints method putIntoCanonical.
@Test
public void putIntoCanonical() {
SquareGridTools tools = new SquareGridTools();
DetectChessboardSquarePoints alg = new DetectChessboardSquarePoints(2, 2, ConfigLength.fixed(10), null);
for (int rows = 2; rows <= 5; rows++) {
for (int cols = 2; cols <= 5; cols++) {
SquareGrid uber = createGrid(rows, cols);
alg.putIntoCanonical(uber);
checkCanonical(uber);
// make it do some work
boolean oddRow = rows % 2 == 1;
boolean oddCol = cols % 2 == 1;
if (oddRow == oddCol) {
if (oddRow && rows == cols) {
tools.rotateCCW(uber);
} else {
tools.reverse(uber);
}
}
alg.putIntoCanonical(uber);
checkCanonical(uber);
}
}
}
use of boofcv.alg.fiducial.calib.squares.SquareGridTools in project BoofCV by lessthanoptimal.
the class TestDetectSquareGridFiducial method extractCalibrationPoints.
@Test
public void extractCalibrationPoints() {
SquareGrid grid = TestSquareGridTools.createGrid(3, 4);
DetectSquareGridFiducial alg = new DetectSquareGridFiducial(3, 4, 1, null, null);
new SquareGridTools().orderSquareCorners(grid);
alg.extractCalibrationPoints(grid);
List<Point2D_F64> list = alg.getCalibrationPoints();
assertEquals(4 * 3 * 4, list.size());
double w = TestSquareRegularClustersIntoGrids.DEFAULT_WIDTH;
double x0 = -w / 2;
double y0 = -w / 2;
for (int row = 0; row < grid.rows * 2; row++) {
for (int col = 0; col < grid.columns * 2; col++) {
double x = x0 + col * w;
double y = y0 + row * w;
Point2D_F64 p = list.get(row * grid.columns * 2 + col);
assertEquals(x, p.x, 1e-8);
assertEquals(y, p.y, 1e-8);
}
}
}
Aggregations