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);
}
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);
}
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);
}
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);
}
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);
}
}
}
Aggregations