use of georegression.struct.shapes.Polygon2D_F64 in project BoofCV by lessthanoptimal.
the class AssistedCalibration method captureFiducialPoints.
/**
* Record the area covered in the image by the fiducial, update the quality calculation, and see if it should
* enable the save button.
*/
private void captureFiducialPoints() {
Polygon2D_F64 p = regions.grow();
p.vertexes.resize(sidesCollision.size());
for (int i = 0; i < sidesCollision.size(); i++) {
p.get(i).set(sidesCollision.get(i));
}
quality.addObservations(detector.getDetectedPoints());
gui.getInfoPanel().updateGeometry(quality.getScore());
// once the user has sufficient geometric variation enable save
geometryTrigger |= quality.getScore() >= 1.0;
if (geometryTrigger && magnets.isEmpty()) {
gui.getInfoPanel().enabledFinishedButton();
}
}
use of georegression.struct.shapes.Polygon2D_F64 in project BoofCV by lessthanoptimal.
the class TestQrCodePositionPatternDetector method checkPositionPatternAppearance.
@Test
public void checkPositionPatternAppearance() {
GrayF32 image = render(null, new PP(40, 60, 70));
QrCodePositionPatternDetector<GrayF32> alg = createAlg();
Polygon2D_F64 square = square(40, 60, 70);
alg.interpolate.setImage(image);
assertTrue(alg.checkPositionPatternAppearance(square, 100));
// fill in the inner "stone"
ImageMiscOps.fillRectangle(image, 0, 40, 60, 70, 70);
assertFalse(alg.checkPositionPatternAppearance(square, 100));
}
use of georegression.struct.shapes.Polygon2D_F64 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 georegression.struct.shapes.Polygon2D_F64 in project BoofCV by lessthanoptimal.
the class GenericFiducialDetectorChecks method checkBounds.
public void checkBounds(FiducialDetector detector) {
if (!supportsBounds)
return;
Polygon2D_F64 queue = new Polygon2D_F64();
for (int i = 0; i < detector.totalFound(); i++) {
// make sure it handles null correctly
Polygon2D_F64 listA = detector.getBounds(i, null);
Polygon2D_F64 listB = detector.getBounds(i, queue);
assertTrue(listB == queue);
assertEquals(listA.size(), listB.size());
Polygon2D_F64 polygon = new Polygon2D_F64(listA.size());
for (int j = 0; j < listA.size(); j++) {
Point2D_F64 pa = listA.get(j);
Point2D_F64 pb = listB.get(j);
assertTrue(pa.x == pb.x);
assertTrue(pa.y == pb.y);
// very simple sanity check on the results
assertFalse(UtilEjml.isUncountable(pa.x));
assertFalse(UtilEjml.isUncountable(pa.y));
polygon.get(j).set(pa);
}
// in almost all cases the center should be inside
Point2D_F64 center = new Point2D_F64();
detector.getCenter(i, center);
Intersection2D_F64.containConvex(polygon, center);
}
}
use of georegression.struct.shapes.Polygon2D_F64 in project BoofCV by lessthanoptimal.
the class TestSquareCrossClustersIntoGrids method numberOfOpenEdges.
@Test
public void numberOfOpenEdges() {
SquareNode a = new SquareNode();
a.square = new Polygon2D_F64(4);
assertEquals(0, SquareCrossClustersIntoGrids.numberOfOpenEdges(a));
connect(a, 1, new SquareNode(), 0);
assertEquals(0, SquareCrossClustersIntoGrids.numberOfOpenEdges(a));
a.edges[1].b.graph = SquareNode.RESET_GRAPH;
assertEquals(1, SquareCrossClustersIntoGrids.numberOfOpenEdges(a));
}
Aggregations