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