Search in sources :

Example 51 with TupleDesc_F64

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

the class TestConvertDescriptors method real_F64_zeros.

/**
 * Test pathological case where the input is all zeros
 */
@Test
public void real_F64_zeros() {
    TupleDesc_F64 input = new TupleDesc_F64(4);
    TupleDesc_S8 output = new TupleDesc_S8(4);
    ConvertDescriptors.real(input, output);
    for (int i = 0; i < 4; i++) assertEquals(0, output.value[0]);
}
Also used : TupleDesc_S8(boofcv.struct.feature.TupleDesc_S8) TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64) Test(org.junit.Test)

Example 52 with TupleDesc_F64

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

the class TestUtilFeature method normalizeSumOne_zeros_F64.

/**
 * The descriptor is all zeros.  See if it handles this special case.
 */
@Test
public void normalizeSumOne_zeros_F64() {
    TupleDesc_F64 feature = new TupleDesc_F64(64);
    UtilFeature.normalizeSumOne(feature);
    for (int i = 0; i < feature.value.length; i++) assertEquals(0, feature.value[i], 1e-4);
}
Also used : TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64) Test(org.junit.Test)

Example 53 with TupleDesc_F64

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

the class TestUtilFeature method normalizeL2_zeros_F64.

/**
 * The descriptor is all zeros.  See if it handles this special case.
 */
@Test
public void normalizeL2_zeros_F64() {
    TupleDesc_F64 feature = new TupleDesc_F64(64);
    UtilFeature.normalizeL2(feature);
    for (int i = 0; i < feature.value.length; i++) assertEquals(0, feature.value[i], 1e-4);
}
Also used : TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64) Test(org.junit.Test)

Example 54 with TupleDesc_F64

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

the class TestUtilFeature method normalizeL2_F64.

@Test
public void normalizeL2_F64() {
    TupleDesc_F64 feature = new TupleDesc_F64(64);
    feature.value[5] = 2;
    feature.value[10] = 4;
    UtilFeature.normalizeL2(feature);
    assertEquals(0.44721, feature.value[5], 1e-3);
    assertEquals(0.89443, feature.value[10], 1e-3);
}
Also used : TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64) Test(org.junit.Test)

Example 55 with TupleDesc_F64

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

the class TestFeatureToWordHistogram_F64 method reset.

@Test
public void reset() {
    FeatureToWordHistogram_F64 alg = new FeatureToWordHistogram_F64(new Assign(), true);
    for (int i = 0; i < 7; i++) {
        alg.addFeature(new TupleDesc_F64(5));
    }
    alg.process();
    // reset should clear previous history
    alg.reset();
    alg.addFeature(new TupleDesc_F64(5));
    alg.process();
    double[] histogram = alg.getHistogram();
    checkSumOne(alg, histogram);
    assertEquals(0, histogram[0], 1e-8);
    assertEquals(0, histogram[1], 1e-8);
    assertEquals(1, histogram[2], 1e-8);
    assertEquals(0, histogram[3], 1e-8);
    assertEquals(0, histogram[4], 1e-8);
}
Also used : TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64) 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