use of boofcv.alg.fiducial.calib.chess.ChessboardCornerClusterFinder in project BoofCV by lessthanoptimal.
the class VisualizeChessboardXCornerUtils method visualizePerpendicular.
public void visualizePerpendicular(Graphics2D g2, double scale, ChessboardCornerClusterFinder<GrayF32> clusterFinder) {
g2.setFont(regular);
BasicStroke thin = new BasicStroke(2);
BasicStroke thick = new BasicStroke(4);
// g2.setStroke(new BasicStroke(1));
// List<Vertex> vertexes = detector.getClusterFinder().getVertexes().toList();
List<ChessboardCornerClusterFinder.LineInfo> lines = clusterFinder.getLines().toList();
for (int i = 0; i < lines.size(); i++) {
ChessboardCornerClusterFinder.LineInfo lineInfo = lines.get(i);
if (lineInfo.isDisconnected() || lineInfo.parallel)
continue;
ChessboardCornerClusterFinder.Vertex va = Objects.requireNonNull(lineInfo.endA).dst;
ChessboardCornerClusterFinder.Vertex vb = Objects.requireNonNull(lineInfo.endB).dst;
ChessboardCorner ca = foundCorners.get(va.index);
ChessboardCorner cb = foundCorners.get(vb.index);
double intensity = lineInfo.intensity == -Double.MAX_VALUE ? Double.NaN : lineInfo.intensity;
line.setLine(ca.x * scale, ca.y * scale, cb.x * scale, cb.y * scale);
g2.setStroke(thick);
g2.setColor(Color.BLACK);
g2.draw(line);
g2.setStroke(thin);
g2.setColor(Color.ORANGE);
g2.draw(line);
float x = (float) ((ca.x + cb.x) / 2.0);
float y = (float) ((ca.y + cb.y) / 2.0);
g2.setColor(Color.RED);
g2.drawString(String.format("%.1f", intensity), x * (float) scale, y * (float) scale);
}
}
Aggregations