Search in sources :

Example 6 with TupleDesc_U8

use of boofcv.struct.feature.TupleDesc_U8 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 7 with TupleDesc_U8

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

the class TestScoreAssociateSad_U8 method compareToExpected.

@Test
public void compareToExpected() {
    ScoreAssociateSad_U8 scorer = new ScoreAssociateSad_U8();
    TupleDesc_U8 a = new TupleDesc_U8(5);
    TupleDesc_U8 b = new TupleDesc_U8(5);
    a.value = new byte[] { 1, 2, 3, 4, (byte) 200 };
    b.value = new byte[] { (byte) 245, 2, 6, 3, 6 };
    assertEquals(442, scorer.score(a, b), 1e-2);
}
Also used : TupleDesc_U8(boofcv.struct.feature.TupleDesc_U8) Test(org.junit.Test)

Aggregations

TupleDesc_U8 (boofcv.struct.feature.TupleDesc_U8)7 Test (org.junit.Test)5 TupleDesc_F64 (boofcv.struct.feature.TupleDesc_F64)3