use of georegression.struct.point.Vector3D_F64 in project BoofCV by lessthanoptimal.
the class TestDecomposeHomography method multipleCalls.
/**
* Checks to see if the same solution is returned when invoked multiple times
*/
@Test
public void multipleCalls() {
DMatrixRMaj H = MultiViewOps.createHomography(R, T, d, N);
DecomposeHomography alg = new DecomposeHomography();
// call it twice and see if things break
alg.decompose(H);
alg.decompose(H);
List<Se3_F64> foundSE = alg.getSolutionsSE();
List<Vector3D_F64> foundN = alg.getSolutionsN();
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_lll.
@Test
public void constraint_Trifocal_lll() {
Point3D_F64 X = new Point3D_F64(0.1, -0.05, 2);
computeLines(X, line1, line2, line3);
Vector3D_F64 found = MultiViewOps.constraint(tensor, line1, line2, line3, 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 createHomography_calibrated.
@Test
public void createHomography_calibrated() {
DMatrixRMaj R = ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0.1, -0.01, 0.2, null);
Vector3D_F64 T = new Vector3D_F64(1, 1, 0.1);
T.normalize();
double d = 2;
Vector3D_F64 N = new Vector3D_F64(0, 0, 1);
DMatrixRMaj H = MultiViewOps.createHomography(R, T, d, N);
// Test using the following theorem: x2 = H*x1
// a point on the plane
Point3D_F64 P = new Point3D_F64(0.1, 0.2, d);
Point2D_F64 x0 = new Point2D_F64(P.x / P.z, P.y / P.z);
SePointOps_F64.transform(new Se3_F64(R, T), P, P);
Point2D_F64 x1 = new Point2D_F64(P.x / P.z, P.y / P.z);
Point2D_F64 found = new Point2D_F64();
GeometryMath_F64.mult(H, x0, found);
assertEquals(x1.x, found.x, 1e-8);
assertEquals(x1.y, found.y, 1e-8);
}
use of georegression.struct.point.Vector3D_F64 in project BoofCV by lessthanoptimal.
the class TestMultiViewOps method decomposeHomography.
@Test
public void decomposeHomography() {
DMatrixRMaj R = ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0.2, -0.06, -0.05, null);
Vector3D_F64 T = new Vector3D_F64(2, 1, -3);
double d = 2.5;
Vector3D_F64 N = new Vector3D_F64(0.68, 0.2, -0.06);
N.normalize();
DMatrixRMaj H = MultiViewOps.createHomography(R, T, d, N);
List<Tuple2<Se3_F64, Vector3D_F64>> found = MultiViewOps.decomposeHomography(H);
assertEquals(4, found.size());
List<Se3_F64> solutionsSE = new ArrayList<>();
List<Vector3D_F64> solutionsN = new ArrayList<>();
for (Tuple2<Se3_F64, Vector3D_F64> t : found) {
solutionsSE.add(t.data0);
solutionsN.add(t.data1);
}
TestDecomposeHomography.checkHasOriginal(solutionsSE, solutionsN, R, T, d, N);
}
use of georegression.struct.point.Vector3D_F64 in project BoofCV by lessthanoptimal.
the class TestMultiViewOps method computeLine.
private Vector3D_F64 computeLine(Point3D_F64 X1, Point3D_F64 X2, Se3_F64 worldToCam, DMatrixRMaj K) {
Point2D_F64 a = PerspectiveOps.renderPixel(worldToCam, K, X1);
Point2D_F64 b = PerspectiveOps.renderPixel(worldToCam, K, X2);
Vector3D_F64 v1 = new Vector3D_F64(b.x - a.x, b.y - a.y, 0);
Vector3D_F64 v2 = new Vector3D_F64(a.x, a.y, 1);
Vector3D_F64 norm = new Vector3D_F64();
GeometryMath_F64.cross(v1, v2, norm);
norm.normalize();
double sanity1 = a.x * norm.x + a.y * norm.y + norm.z;
double sanity2 = b.x * norm.x + b.y * norm.y + norm.z;
return norm;
}
Aggregations