use of georegression.struct.point.Vector3D_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.point.Vector3D_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);
}
use of georegression.struct.point.Vector3D_F64 in project BoofCV by lessthanoptimal.
the class TestMultiViewOps method createEssential.
@Test
public void createEssential() {
DMatrixRMaj R = ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0.05, -0.04, 0.1, null);
Vector3D_F64 T = new Vector3D_F64(2, 1, -3);
T.normalize();
DMatrixRMaj E = MultiViewOps.createEssential(R, T);
// Test using the following theorem: x2^T*E*x1 = 0
Point3D_F64 X = new Point3D_F64(0.1, 0.1, 2);
Point2D_F64 x0 = PerspectiveOps.renderPixel(new Se3_F64(), null, X);
Point2D_F64 x1 = PerspectiveOps.renderPixel(new Se3_F64(R, T), null, X);
double val = GeometryMath_F64.innerProd(x1, E, x0);
assertEquals(0, val, 1e-8);
}
use of georegression.struct.point.Vector3D_F64 in project BoofCV by lessthanoptimal.
the class TestMultiViewOps method extractEpipoles_stereo.
@Test
public void extractEpipoles_stereo() {
DMatrixRMaj R = ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 1, 2, -0.5, null);
Vector3D_F64 T = new Vector3D_F64(0.5, 0.7, -0.3);
DMatrixRMaj E = MultiViewOps.createEssential(R, T);
assertTrue(NormOps_DDRM.normF(E) != 0);
Point3D_F64 e1 = new Point3D_F64();
Point3D_F64 e2 = new Point3D_F64();
MultiViewOps.extractEpipoles(E, e1, e2);
Point3D_F64 temp = new Point3D_F64();
GeometryMath_F64.mult(E, e1, temp);
assertEquals(0, temp.norm(), 1e-8);
GeometryMath_F64.multTran(E, e2, temp);
assertEquals(0, temp.norm(), 1e-8);
}
use of georegression.struct.point.Vector3D_F64 in project BoofCV by lessthanoptimal.
the class TestMultiViewOps method decomposeEssential.
@Test
public void decomposeEssential() {
DMatrixRMaj R = ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 1, 2, -0.5, null);
Vector3D_F64 T = new Vector3D_F64(0.5, 0.7, -0.3);
DMatrixRMaj E = MultiViewOps.createEssential(R, T);
List<Se3_F64> found = MultiViewOps.decomposeEssential(E);
// the scale factor is lost
T.normalize();
int numMatched = 0;
for (Se3_F64 m : found) {
DMatrixRMaj A = new DMatrixRMaj(3, 3);
CommonOps_DDRM.multTransA(R, m.getR(), A);
if (!MatrixFeatures_DDRM.isIdentity(A, 1e-8)) {
continue;
}
Vector3D_F64 foundT = m.getT();
foundT.normalize();
if (foundT.isIdentical(T, 1e-8))
numMatched++;
}
assertEquals(1, numMatched);
}
Aggregations