Search in sources :

Example 1 with TriangulateNViewsProjective

use of boofcv.abst.geo.TriangulateNViewsProjective in project BoofCV by lessthanoptimal.

the class TestCompatibleProjectiveHomography method createScene.

@Override
public void createScene(int numFeatures, boolean planar) {
    super.createScene(numFeatures, planar);
    // Triangulate 3D points in another projective
    TrifocalTensor T = MultiViewOps.createTrifocal(cameras.get(0), cameras.get(1), cameras.get(2), null);
    DMatrixRMaj P1 = new DMatrixRMaj(3, 4);
    DMatrixRMaj P2 = new DMatrixRMaj(3, 4);
    DMatrixRMaj P3 = new DMatrixRMaj(3, 4);
    MultiViewOps.trifocalToCameraMatrices(T, P2, P3);
    CommonOps_DDRM.setIdentity(P1);
    TriangulateNViewsProjective triangulator = FactoryMultiView.triangulateNViewProj(ConfigTriangulation.GEOMETRIC());
    List<Point2D_F64> observations = new ArrayList<>();
    for (int i = 0; i < 3; i++) {
        observations.add(new Point2D_F64());
    }
    camerasB = new ArrayList<>();
    camerasB.add(P1);
    camerasB.add(P2);
    camerasB.add(P3);
    sceneB = new ArrayList<>();
    for (int i = 0; i < numFeatures; i++) {
        AssociatedTriple t = triples.get(i);
        observations.get(0).setTo(t.p1);
        observations.get(1).setTo(t.p2);
        observations.get(2).setTo(t.p3);
        Point4D_F64 location = new Point4D_F64();
        assertTrue(triangulator.triangulate(observations, camerasB, location));
        sceneB.add(location);
    }
}
Also used : TriangulateNViewsProjective(boofcv.abst.geo.TriangulateNViewsProjective) AssociatedTriple(boofcv.struct.geo.AssociatedTriple) TrifocalTensor(boofcv.struct.geo.TrifocalTensor) Point2D_F64(georegression.struct.point.Point2D_F64) DMatrixRMaj(org.ejml.data.DMatrixRMaj) ArrayList(java.util.ArrayList) Point4D_F64(georegression.struct.point.Point4D_F64)

Aggregations

TriangulateNViewsProjective (boofcv.abst.geo.TriangulateNViewsProjective)1 AssociatedTriple (boofcv.struct.geo.AssociatedTriple)1 TrifocalTensor (boofcv.struct.geo.TrifocalTensor)1 Point2D_F64 (georegression.struct.point.Point2D_F64)1 Point4D_F64 (georegression.struct.point.Point4D_F64)1 ArrayList (java.util.ArrayList)1 DMatrixRMaj (org.ejml.data.DMatrixRMaj)1