use of boofcv.struct.feature.TupleDesc_S8 in project BoofCV by lessthanoptimal.
the class TestTestConvertReal_F64_S8 method createOutput.
@Test
public void createOutput() {
ConvertReal_F64_S8 alg = new ConvertReal_F64_S8(5);
TupleDesc_S8 found = alg.createOutput();
assertTrue(5 == found.value.length);
}
use of boofcv.struct.feature.TupleDesc_S8 in project BoofCV by lessthanoptimal.
the class TestTestConvertReal_F64_S8 method convert.
@Test
public void convert() {
ConvertReal_F64_S8 alg = new ConvertReal_F64_S8(5);
TupleDesc_F64 input = new TupleDesc_F64(5);
input.value = new double[] { -2.5, 3, 20, -243.45 };
TupleDesc_S8 found = alg.createOutput();
alg.convert(input, found);
TupleDesc_S8 expected = alg.createOutput();
ConvertDescriptors.real(input, expected);
for (int i = 0; i < 5; i++) {
assertEquals(expected.value[i], found.value[i]);
}
}
use of boofcv.struct.feature.TupleDesc_S8 in project BoofCV by lessthanoptimal.
the class CompareConvertedDescriptionsApp method main.
public static void main(String[] args) {
String file1 = UtilIO.pathExample("stitch/kayak_01.jpg");
String file2 = UtilIO.pathExample("stitch/kayak_02.jpg");
InterestPointDetector<GrayF32> detector = FactoryInterestPoint.fastHessian(new ConfigFastHessian(1, 10, -1, 2, 9, 4, 4));
DescribeRegionPoint<GrayF32, TupleDesc_F64> describeA = (DescribeRegionPoint) FactoryDescribeRegionPoint.surfStable(null, GrayF32.class);
ConvertTupleDesc<TupleDesc_F64, TupleDesc_S8> converter = FactoryConvertTupleDesc.real_F64_S8(describeA.createDescription().size());
DescribeRegionPoint<GrayF32, TupleDesc_S8> describeB = new DescribeRegionPointConvert<>(describeA, converter);
ScoreAssociation<TupleDesc_F64> scoreA = FactoryAssociation.scoreSad(TupleDesc_F64.class);
ScoreAssociation<TupleDesc_S8> scoreB = FactoryAssociation.scoreSad(TupleDesc_S8.class);
BufferedImage image1 = UtilImageIO.loadImage(file1);
BufferedImage image2 = UtilImageIO.loadImage(file2);
visualize("Original", image1, image2, detector, describeA, scoreA);
visualize("Modified", image1, image2, detector, describeB, scoreB);
System.out.println("Done");
}
use of boofcv.struct.feature.TupleDesc_S8 in project BoofCV by lessthanoptimal.
the class TestConvertDescriptors method real_F64.
/**
* General test with a known output
*/
@Test
public void real_F64() {
TupleDesc_F64 input = new TupleDesc_F64(4);
input.value = new double[] { 1, -2, 3, -4 };
TupleDesc_S8 output = new TupleDesc_S8(4);
ConvertDescriptors.real(input, output);
assertEquals((int) (1 * 127.0 / 4.0), output.value[0]);
assertEquals((int) (-2 * 127.0 / 4.0), output.value[1]);
assertEquals((int) (3 * 127.0 / 4.0), output.value[2]);
assertEquals((int) (-4 * 127.0 / 4.0), output.value[3]);
}
use of boofcv.struct.feature.TupleDesc_S8 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]);
}
Aggregations