Search in sources :

Example 6 with MatrixOfList

use of boofcv.struct.feature.MatrixOfList in project BoofCV by lessthanoptimal.

the class TestConnectLinesGrid method checkAngleTolerance.

/**
 * Makes sure the angle tolerance parameter is correctly set and processed
 */
@Test
public void checkAngleTolerance() {
    MatrixOfList<LineSegment2D_F32> grid = new MatrixOfList<>(1, 1);
    grid.get(0, 0).add(new LineSegment2D_F32(0, 0, 2, 0));
    grid.get(0, 0).add(new LineSegment2D_F32(2, 0, 4, 4));
    // have the tolerance be too tight
    ConnectLinesGrid app = new ConnectLinesGrid(0.1, 1, 1);
    app.process(grid);
    assertEquals(2, grid.createSingleList().size());
    // now make the tolerance broader
    app = new ConnectLinesGrid(Math.PI, 1, 1);
    app.process(grid);
    assertEquals(1, grid.createSingleList().size());
}
Also used : LineSegment2D_F32(georegression.struct.line.LineSegment2D_F32) MatrixOfList(boofcv.struct.feature.MatrixOfList) Test(org.junit.Test)

Aggregations

MatrixOfList (boofcv.struct.feature.MatrixOfList)6 LineSegment2D_F32 (georegression.struct.line.LineSegment2D_F32)6 Test (org.junit.Test)5 Point2D_F32 (georegression.struct.point.Point2D_F32)1