Search in sources :

Example 1 with Tuple2

use of org.ddogleg.struct.Tuple2 in project BoofCV by lessthanoptimal.

the class TestEllipseClustersIntoGrid method connectEllipses.

static Tuple2<List<Node>, List<EllipseRotated_F64>> connectEllipses(List<EllipseRotated_F64> ellipses, double distance) {
    List<Node> cluster = new ArrayList<>();
    for (int i = 0; i < ellipses.size(); i++) {
        cluster.add(new Node());
        cluster.get(i).which = i;
    }
    for (int i = 0; i < ellipses.size(); i++) {
        Node n0 = cluster.get(i);
        EllipseRotated_F64 e0 = ellipses.get(i);
        for (int j = i + 1; j < ellipses.size(); j++) {
            Node n1 = cluster.get(j);
            EllipseRotated_F64 e1 = ellipses.get(j);
            if (e1.center.distance(e0.center) <= distance) {
                n0.connections.add(j);
                n1.connections.add(i);
            }
        }
    }
    return new Tuple2<>(cluster, ellipses);
}
Also used : EllipseRotated_F64(georegression.struct.curve.EllipseRotated_F64) Tuple2(org.ddogleg.struct.Tuple2) Node(boofcv.alg.fiducial.calib.circle.EllipsesIntoClusters.Node) ArrayList(java.util.ArrayList)

Example 2 with Tuple2

use of org.ddogleg.struct.Tuple2 in project BoofCV by lessthanoptimal.

the class TestMultiViewOps method decomposeHomography.

@Test
public void decomposeHomography() {
    DMatrixRMaj R = ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0.2, -0.06, -0.05, null);
    Vector3D_F64 T = new Vector3D_F64(2, 1, -3);
    double d = 2.5;
    Vector3D_F64 N = new Vector3D_F64(0.68, 0.2, -0.06);
    N.normalize();
    DMatrixRMaj H = MultiViewOps.createHomography(R, T, d, N);
    List<Tuple2<Se3_F64, Vector3D_F64>> found = MultiViewOps.decomposeHomography(H);
    assertEquals(4, found.size());
    List<Se3_F64> solutionsSE = new ArrayList<>();
    List<Vector3D_F64> solutionsN = new ArrayList<>();
    for (Tuple2<Se3_F64, Vector3D_F64> t : found) {
        solutionsSE.add(t.data0);
        solutionsN.add(t.data1);
    }
    TestDecomposeHomography.checkHasOriginal(solutionsSE, solutionsN, R, T, d, N);
}
Also used : Vector3D_F64(georegression.struct.point.Vector3D_F64) Tuple2(org.ddogleg.struct.Tuple2) DMatrixRMaj(org.ejml.data.DMatrixRMaj) ArrayList(java.util.ArrayList) Se3_F64(georegression.struct.se.Se3_F64) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)2 Tuple2 (org.ddogleg.struct.Tuple2)2 Node (boofcv.alg.fiducial.calib.circle.EllipsesIntoClusters.Node)1 EllipseRotated_F64 (georegression.struct.curve.EllipseRotated_F64)1 Vector3D_F64 (georegression.struct.point.Vector3D_F64)1 Se3_F64 (georegression.struct.se.Se3_F64)1 DMatrixRMaj (org.ejml.data.DMatrixRMaj)1 Test (org.junit.Test)1