Search in sources :

Example 46 with Point3D_F64

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

the class TestPixelDepthLinear method depth2View.

@Test
public void depth2View() {
    // define the camera's motion
    Se3_F64 motion1 = new Se3_F64();
    motion1.getR().set(ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0.05, -0.03, 0.02, null));
    motion1.getT().set(0.1, -0.1, 0.01);
    // compute the point's location in each camera's view
    Point3D_F64 A = new Point3D_F64(2, 3, 2);
    Point3D_F64 B = SePointOps_F64.transform(motion1, A, null);
    // projected points
    Point2D_F64 x1 = new Point2D_F64(A.x / A.z, A.y / A.z);
    Point2D_F64 x2 = new Point2D_F64(B.x / B.z, B.y / B.z);
    PixelDepthLinear alg = new PixelDepthLinear();
    double depth = alg.depth2View(x1, x2, motion1);
    // see if the origin point was recomputed
    assertEquals(x1.x * depth, A.x, 1e-8);
    assertEquals(x1.y * depth, A.y, 1e-8);
    assertEquals(depth, A.z, 1e-8);
}
Also used : Point3D_F64(georegression.struct.point.Point3D_F64) Point2D_F64(georegression.struct.point.Point2D_F64) Se3_F64(georegression.struct.se.Se3_F64) Test(org.junit.Test)

Example 47 with Point3D_F64

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

the class TestPixelDepthLinear method depthNView.

@Test
public void depthNView() {
    // define the camera's motion
    Se3_F64 motion1 = new Se3_F64();
    motion1.getR().set(ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0.05, -0.03, 0.02, null));
    motion1.getT().set(0.1, -0.1, 0.01);
    Se3_F64 motion2 = new Se3_F64();
    motion2.getR().set(ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, -0.15, -0.3, 0.08, null));
    motion2.getT().set(-0.2, -0.15, 0.2);
    // compute the point's location in each camera's view
    Point3D_F64 A = new Point3D_F64(2, 3, 2);
    Point3D_F64 B = SePointOps_F64.transform(motion1, A, null);
    Point3D_F64 C = SePointOps_F64.transform(motion2, A, null);
    // projected points
    Point2D_F64 x1 = new Point2D_F64(A.x / A.z, A.y / A.z);
    Point2D_F64 x2 = new Point2D_F64(B.x / B.z, B.y / B.z);
    Point2D_F64 x3 = new Point2D_F64(C.x / C.z, C.y / C.z);
    // setup data structures
    List<Se3_F64> listMotion = new ArrayList<>();
    List<Point2D_F64> listPoint = new ArrayList<>();
    listMotion.add(motion1);
    listMotion.add(motion2);
    listPoint.add(x1);
    listPoint.add(x2);
    listPoint.add(x3);
    PixelDepthLinear alg = new PixelDepthLinear();
    double depth = alg.depthNView(listPoint, listMotion);
    // see if the origin point was recomputed
    assertEquals(x1.x * depth, A.x, 1e-8);
    assertEquals(x1.y * depth, A.y, 1e-8);
    assertEquals(depth, A.z, 1e-8);
}
Also used : Point3D_F64(georegression.struct.point.Point3D_F64) Point2D_F64(georegression.struct.point.Point2D_F64) ArrayList(java.util.ArrayList) Se3_F64(georegression.struct.se.Se3_F64) Test(org.junit.Test)

Example 48 with Point3D_F64

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

the class TestTriangulateGeometric method triangulate_two.

/**
 * Create 2 perfect observations and solve for the position
 */
@Test
public void triangulate_two() {
    createScene();
    TriangulateGeometric alg = new TriangulateGeometric();
    Point3D_F64 found = new Point3D_F64();
    alg.triangulate(obsPts.get(0), obsPts.get(1), motionWorldToCamera.get(1), found);
    assertEquals(worldPoint.x, found.x, 1e-8);
    assertEquals(worldPoint.y, found.y, 1e-8);
    assertEquals(worldPoint.z, found.z, 1e-8);
}
Also used : Point3D_F64(georegression.struct.point.Point3D_F64) Test(org.junit.Test)

Example 49 with Point3D_F64

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

the class TestTriangulateLinearDLT method triangulate_two.

/**
 * Create 2 perfect observations and solve for the position
 */
@Test
public void triangulate_two() {
    createScene();
    TriangulateLinearDLT alg = new TriangulateLinearDLT();
    Point3D_F64 found = new Point3D_F64();
    alg.triangulate(obsPts.get(0), obsPts.get(1), motionWorldToCamera.get(1), found);
    assertEquals(worldPoint.x, found.x, 1e-8);
    assertEquals(worldPoint.y, found.y, 1e-8);
    assertEquals(worldPoint.z, found.z, 1e-8);
}
Also used : Point3D_F64(georegression.struct.point.Point3D_F64) Test(org.junit.Test)

Example 50 with Point3D_F64

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

the class TestTriangulateLinearDLT method triangulate_N.

/**
 * Create 3 perfect observations and solve for the position
 */
@Test
public void triangulate_N() {
    createScene();
    TriangulateLinearDLT alg = new TriangulateLinearDLT();
    Point3D_F64 found = new Point3D_F64();
    alg.triangulate(obsPts, motionWorldToCamera, found);
    assertEquals(worldPoint.x, found.x, 1e-8);
    assertEquals(worldPoint.y, found.y, 1e-8);
    assertEquals(worldPoint.z, found.z, 1e-8);
}
Also used : Point3D_F64(georegression.struct.point.Point3D_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