Search in sources :

Example 76 with Point3D_F64

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

the class DistanceTranGivenRotSq method computeDistance.

@Override
public double computeDistance(Point2D3D pt) {
    Point3D_F64 X = pt.location;
    Point2D_F64 obs = pt.observation;
    SePointOps_F64.transform(motion, X, localX);
    double dx = obs.x - localX.x / localX.z;
    double dy = obs.y - localX.y / localX.z;
    return dx * dx + dy * dy;
}
Also used : Point3D_F64(georegression.struct.point.Point3D_F64) Point2D_F64(georegression.struct.point.Point2D_F64)

Example 77 with Point3D_F64

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

the class ParamFundamentalEpipolar method selectColumns.

private void selectColumns(DMatrixRMaj F) {
    Point3D_F64 e1 = new Point3D_F64();
    Point3D_F64 e2 = new Point3D_F64();
    MultiViewOps.extractEpipoles(F, e1, e2);
    // if the right epipole lies at infinity (z=0) then don't use the first two columns
    if (Math.abs(e2.z) <= UtilEjml.EPS) {
        col0 = 1;
        col1 = 2;
        col2 = 0;
    } else {
        col0 = 0;
        col1 = 1;
        col2 = 2;
    }
}
Also used : Point3D_F64(georegression.struct.point.Point3D_F64)

Example 78 with Point3D_F64

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

the class TestVisualDepthOps method compute.

private Point3D_F64 compute(int x, int y, int distance) {
    Point2D_F64 n = new Point2D_F64();
    RemoveRadialPtoN_F64 p2n = new RemoveRadialPtoN_F64();
    p2n.setK(param.fx, param.fy, param.skew, param.cx, param.cy).setDistortion(param.radial, param.t1, param.t2);
    p2n.compute(x, y, n);
    Point3D_F64 p = new Point3D_F64();
    p.z = distance;
    p.x = n.x * p.z;
    p.y = n.y * p.z;
    return p;
}
Also used : Point3D_F64(georegression.struct.point.Point3D_F64) Point2D_F64(georegression.struct.point.Point2D_F64) RemoveRadialPtoN_F64(boofcv.alg.distort.radtan.RemoveRadialPtoN_F64)

Example 79 with Point3D_F64

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

the class TestVisualDepthOps method depthTo3D_with_rgb.

@Test
public void depthTo3D_with_rgb() {
    GrayU16 depth = new GrayU16(width, height);
    depth.set(200, 80, 3400);
    depth.set(600, 420, 50);
    Planar<GrayU8> rgb = new Planar<>(GrayU8.class, width, height, 3);
    GImageMiscOps.fillUniform(rgb, rand, 0, 200);
    FastQueue<Point3D_F64> pts = new FastQueue<>(Point3D_F64.class, true);
    FastQueueArray_I32 color = new FastQueueArray_I32(3);
    VisualDepthOps.depthTo3D(param, rgb, depth, pts, color);
    assertEquals(2, pts.size());
    assertEquals(2, color.size());
    assertEquals(0, compute(200, 80, 3400).distance(pts.get(0)), 1e-8);
    assertEquals(0, compute(600, 420, 50).distance(pts.get(1)), 1e-8);
    color(200, 80, rgb, color.get(0));
    color(600, 420, rgb, color.get(1));
}
Also used : Point3D_F64(georegression.struct.point.Point3D_F64) GrayU16(boofcv.struct.image.GrayU16) FastQueue(org.ddogleg.struct.FastQueue) Planar(boofcv.struct.image.Planar) GrayU8(boofcv.struct.image.GrayU8) FastQueueArray_I32(boofcv.struct.FastQueueArray_I32) Test(org.junit.Test)

Example 80 with Point3D_F64

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

the class TestAssociateStereo2D method positive.

/**
 * Very simple positive case with only a perfect observation and descriptor
 */
@Test
public void positive() {
    Point3D_F64 X = new Point3D_F64(0.02, -0.5, 3);
    SfmTestHelper.renderPointPixel(param, X, leftP, rightP);
    pointsLeft.grow().set(leftP);
    pointsRight.grow().set(rightP);
    descLeft.grow();
    descRight.grow();
    AssociateStereo2D<TupleDesc_F64> alg = new AssociateStereo2D<>(scorer, 0.5, TupleDesc_F64.class);
    alg.setCalibration(param);
    alg.setSource(pointsLeft, descLeft);
    alg.setDestination(pointsRight, descRight);
    alg.associate();
    FastQueue<AssociatedIndex> matches = alg.getMatches();
    assertEquals(1, matches.size);
}
Also used : Point3D_F64(georegression.struct.point.Point3D_F64) TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64) AssociatedIndex(boofcv.struct.feature.AssociatedIndex) 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