Search in sources :

Example 16 with Kernel1D_S32

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

the class ConvolveImageBox method vertical.

/**
 * Performs a vertical 1D convolution of a box kernel across the image
 *
 * @param input The original image. Not modified.
 * @param output Where the resulting image is written to. Modified.
 * @param radius Kernel size.
 */
public static void vertical(GrayU8 input, GrayI16 output, int radius, @Nullable GrowArray<DogArray_I32> work) {
    InputSanityCheck.checkSameShape(input, output);
    Kernel1D_S32 kernel = FactoryKernel.table1D_S32(radius);
    ConvolveJustBorder_General_SB.vertical(kernel, ImageBorderValue.wrap(input, 0), output);
    if (BoofConcurrency.USE_CONCURRENT) {
        ImplConvolveBox_MT.vertical(input, output, radius, work);
    } else {
        ImplConvolveBox.vertical(input, output, radius, work);
    }
}
Also used : Kernel1D_S32(boofcv.struct.convolve.Kernel1D_S32)

Example 17 with Kernel1D_S32

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

the class ConvolveImageBox method vertical.

/**
 * Performs a vertical 1D convolution of a box kernel across the image
 *
 * @param input The original image. Not modified.
 * @param output Where the resulting image is written to. Modified.
 * @param radius Kernel size.
 */
public static void vertical(GrayU8 input, GrayS32 output, int radius, @Nullable GrowArray<DogArray_I32> work) {
    InputSanityCheck.checkSameShape(input, output);
    Kernel1D_S32 kernel = FactoryKernel.table1D_S32(radius);
    ConvolveJustBorder_General_SB.vertical(kernel, ImageBorderValue.wrap(input, 0), output);
    if (BoofConcurrency.USE_CONCURRENT) {
        ImplConvolveBox_MT.vertical(input, output, radius, work);
    } else {
        ImplConvolveBox.vertical(input, output, radius, work);
    }
}
Also used : Kernel1D_S32(boofcv.struct.convolve.Kernel1D_S32)

Example 18 with Kernel1D_S32

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

the class ConvolveImageBox method horizontal.

/**
 * Performs a horizontal 1D convolution of a box kernel across the image
 *
 * @param input The original image. Not modified.
 * @param output Where the resulting image is written to. Modified.
 * @param radius Kernel size.
 */
public static void horizontal(GrayU8 input, GrayI16 output, int radius) {
    InputSanityCheck.checkSameShape(input, output);
    Kernel1D_S32 kernel = FactoryKernel.table1D_S32(radius);
    ConvolveJustBorder_General_SB.horizontal(kernel, ImageBorderValue.wrap(input, 0), output);
    if (BoofConcurrency.USE_CONCURRENT) {
        ImplConvolveBox_MT.horizontal(input, output, radius);
    } else {
        ImplConvolveBox.horizontal(input, output, radius);
    }
}
Also used : Kernel1D_S32(boofcv.struct.convolve.Kernel1D_S32)

Example 19 with Kernel1D_S32

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

the class TestConvolveNormalizedNaive_IL method horizontal.

/**
 * Check it against one specific type to see if the core algorithm is correct
 */
@Test
void horizontal() {
    Kernel1D_S32 kernel = new Kernel1D_S32(new int[] { 1, 2, 3, 4, 5, 6 }, 6, 4);
    InterleavedU8 input = new InterleavedU8(width, height, numBands);
    ImageMiscOps.fillUniform(input, rand, 0, 50);
    InterleavedU8 output = new InterleavedU8(width, height, numBands);
    ConvolveNormalizedNaive_IL.horizontal(kernel, input, output);
    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 = horizontal(x, y, band, kernel, input);
                int found = output.getBand(x, y, band);
                assertEquals(expected, found);
            }
        }
    }
}
Also used : Kernel1D_S32(boofcv.struct.convolve.Kernel1D_S32) InterleavedU8(boofcv.struct.image.InterleavedU8) Test(org.junit.jupiter.api.Test)

Example 20 with Kernel1D_S32

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

the class ConvolveImageMean method horizontal.

/**
 * Performs a horizontal 1D convolution which computes the mean value of elements
 * inside the kernel.
 *
 * @param input The original image. Not modified.
 * @param output Where the resulting image is written to. Modified.
 * @param radius Kernel size.
 */
public static void horizontal(GrayU8 input, GrayU8 output, int radius) {
    boolean processed = BOverrideConvolveImageMean.invokeNativeHorizontal(input, output, radius);
    if (!processed) {
        Kernel1D_S32 kernel = FactoryKernel.table1D_I32(radius);
        if (kernel.width > input.width) {
            ConvolveImageNormalized.horizontal(kernel, input, output);
        } else {
            InputSanityCheck.checkSameShape(input, output);
            ConvolveNormalized_JustBorder_SB.horizontal(kernel, input, output);
            ImplConvolveMean.horizontal(input, output, radius);
        }
    }
}
Also used : Kernel1D_S32(boofcv.struct.convolve.Kernel1D_S32)

Aggregations

Kernel1D_S32 (boofcv.struct.convolve.Kernel1D_S32)41 Test (org.junit.jupiter.api.Test)9 GrayU8 (boofcv.struct.image.GrayU8)7 Kernel1D_F32 (boofcv.struct.convolve.Kernel1D_F32)3 InterleavedU8 (boofcv.struct.image.InterleavedU8)3 GrayF32 (boofcv.struct.image.GrayF32)2 GrayS16 (boofcv.struct.image.GrayS16)2 FilterImageInterface (boofcv.abst.filter.FilterImageInterface)1 ImageBorder1D_S32 (boofcv.struct.border.ImageBorder1D_S32)1 Kernel2D_F32 (boofcv.struct.convolve.Kernel2D_F32)1 Kernel2D_S32 (boofcv.struct.convolve.Kernel2D_S32)1 GrayU16 (boofcv.struct.image.GrayU16)1 ImageGray (boofcv.struct.image.ImageGray)1 InterleavedU16 (boofcv.struct.image.InterleavedU16)1 Planar (boofcv.struct.image.Planar)1 Random (java.util.Random)1