Search in sources :

Example 1 with InterleavedU16

use of boofcv.struct.image.InterleavedU16 in project BoofCV by lessthanoptimal.

the class TestConvolveNormalizedNaive_IL method vertical2_U16_U8.

/**
 * Check it against one specific type to see if the core algorithm is correct
 */
@Test
public void vertical2_U16_U8() {
    Kernel1D_S32 kernelY = new Kernel1D_S32(new int[] { 1, 2, 3, 4, 5, 6 }, 6, 4);
    Kernel1D_S32 kernelX = new Kernel1D_S32(new int[] { 4, 2, 1, 4, 3, 6 }, 5, 2);
    InterleavedU16 input = new InterleavedU16(width, height, numBands);
    ImageMiscOps.fillUniform(input, rand, 0, 80);
    InterleavedU8 output = new InterleavedU8(width, height, numBands);
    ConvolveNormalizedNaive_IL.vertical(kernelX, kernelY, input, output);
    InterleavedU8 alt = new InterleavedU8(width, height, numBands);
    ConvolveImageNoBorder.vertical(kernelY, input, alt, kernelX.computeSum() * kernelY.computeSum());
    for (int y = 0; y < output.height; y++) {
        for (int x = 0; x < output.width; x++) {
            for (int band = 0; band < numBands; band++) {
                int expected = vertical2(x, y, band, kernelX, kernelY, input);
                int found = output.getBand(x, y, band);
                assertEquals(x + "  " + y, expected, found);
            }
        }
    }
}
Also used : Kernel1D_S32(boofcv.struct.convolve.Kernel1D_S32) InterleavedU8(boofcv.struct.image.InterleavedU8) InterleavedU16(boofcv.struct.image.InterleavedU16) Test(org.junit.Test)

Aggregations

Kernel1D_S32 (boofcv.struct.convolve.Kernel1D_S32)1 InterleavedU16 (boofcv.struct.image.InterleavedU16)1 InterleavedU8 (boofcv.struct.image.InterleavedU8)1 Test (org.junit.Test)1