Search in sources :

Example 1 with GridElement

use of boofcv.alg.fiducial.calib.chess.ChessboardCornerClusterToGrid.GridElement in project BoofCV by lessthanoptimal.

the class TestECoCheckDetector method createCorrectedTarget_Marked.

/**
 * It will fail to create a target because a grid element has been marked, indicating that it has already been
 * used. This is a rare situation not tested in image based tests above.
 */
@Test
void createCorrectedTarget_Marked() {
    Transform transform = new Transform();
    transform.marker = 0;
    // make this large enough so that it doesn't blow up by trying to access a pixel out of bounds
    alg.cornersAroundBinary.reshape(10, 10);
    // Create a grid with a few arbitrary elements that will have no issues
    DogArray<GridElement> sparseGrid = alg.clusterToGrid.getSparseGrid();
    for (int i = 0; i < 5; i++) {
        GridElement e = sparseGrid.grow();
        e.row = i;
        e.col = 0;
        e.node = new ChessboardCornerGraph.Node();
        e.node.corner = new ChessboardCorner();
    }
    // Pass the first time
    assertTrue(alg.createCorrectedTarget(transform, new ECoCheckFound()));
    // Second time it will blow up because they have been marked!
    assertFalse(alg.createCorrectedTarget(transform, new ECoCheckFound()));
}
Also used : GridElement(boofcv.alg.fiducial.calib.chess.ChessboardCornerClusterToGrid.GridElement) ChessboardCornerGraph(boofcv.alg.fiducial.calib.chess.ChessboardCornerGraph) ChessboardCorner(boofcv.alg.feature.detect.chess.ChessboardCorner) Transform(boofcv.alg.fiducial.calib.ecocheck.ECoCheckDetector.Transform) Test(org.junit.jupiter.api.Test)

Aggregations

ChessboardCorner (boofcv.alg.feature.detect.chess.ChessboardCorner)1 GridElement (boofcv.alg.fiducial.calib.chess.ChessboardCornerClusterToGrid.GridElement)1 ChessboardCornerGraph (boofcv.alg.fiducial.calib.chess.ChessboardCornerGraph)1 Transform (boofcv.alg.fiducial.calib.ecocheck.ECoCheckDetector.Transform)1 Test (org.junit.jupiter.api.Test)1