Search in sources :

Example 36 with TupleDesc_F64

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

the class TestConvertDescriptors method positive_F64.

/**
 * General test with a known output
 */
@Test
public void positive_F64() {
    TupleDesc_F64 input = new TupleDesc_F64(4);
    input.value = new double[] { 1, 2, 3, 4 };
    TupleDesc_U8 output = new TupleDesc_U8(4);
    ConvertDescriptors.positive(input, output);
    assertEquals((int) (1 * 255.0 / 4.0), output.value[0] & 0xFF);
    assertEquals((int) (2 * 255.0 / 4.0), output.value[1] & 0xFF);
    assertEquals((int) (3 * 255.0 / 4.0), output.value[2] & 0xFF);
    assertEquals((int) (4 * 255.0 / 4.0), output.value[3] & 0xFF);
}
Also used : TupleDesc_U8(boofcv.struct.feature.TupleDesc_U8) TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64) Test(org.junit.Test)

Example 37 with TupleDesc_F64

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

the class TestUtilFeature method combine.

@Test
public void combine() {
    TupleDesc_F64 feature0 = new TupleDesc_F64(64);
    TupleDesc_F64 feature1 = new TupleDesc_F64(32);
    feature0.value[5] = 10;
    feature1.value[3] = 13;
    List<TupleDesc_F64> list = new ArrayList<>();
    list.add(feature0);
    list.add(feature1);
    TupleDesc_F64 combined = UtilFeature.combine(list, null);
    assertEquals(10, combined.getDouble(5), 1e-8);
    assertEquals(13, combined.getDouble(67), 1e-8);
}
Also used : TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 38 with TupleDesc_F64

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

the class TestUtilFeature method normalizeSumOne_F64.

@Test
public void normalizeSumOne_F64() {
    TupleDesc_F64 feature = new TupleDesc_F64(64);
    feature.value[5] = 2;
    feature.value[10] = 4;
    UtilFeature.normalizeSumOne(feature);
    double total = 0;
    for (int i = 0; i < feature.size(); i++) {
        total += feature.getDouble(i);
    }
    assertEquals(1, total, 1e-8);
}
Also used : TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64) Test(org.junit.Test)

Example 39 with TupleDesc_F64

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

the class BenchmarkAssociationSpeedSurf method main.

public static void main(String[] argsp) {
    BenchmarkAssociationSpeedSurf app = new BenchmarkAssociationSpeedSurf();
    ScoreAssociation<TupleDesc_F64> score = FactoryAssociation.scoreEuclidean(TupleDesc_F64.class, true);
    int DOF = app.detector.createDescription().size();
    ProfileOperation.printOpsPerSec(app.createProfile("Greedy", FactoryAssociation.greedy(score, Double.MAX_VALUE, false)), TEST_TIME);
    ProfileOperation.printOpsPerSec(app.createProfile("Greedy Backwards", FactoryAssociation.greedy(score, Double.MAX_VALUE, true)), TEST_TIME);
    ProfileOperation.printOpsPerSec(app.createProfile("Random Forest", FactoryAssociation.kdRandomForest(DOF, 500, 15, 5, 1233445565)), TEST_TIME);
}
Also used : TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64) DetectDescribePoint(boofcv.abst.feature.detdesc.DetectDescribePoint)

Example 40 with TupleDesc_F64

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

the class DescribeDenseHogAlg method process.

/**
 * Computes the descriptor across the input image
 */
@Override
public void process() {
    locations.reset();
    descriptions.reset();
    int stepBlockPixelsX = pixelsPerCell * stepBlock;
    int stepBlockPixelsY = pixelsPerCell * stepBlock;
    int maxY = derivX.height - pixelsPerCell * cellsPerBlockY + 1;
    int maxX = derivX.width - pixelsPerCell * cellsPerBlockX + 1;
    for (int y = 0; y < maxY; y += stepBlockPixelsY) {
        for (int x = 0; x < maxX; x += stepBlockPixelsX) {
            TupleDesc_F64 d = descriptions.grow();
            Arrays.fill(d.value, 0);
            histogram = d.value;
            for (int cellRow = 0; cellRow < cellsPerBlockY; cellRow++) {
                int blockPixelRow = cellRow * pixelsPerCell;
                for (int cellCol = 0; cellCol < cellsPerBlockX; cellCol++) {
                    int blockPixelCol = cellCol * pixelsPerCell;
                    computeCellHistogram(x + blockPixelCol, y + blockPixelRow, cellCol, cellRow);
                }
            }
            DescribeSiftCommon.normalizeDescriptor(d, 0.2);
            locations.grow().set(x, y);
        }
    }
}
Also used : TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64)

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