Search in sources :

Example 6 with Point3D_F64

use of georegression.struct.point.Point3D_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);
}
Also used : Point3D_F64(georegression.struct.point.Point3D_F64) Vector3D_F64(georegression.struct.point.Vector3D_F64) Point2D_F64(georegression.struct.point.Point2D_F64) DMatrixRMaj(org.ejml.data.DMatrixRMaj) Se3_F64(georegression.struct.se.Se3_F64) Test(org.junit.Test)

Example 7 with Point3D_F64

use of georegression.struct.point.Point3D_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);
}
Also used : Point3D_F64(georegression.struct.point.Point3D_F64) Vector3D_F64(georegression.struct.point.Vector3D_F64) DMatrixRMaj(org.ejml.data.DMatrixRMaj) Test(org.junit.Test)

Example 8 with Point3D_F64

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

the class TestMultiViewOps method constraint_epipolar.

@Test
public void constraint_epipolar() {
    Point3D_F64 X = new Point3D_F64(0.1, -0.05, 2);
    Point2D_F64 p1 = PerspectiveOps.renderPixel(new Se3_F64(), K, X);
    Point2D_F64 p2 = PerspectiveOps.renderPixel(worldToCam2, K, X);
    DMatrixRMaj E = MultiViewOps.createEssential(worldToCam2.R, worldToCam2.T);
    DMatrixRMaj F = MultiViewOps.createFundamental(E, K);
    assertEquals(0, MultiViewOps.constraint(F, p1, p2), 1e-8);
}
Also used : Point3D_F64(georegression.struct.point.Point3D_F64) Point2D_F64(georegression.struct.point.Point2D_F64) DMatrixRMaj(org.ejml.data.DMatrixRMaj) Se3_F64(georegression.struct.se.Se3_F64) Test(org.junit.Test)

Example 9 with Point3D_F64

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

the class TestMultiViewOps method constraint_Trifocal_ppl.

@Test
public void constraint_Trifocal_ppl() {
    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 x2 = PerspectiveOps.renderPixel(worldToCam2, K, X);
    Vector3D_F64 found = MultiViewOps.constraint(tensor, x1, x2, line3, 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)

Example 10 with Point3D_F64

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

the class TestMultiViewOps method inducedHomography13.

@Test
public void inducedHomography13() {
    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 p1 = PerspectiveOps.renderPixel(new Se3_F64(), null, X);
    Point2D_F64 p3 = PerspectiveOps.renderPixel(worldToCam3, K, X);
    DMatrixRMaj H13 = MultiViewOps.inducedHomography13(tensor, line2, null);
    Point2D_F64 found = new Point2D_F64();
    GeometryMath_F64.mult(H13, p1, found);
    assertEquals(p3.x, found.x, 1e-8);
    assertEquals(p3.y, found.y, 1e-8);
}
Also used : Point3D_F64(georegression.struct.point.Point3D_F64) Point2D_F64(georegression.struct.point.Point2D_F64) DMatrixRMaj(org.ejml.data.DMatrixRMaj) Se3_F64(georegression.struct.se.Se3_F64) Test(org.junit.Test)

Aggregations

Point3D_F64 (georegression.struct.point.Point3D_F64)174 Point2D_F64 (georegression.struct.point.Point2D_F64)85 Test (org.junit.Test)77 Se3_F64 (georegression.struct.se.Se3_F64)74 DMatrixRMaj (org.ejml.data.DMatrixRMaj)46 ArrayList (java.util.ArrayList)17 Vector3D_F64 (georegression.struct.point.Vector3D_F64)15 Point2D3D (boofcv.struct.geo.Point2D3D)13 AssociatedPair (boofcv.struct.geo.AssociatedPair)12 GrayU8 (boofcv.struct.image.GrayU8)9 FastQueue (org.ddogleg.struct.FastQueue)9 CameraPinholeRadial (boofcv.struct.calib.CameraPinholeRadial)8 Point2Transform2_F64 (boofcv.struct.distort.Point2Transform2_F64)7 MotionTransformPoint (georegression.fitting.MotionTransformPoint)7 UtilPoint3D_F64 (georegression.geometry.UtilPoint3D_F64)7 PointTrack (boofcv.abst.feature.tracker.PointTrack)5 StereoParameters (boofcv.struct.calib.StereoParameters)5 TrifocalTensor (boofcv.struct.geo.TrifocalTensor)5 GrayU16 (boofcv.struct.image.GrayU16)5 Stereo2D3D (boofcv.struct.sfm.Stereo2D3D)5