Search in sources :

Example 1 with TupleDesc_U8

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

the class TestConvertPositive_F64_U8 method convert.

@Test
public void convert() {
    ConvertPositive_F64_U8 alg = new ConvertPositive_F64_U8(5);
    TupleDesc_F64 input = new TupleDesc_F64(5);
    input.value = new double[] { 2.5, 3, 20, -43.45 };
    TupleDesc_U8 found = alg.createOutput();
    alg.convert(input, found);
    TupleDesc_U8 expected = alg.createOutput();
    ConvertDescriptors.positive(input, expected);
    for (int i = 0; i < 5; i++) {
        assertEquals(expected.value[i], found.value[i]);
    }
}
Also used : TupleDesc_U8(boofcv.struct.feature.TupleDesc_U8) TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64) Test(org.junit.Test)

Example 2 with TupleDesc_U8

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

the class TestConvertPositive_F64_U8 method createOutput.

@Test
public void createOutput() {
    ConvertPositive_F64_U8 alg = new ConvertPositive_F64_U8(5);
    TupleDesc_U8 found = alg.createOutput();
    assertTrue(5 == found.value.length);
}
Also used : TupleDesc_U8(boofcv.struct.feature.TupleDesc_U8) Test(org.junit.Test)

Example 3 with TupleDesc_U8

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

the class TestImplDescribePointPixelRegion_U8 method checkBorder.

public void checkBorder(GrayU8 image, int c_x, int c_y, int w, int h) {
    ImplDescribePointPixelRegion_U8 alg = new ImplDescribePointPixelRegion_U8(w, h);
    TupleDesc_U8 desc = new TupleDesc_U8(alg.getDescriptorLength());
    alg.setImage(image);
    alg.process(c_x, c_y, desc);
    int index = 0;
    int y0 = c_y - h / 2;
    int x0 = c_x - w / 2;
    for (int y = y0; y < y0 + h; y++) {
        for (int x = x0; x < x0 + w; x++, index++) {
            if (image.isInBounds(x, y))
                assertEquals(image.get(x, y), desc.value[index], 1e-4);
            else
                assertEquals(0, desc.value[index], 1e-4);
        }
    }
}
Also used : TupleDesc_U8(boofcv.struct.feature.TupleDesc_U8)

Example 4 with TupleDesc_U8

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

the class TestImplDescribePointPixelRegion_U8 method checkInner.

public void checkInner(GrayU8 image, int c_x, int c_y, int w, int h) {
    ImplDescribePointPixelRegion_U8 alg = new ImplDescribePointPixelRegion_U8(w, h);
    TupleDesc_U8 desc = new TupleDesc_U8(alg.getDescriptorLength());
    alg.setImage(image);
    alg.process(c_x, c_y, desc);
    int index = 0;
    int y0 = c_y - h / 2;
    int x0 = c_x - w / 2;
    for (int y = y0; y < y0 + h; y++) {
        for (int x = x0; x < x0 + w; x++, index++) {
            assertEquals(image.get(x, y), desc.value[index], 1e-4);
        }
    }
}
Also used : TupleDesc_U8(boofcv.struct.feature.TupleDesc_U8)

Example 5 with TupleDesc_U8

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

the class TestConvertDescriptors method positive_F64_zeros.

/**
 * Test pathological case where the input is all zeros
 */
@Test
public void positive_F64_zeros() {
    TupleDesc_F64 input = new TupleDesc_F64(4);
    TupleDesc_U8 output = new TupleDesc_U8(4);
    ConvertDescriptors.positive(input, output);
    for (int i = 0; i < 4; i++) assertEquals(0, output.value[0]);
}
Also used : TupleDesc_U8(boofcv.struct.feature.TupleDesc_U8) TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64) 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