Search in sources :

Example 1 with Vector3D_F64

use of georegression.struct.point.Vector3D_F64 in project BoofCV by lessthanoptimal.

the class DisparityPointCloudViewer method createWorldToCamera.

public Se3_F64 createWorldToCamera() {
    // pick an appropriate amount of motion for the scene
    double z = baseline * focalLengthX / (minDisparity + rangeDisparity);
    double adjust = baseline / 20.0;
    Vector3D_F64 rotPt = new Vector3D_F64(offsetX * adjust, offsetY * adjust, z * range);
    double radians = tiltAngle * Math.PI / 180.0;
    DMatrixRMaj R = ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, radians, 0, 0, null);
    Se3_F64 a = new Se3_F64(R, rotPt);
    return a;
}
Also used : Vector3D_F64(georegression.struct.point.Vector3D_F64) DMatrixRMaj(org.ejml.data.DMatrixRMaj) Se3_F64(georegression.struct.se.Se3_F64)

Example 2 with Vector3D_F64

use of georegression.struct.point.Vector3D_F64 in project BoofCV by lessthanoptimal.

the class PointCloudViewer method keyPressed.

@Override
public void keyPressed(KeyEvent e) {
    Vector3D_F64 T = worldToCamera.getT();
    if (e.getKeyChar() == 'w') {
        T.z -= stepSize;
    } else if (e.getKeyChar() == 's') {
        T.z += stepSize;
    } else if (e.getKeyChar() == 'a') {
        T.x += stepSize;
    } else if (e.getKeyChar() == 'd') {
        T.x -= stepSize;
    } else if (e.getKeyChar() == 'q') {
        T.y -= stepSize;
    } else if (e.getKeyChar() == 'e') {
        T.y += stepSize;
    } else if (e.getKeyChar() == 'h') {
        worldToCamera.reset();
    }
    repaint();
}
Also used : Vector3D_F64(georegression.struct.point.Vector3D_F64)

Example 3 with Vector3D_F64

use of georegression.struct.point.Vector3D_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 4 with Vector3D_F64

use of georegression.struct.point.Vector3D_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 5 with Vector3D_F64

use of georegression.struct.point.Vector3D_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)

Aggregations

Vector3D_F64 (georegression.struct.point.Vector3D_F64)60 DMatrixRMaj (org.ejml.data.DMatrixRMaj)34 Se3_F64 (georegression.struct.se.Se3_F64)30 Test (org.junit.Test)23 Point3D_F64 (georegression.struct.point.Point3D_F64)15 Point2D_F64 (georegression.struct.point.Point2D_F64)13 ConfigGeneralDetector (boofcv.abst.feature.detect.interest.ConfigGeneralDetector)4 PkltConfig (boofcv.alg.tracker.klt.PkltConfig)4 GrayU8 (boofcv.struct.image.GrayU8)4 MediaManager (boofcv.io.MediaManager)3 DefaultMediaManager (boofcv.io.wrapper.DefaultMediaManager)3 ArrayList (java.util.ArrayList)3 GrayU16 (boofcv.struct.image.GrayU16)2 UtilVector3D_F64 (georegression.geometry.UtilVector3D_F64)2 GeometryUnitTest (georegression.misc.test.GeometryUnitTest)2 EllipseRotated_F64 (georegression.struct.curve.EllipseRotated_F64)2 Random (java.util.Random)2 SimpleMatrix (org.ejml.simple.SimpleMatrix)2 ConfigChessboard (boofcv.abst.fiducial.calib.ConfigChessboard)1 AccessPointTracks3D (boofcv.abst.sfm.AccessPointTracks3D)1