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()));
}
Aggregations