Search in sources :

Example 11 with Kernel2D_S32

use of boofcv.struct.convolve.Kernel2D_S32 in project BoofCV by lessthanoptimal.

the class TestConvolveNormalizedNaive_SB method convolve.

/**
 * Check it against one specific type to see if the core algorithm is correct
 */
@Test
public void convolve() {
    Kernel2D_S32 kernel = FactoryKernel.random2D_I32(7, 3, 0, 20, rand);
    kernel.offset = 1;
    GrayU8 input = new GrayU8(15, 16);
    ImageMiscOps.fillUniform(input, rand, 0, 50);
    GrayU8 output = new GrayU8(15, 16);
    ConvolveNormalizedNaive_SB.convolve(kernel, input, output);
    for (int y = 0; y < output.height; y++) {
        for (int x = 0; x < output.width; x++) {
            int expected = convolve(x, y, kernel, input);
            int found = output.get(x, y);
            assertEquals(x + "  " + y, expected, found);
        }
    }
}
Also used : Kernel2D_S32(boofcv.struct.convolve.Kernel2D_S32) GrayU8(boofcv.struct.image.GrayU8) Test(org.junit.Test)

Aggregations

Kernel2D_S32 (boofcv.struct.convolve.Kernel2D_S32)11 GrayU8 (boofcv.struct.image.GrayU8)5 Test (org.junit.Test)5 IntegralKernel (boofcv.alg.transform.ii.IntegralKernel)2 FactoryGImageGray (boofcv.core.image.FactoryGImageGray)2 GImageGray (boofcv.core.image.GImageGray)2 ImageBorder_S32 (boofcv.core.image.border.ImageBorder_S32)2 ImageRectangle (boofcv.struct.ImageRectangle)2 GrayS32 (boofcv.struct.image.GrayS32)2 ImageGray (boofcv.struct.image.ImageGray)2 FilterImageInterface (boofcv.abst.filter.FilterImageInterface)1 BorderIndex1D_Extend (boofcv.core.image.border.BorderIndex1D_Extend)1 ImageBorder1D_S32 (boofcv.core.image.border.ImageBorder1D_S32)1 Kernel2D (boofcv.struct.convolve.Kernel2D)1 GrayS16 (boofcv.struct.image.GrayS16)1 InterleavedU8 (boofcv.struct.image.InterleavedU8)1