Search in sources :

Example 6 with Se3_F64

use of georegression.struct.se.Se3_F64 in project BoofCV by lessthanoptimal.

the class TestDecomposeEssential method multipleCalls.

/**
 * Checks to see if the same solution is returned when invoked multiple times
 */
@Test
public void multipleCalls() {
    DMatrixRMaj R = ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0.1, -0.4, 0.5, null);
    Vector3D_F64 T = new Vector3D_F64(2, 1, -3);
    DMatrixRMaj E = MultiViewOps.createEssential(R, T);
    DecomposeEssential alg = new DecomposeEssential();
    // call it twice and see if it breaks
    alg.decompose(E);
    alg.decompose(E);
    List<Se3_F64> solutions = alg.getSolutions();
    assertEquals(4, solutions.size());
    checkUnique(solutions);
    checkHasOriginal(solutions, R, T);
}
Also used : Vector3D_F64(georegression.struct.point.Vector3D_F64) DMatrixRMaj(org.ejml.data.DMatrixRMaj) Se3_F64(georegression.struct.se.Se3_F64) GeometryUnitTest(georegression.misc.test.GeometryUnitTest) Test(org.junit.Test)

Example 7 with Se3_F64

use of georegression.struct.se.Se3_F64 in project BoofCV by lessthanoptimal.

the class TestDecomposeEssential method checkAgainstKnown.

/**
 * Check the decomposition against a known input.  See if the solutions have the expected
 * properties and at least one matches the input.
 */
@Test
public void checkAgainstKnown() {
    DMatrixRMaj R = ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0.1, -0.4, 0.5, null);
    Vector3D_F64 T = new Vector3D_F64(2, 1, -3);
    DMatrixRMaj E = MultiViewOps.createEssential(R, T);
    DecomposeEssential alg = new DecomposeEssential();
    alg.decompose(E);
    List<Se3_F64> solutions = alg.getSolutions();
    assertEquals(4, solutions.size());
    checkUnique(solutions);
    checkHasOriginal(solutions, R, T);
}
Also used : Vector3D_F64(georegression.struct.point.Vector3D_F64) DMatrixRMaj(org.ejml.data.DMatrixRMaj) Se3_F64(georegression.struct.se.Se3_F64) GeometryUnitTest(georegression.misc.test.GeometryUnitTest) Test(org.junit.Test)

Example 8 with Se3_F64

use of georegression.struct.se.Se3_F64 in project BoofCV by lessthanoptimal.

the class TestDecomposeHomography method checkHasOriginal.

/*
	 * See if an equivalent to the input matrix exists
	 */
public static void checkHasOriginal(List<Se3_F64> solutionsSE, List<Vector3D_F64> solutionsN, DMatrixRMaj R, Vector3D_F64 T, double d, Vector3D_F64 N) {
    int numMatches = 0;
    for (int i = 0; i < 4; i++) {
        Se3_F64 foundSE = solutionsSE.get(i);
        Vector3D_F64 foundN = solutionsN.get(i);
        if (!MatrixFeatures_DDRM.isIdentical(foundSE.getR(), R, 1e-4))
            break;
        if (Math.abs(T.x / d - foundSE.getT().x) > 1e-8)
            break;
        if (Math.abs(T.y / d - foundSE.getT().y) > 1e-8)
            break;
        if (Math.abs(T.z / d - foundSE.getT().z) > 1e-8)
            break;
        if (Math.abs(N.x - foundN.x) > 1e-8)
            break;
        if (Math.abs(N.y - foundN.y) > 1e-8)
            break;
        if (Math.abs(N.z - foundN.z) > 1e-8)
            break;
        numMatches++;
    }
    assertEquals(1, numMatches);
}
Also used : Vector3D_F64(georegression.struct.point.Vector3D_F64) Se3_F64(georegression.struct.se.Se3_F64)

Example 9 with Se3_F64

use of georegression.struct.se.Se3_F64 in project BoofCV by lessthanoptimal.

the class TestDecomposeHomography method checkAgainstKnown.

@Test
public void checkAgainstKnown() {
    DMatrixRMaj H = MultiViewOps.createHomography(R, T, d, N);
    DecomposeHomography alg = new DecomposeHomography();
    // There's a scale ambiguity. Let's see if it handles it correctly
    CommonOps_DDRM.scale(2.4, H);
    alg.decompose(H);
    List<Se3_F64> foundSE = alg.getSolutionsSE();
    List<Vector3D_F64> foundN = alg.getSolutionsN();
    assertEquals(4, foundSE.size());
    assertEquals(4, foundN.size());
    TestDecomposeEssential.checkUnique(foundSE);
    checkHasOriginal(foundSE, foundN, R, T, d, N);
}
Also used : Vector3D_F64(georegression.struct.point.Vector3D_F64) DMatrixRMaj(org.ejml.data.DMatrixRMaj) Se3_F64(georegression.struct.se.Se3_F64) Test(org.junit.Test)

Example 10 with Se3_F64

use of georegression.struct.se.Se3_F64 in project BoofCV by lessthanoptimal.

the class TestMultiViewOps method constraint_Trifocal_plp.

@Test
public void constraint_Trifocal_plp() {
    Point3D_F64 X = new Point3D_F64(0.1, -0.05, 2);
    computeLines(X, line1, line2, line3);
    // When the tensor was constructed the first view was assumed to be [I|0], which
    // is why normalized image coordinates are used for the first view
    Point2D_F64 x1 = PerspectiveOps.renderPixel(new Se3_F64(), null, X);
    Point2D_F64 x3 = PerspectiveOps.renderPixel(worldToCam3, K, X);
    Vector3D_F64 found = MultiViewOps.constraint(tensor, x1, line2, x3, null);
    assertEquals(0, found.x, 1e-12);
    assertEquals(0, found.y, 1e-12);
    assertEquals(0, found.z, 1e-12);
}
Also used : Point3D_F64(georegression.struct.point.Point3D_F64) Vector3D_F64(georegression.struct.point.Vector3D_F64) Point2D_F64(georegression.struct.point.Point2D_F64) Se3_F64(georegression.struct.se.Se3_F64) Test(org.junit.Test)

Aggregations

Se3_F64 (georegression.struct.se.Se3_F64)214 Test (org.junit.Test)83 Point3D_F64 (georegression.struct.point.Point3D_F64)74 Point2D_F64 (georegression.struct.point.Point2D_F64)68 DMatrixRMaj (org.ejml.data.DMatrixRMaj)52 Point2D3D (boofcv.struct.geo.Point2D3D)31 Vector3D_F64 (georegression.struct.point.Vector3D_F64)30 ArrayList (java.util.ArrayList)27 CameraPinholeRadial (boofcv.struct.calib.CameraPinholeRadial)26 GrayF32 (boofcv.struct.image.GrayF32)18 AssociatedPair (boofcv.struct.geo.AssociatedPair)17 StereoParameters (boofcv.struct.calib.StereoParameters)12 GrayU8 (boofcv.struct.image.GrayU8)10 BufferedImage (java.awt.image.BufferedImage)10 PointTrack (boofcv.abst.feature.tracker.PointTrack)9 ConvertBufferedImage (boofcv.io.image.ConvertBufferedImage)9 Stereo2D3D (boofcv.struct.sfm.Stereo2D3D)9 ModelManagerSe3_F64 (georegression.fitting.se.ModelManagerSe3_F64)9 RectifyCalibrated (boofcv.alg.geo.rectify.RectifyCalibrated)8 LensDistortionNarrowFOV (boofcv.alg.distort.LensDistortionNarrowFOV)7