Search in sources :

Example 1 with FilterImageInterface

use of boofcv.abst.filter.FilterImageInterface in project BoofCV by lessthanoptimal.

the class TestFactoryConvolveDown method convolve1D_I32.

@Test
public void convolve1D_I32() {
    Kernel1D_S32 kernel = FactoryKernel.random1D_I32(kernelWidth, radius, 1, 6, rand);
    FilterImageInterface conv;
    GrayU8 input = new GrayU8(width, height);
    GrayS16 found = new GrayS16(width / skip, height);
    GrayS16 expected = new GrayS16(width / skip, height);
    ImageMiscOps.fillUniform(input, rand, 0, 5);
    // CHECK NO BORDER
    conv = FactoryConvolveDown.convolveSB(kernel, BorderType.SKIP, true, skip, GrayU8.class, GrayI16.class);
    conv.process(input, found);
    ConvolveImageDownNoBorder.horizontal(kernel, input, expected, skip);
    BoofTesting.assertEquals(expected, found, 0);
    // CHECK EXTENDED
    // conv = FactoryConvolveDown.convolve( kernel,GrayU8.class, ImageInt16.class,BorderType.EXTENDED,true);
    // conv.process(input,found);
    // ConvolveWithBorder.horizontal(kernel,input,expected);
    // BoofTesting.assertEquals(expected,found,0);
    // CHECK NORMALIZED
    GrayU8 found8 = new GrayU8(width / skip, height);
    GrayU8 expected8 = new GrayU8(width / skip, height);
    conv = FactoryConvolveDown.convolveSB(kernel, BorderType.NORMALIZED, true, skip, GrayU8.class, GrayI8.class);
    conv.process(input, found8);
    ConvolveImageDownNormalized.horizontal(kernel, input, expected8, skip);
    BoofTesting.assertEquals(expected8, found8, 0);
}
Also used : Kernel1D_S32(boofcv.struct.convolve.Kernel1D_S32) FilterImageInterface(boofcv.abst.filter.FilterImageInterface) Test(org.junit.Test)

Example 2 with FilterImageInterface

use of boofcv.abst.filter.FilterImageInterface in project BoofCV by lessthanoptimal.

the class TestFactoryConvolveDown method convolve2D_I32.

@Test
public void convolve2D_I32() {
    Kernel2D_S32 kernel = FactoryKernel.random2D_I32(kernelWidth, radius, 1, 6, rand);
    FilterImageInterface conv;
    GrayU8 input = new GrayU8(width, height);
    GrayS16 found = new GrayS16(width / skip, height / skip);
    GrayS16 expected = new GrayS16(width / skip, height / skip);
    ImageMiscOps.fillUniform(input, rand, 0, 5);
    // CHECK NO BORDER
    conv = FactoryConvolveDown.convolveSB(kernel, BorderType.SKIP, skip, GrayU8.class, GrayI16.class);
    conv.process(input, found);
    ConvolveImageDownNoBorder.convolve(kernel, input, expected, skip);
    BoofTesting.assertEquals(expected, found, 0);
    // CHECK EXTENDED
    // conv = FactoryConvolveDown.convolve( kernel,GrayU8.class,ImageInt16.class,BorderType.EXTENDED);
    // conv.process(input,found);
    // ConvolveWithBorder.convolve(kernel,input,expected);
    // BoofTesting.assertEquals(expected,found,0);
    // CHECK NORMALIZED
    GrayU8 found8 = new GrayU8(width / skip, height / skip);
    GrayU8 expected8 = new GrayU8(width / skip, height / skip);
    conv = FactoryConvolveDown.convolveSB(kernel, BorderType.NORMALIZED, skip, GrayU8.class, GrayU8.class);
    conv.process(input, found8);
    ConvolveImageDownNormalized.convolve(kernel, input, expected8, skip);
    BoofTesting.assertEquals(expected8, found8, 0);
}
Also used : FilterImageInterface(boofcv.abst.filter.FilterImageInterface) Kernel2D_S32(boofcv.struct.convolve.Kernel2D_S32) Test(org.junit.Test)

Aggregations

FilterImageInterface (boofcv.abst.filter.FilterImageInterface)2 Test (org.junit.Test)2 Kernel1D_S32 (boofcv.struct.convolve.Kernel1D_S32)1 Kernel2D_S32 (boofcv.struct.convolve.Kernel2D_S32)1