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