use of boofcv.alg.fiducial.calib.squares.SquareNode in project BoofCV by lessthanoptimal.
the class TestDetectChessboardSquarePoints method isCCW.
private static boolean isCCW(SquareGrid grid) {
SquareNode a, b, c;
a = b = c = null;
for (int i = 0; i < grid.columns; i++) {
if (grid.get(0, i) != null) {
if (a == null)
a = grid.get(0, i);
else {
b = grid.get(0, i);
break;
}
}
}
if (b == null) {
for (int i = 0; i < grid.columns; i++) {
if (grid.get(1, i) != null) {
b = grid.get(1, i);
}
}
}
for (int i = 0; i < grid.columns; i++) {
SquareNode n = grid.get(grid.rows - 1, i);
if (n != null) {
c = n;
break;
}
}
assertTrue(a != null);
assertTrue(b != null);
assertTrue(c != null);
double x0 = b.center.x - a.center.x;
double y0 = b.center.y - a.center.y;
double x1 = c.center.x - a.center.x;
double y1 = c.center.y - a.center.y;
double angle0 = Math.atan2(y0, x0);
double angle1 = Math.atan2(y1, x1);
return UtilAngle.distanceCCW(angle0, angle1) < Math.PI;
}
use of boofcv.alg.fiducial.calib.squares.SquareNode in project BoofCV by lessthanoptimal.
the class TestDetectChessboardSquarePoints method createSquare.
public static SquareNode createSquare(double x, double y, double width) {
double r = width / 2;
Polygon2D_F64 poly = new Polygon2D_F64(4);
poly.get(0).set(-r, -r);
poly.get(1).set(r, -r);
poly.get(2).set(r, r);
poly.get(3).set(-r, r);
SquareNode square = new SquareNode();
for (int i = 0; i < 4; i++) {
poly.get(i).x += x;
poly.get(i).y += y;
}
square.square = poly;
square.center.set(x, y);
square.largestSide = width;
return square;
}
use of boofcv.alg.fiducial.calib.squares.SquareNode in project BoofCV by lessthanoptimal.
the class CommonDetectCalibrationApp method renderGrid.
protected void renderGrid(Graphics2D g2, double scale) {
List<SquareGrid> grids = getGrids();
for (int i = 0; i < grids.size(); i++) {
SquareGrid g = grids.get(i);
int a = grids.size() == 1 ? 0 : 255 * i / (grids.size() - 1);
int rgb = a << 16 | (255 - a) << 8;
g2.setStroke(new BasicStroke(3));
Color color = new Color(rgb);
for (int j = 0; j < g.nodes.size(); j++) {
SquareNode n = g.nodes.get(j);
if (n == null)
continue;
g2.setColor(color);
VisualizeShapes.drawPolygon(n.square, true, scale, g2);
drawCornersInside(g2, scale, n.square);
}
}
}
Aggregations