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