Search in sources :

Example 21 with TupleDesc_F64

use of boofcv.struct.feature.TupleDesc_F64 in project BoofCV by lessthanoptimal.

the class TestDetectDescribeAssociate method addNewTrack.

@Test
public void addNewTrack() {
    Helper dat = new Helper();
    TupleDesc_F64 desc = dat.manager.createDescription();
    desc.value[0] = 5;
    PointTrack found0 = dat.addNewTrack(5, 10, desc);
    PointTrack found1 = dat.addNewTrack(8, 23, desc);
    // unique featureId should be assigned
    assertTrue(found0.featureId != found1.featureId);
    // make sure a copy is made
    assertTrue(found0.getDescription() != desc);
    assertTrue(((TupleDesc_F64) found0.getDescription()).value[0] == 5);
    // should check to see if the feature is valid
    assertTrue(dat.validCalled);
}
Also used : TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64) Test(org.junit.Test)

Example 22 with TupleDesc_F64

use of boofcv.struct.feature.TupleDesc_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)

Example 23 with TupleDesc_F64

use of boofcv.struct.feature.TupleDesc_F64 in project BoofCV by lessthanoptimal.

the class TestAssociateStereo2D method setup.

@Before
public void setup() {
    leftToRight = new Se3_F64();
    ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0.01, -0.001, 0.005, leftToRight.getR());
    leftToRight.getT().set(-0.1, 0, 0);
    param = new StereoParameters();
    param.rightToLeft = leftToRight.invert(null);
    param.left = new CameraPinholeRadial(400, 500, 0.1, 160, 120, 320, 240).fsetRadial(0, 0);
    param.right = new CameraPinholeRadial(380, 505, 0.05, 165, 115, 320, 240).fsetRadial(0, 0);
    descLeft = new FastQueue<TupleDesc_F64>(TupleDesc_F64.class, true) {

        @Override
        protected TupleDesc_F64 createInstance() {
            return new TupleDesc_F64(10);
        }
    };
    descRight = new FastQueue<TupleDesc_F64>(TupleDesc_F64.class, true) {

        @Override
        protected TupleDesc_F64 createInstance() {
            return new TupleDesc_F64(10);
        }
    };
    pointsLeft.reset();
    pointsRight.reset();
}
Also used : TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64) CameraPinholeRadial(boofcv.struct.calib.CameraPinholeRadial) StereoParameters(boofcv.struct.calib.StereoParameters) Se3_F64(georegression.struct.se.Se3_F64) Before(org.junit.Before)

Example 24 with TupleDesc_F64

use of boofcv.struct.feature.TupleDesc_F64 in project BoofCV by lessthanoptimal.

the class TestAssociateStereo2D method constraintX.

/**
 * Makes the observation in the left image &gt; right image along x-axis
 */
@Test
public void constraintX() {
    // zap the rotation so that no adjustment should need to be done
    CommonOps_DDRM.setIdentity(param.rightToLeft.getR());
    Point3D_F64 X = new Point3D_F64(0.02, -0.5, 3);
    SfmTestHelper.renderPointPixel(param, X, leftP, rightP);
    // mangle the x-axis
    leftP.x = rightP.x - 0.25;
    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();
    // at the current tolerance they should still match
    assertEquals(1, alg.getMatches().size);
    // make the tolerance tighter
    alg = new AssociateStereo2D<>(scorer, 0.01, TupleDesc_F64.class);
    alg.setCalibration(param);
    alg.setSource(pointsLeft, descLeft);
    alg.setDestination(pointsRight, descRight);
    alg.associate();
    assertEquals(0, alg.getMatches().size);
}
Also used : Point3D_F64(georegression.struct.point.Point3D_F64) TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64) Test(org.junit.Test)

Example 25 with TupleDesc_F64

use of boofcv.struct.feature.TupleDesc_F64 in project BoofCV by lessthanoptimal.

the class TestGHistogramFeatureOps method histogram_sb.

@Test
public void histogram_sb() {
    for (Class type : supported) {
        ImageGray image = GeneralizedImageOps.createSingleBand(type, width, height);
        GImageMiscOps.fillUniform(image, rand, 0, 200);
        TupleDesc_F64 found = new TupleDesc_F64(200);
        TupleDesc_F64 expected = new TupleDesc_F64(200);
        GHistogramFeatureOps.histogram(image, 0, 200, found);
        if (type == GrayF32.class) {
            HistogramFeatureOps.histogram((GrayF32) image, 0, 200, expected);
        } else {
            HistogramFeatureOps.histogram((GrayU8) image, 200, expected);
        }
        assertEquals(0, DescriptorDistance.euclidean(expected, found), 1e-8);
    }
}
Also used : TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64) ImageGray(boofcv.struct.image.ImageGray) Test(org.junit.Test)

Aggregations

TupleDesc_F64 (boofcv.struct.feature.TupleDesc_F64)66 Test (org.junit.Test)47 GrayF32 (boofcv.struct.image.GrayF32)17 GrayU8 (boofcv.struct.image.GrayU8)8 Point2D_I32 (georegression.struct.point.Point2D_I32)6 TupleDesc_S8 (boofcv.struct.feature.TupleDesc_S8)5 ArrayList (java.util.ArrayList)5 ConvertBufferedImage (boofcv.io.image.ConvertBufferedImage)4 BufferedImage (java.awt.image.BufferedImage)4 File (java.io.File)4 DescribeRegionPoint (boofcv.abst.feature.describe.DescribeRegionPoint)3 DetectDescribePoint (boofcv.abst.feature.detdesc.DetectDescribePoint)3 TupleDesc_U8 (boofcv.struct.feature.TupleDesc_U8)3 Planar (boofcv.struct.image.Planar)3 Point3D_F64 (georegression.struct.point.Point3D_F64)3 HistogramScene (boofcv.alg.scene.HistogramScene)2 AssociatedIndex (boofcv.struct.feature.AssociatedIndex)2 ImageGray (boofcv.struct.image.ImageGray)2 IOException (java.io.IOException)2 FastQueue (org.ddogleg.struct.FastQueue)2