Search in sources :

Example 1 with SquareEdge

use of boofcv.alg.fiducial.calib.squares.SquareEdge in project BoofCV by lessthanoptimal.

the class CommonDetectCalibrationApp method renderGraph.

protected void renderGraph(Graphics2D g2, double scale) {
    List<List<SquareNode>> graphs = getClusters();
    BasicStroke strokeWide = new BasicStroke(3);
    BasicStroke strokeNarrow = new BasicStroke(2);
    Line2D.Double l = new Line2D.Double();
    g2.setStroke(new BasicStroke(3));
    for (int i = 0; i < graphs.size(); i++) {
        List<SquareNode> graph = graphs.get(i);
        int key = graphs.size() == 1 ? 0 : 255 * i / (graphs.size() - 1);
        int rgb = key << 8 | (255 - key);
        g2.setColor(new Color(rgb));
        List<SquareEdge> edges = new ArrayList<>();
        for (SquareNode n : graph) {
            for (int j = 0; j < n.edges.length; j++) {
                if (n.edges[j] != null && !edges.contains(n.edges[j])) {
                    edges.add(n.edges[j]);
                }
            }
        }
        for (SquareEdge e : edges) {
            Point2D_F64 a = e.a.center;
            Point2D_F64 b = e.b.center;
            l.setLine(a.x * scale, a.y * scale, b.x * scale, b.y * scale);
            g2.setColor(Color.CYAN);
            g2.setStroke(strokeWide);
            g2.draw(l);
            g2.setColor(new Color(rgb));
            g2.setStroke(strokeNarrow);
            g2.draw(l);
        }
    }
}
Also used : ArrayList(java.util.ArrayList) Line2D(java.awt.geom.Line2D) Point2D_F64(georegression.struct.point.Point2D_F64) SquareNode(boofcv.alg.fiducial.calib.squares.SquareNode) SquareEdge(boofcv.alg.fiducial.calib.squares.SquareEdge) ArrayList(java.util.ArrayList) List(java.util.List)

Example 2 with SquareEdge

use of boofcv.alg.fiducial.calib.squares.SquareEdge in project BoofCV by lessthanoptimal.

the class TestQrCodeDecoderImage method connect.

private static void connect(PositionPatternNode a, PositionPatternNode b, int sideA, int sideB) {
    SquareEdge e = new SquareEdge(a, b, 3, 1);
    a.edges[sideA] = b.edges[sideB] = e;
}
Also used : SquareEdge(boofcv.alg.fiducial.calib.squares.SquareEdge)

Aggregations

SquareEdge (boofcv.alg.fiducial.calib.squares.SquareEdge)2 SquareNode (boofcv.alg.fiducial.calib.squares.SquareNode)1 Point2D_F64 (georegression.struct.point.Point2D_F64)1 Line2D (java.awt.geom.Line2D)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1