use of boofcv.struct.convolve.Kernel1D_S32 in project BoofCV by lessthanoptimal.
the class ConvolveImageMean method vertical.
/**
* Performs a vertical 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 vertical(GrayS16 input, GrayI16 output, int radius) {
boolean processed = BOverrideConvolveImageMean.invokeNativeVertical(input, output, radius);
if (!processed) {
Kernel1D_S32 kernel = FactoryKernel.table1D_I32(radius);
if (kernel.width > input.height) {
ConvolveImageNormalized.vertical(kernel, input, output);
} else {
InputSanityCheck.checkSameShape(input, output);
ConvolveNormalized_JustBorder_SB.vertical(kernel, input, output);
ImplConvolveMean.vertical(input, output, radius);
}
}
}
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) {
InputSanityCheck.checkSameShape(input, output);
Kernel1D_S32 kernel = FactoryKernel.table1D_I32(radius);
ConvolveJustBorder_General_SB.vertical(kernel, ImageBorderValue.wrap(input, 0), output);
ImplConvolveBox.vertical(input, output, radius);
}
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) {
InputSanityCheck.checkSameShape(input, output);
Kernel1D_S32 kernel = FactoryKernel.table1D_I32(radius);
ConvolveJustBorder_General_SB.vertical(kernel, ImageBorderValue.wrap(input, 0), output);
ImplConvolveBox.vertical(input, output, radius);
}
use of boofcv.struct.convolve.Kernel1D_S32 in project BoofCV by lessthanoptimal.
the class ExampleConvolution method convolve1D.
/**
* Convolves a 1D kernel horizontally and vertically
*/
private static void convolve1D(GrayU8 gray) {
ImageBorder<GrayU8> border = FactoryImageBorder.wrap(BorderType.EXTENDED, gray);
Kernel1D_S32 kernel = new Kernel1D_S32(2);
// specify the kernel's origin
kernel.offset = 1;
kernel.data[0] = 1;
kernel.data[1] = -1;
GrayS16 output = new GrayS16(gray.width, gray.height);
GConvolveImageOps.horizontal(kernel, gray, output, border);
panel.addImage(VisualizeImageData.standard(output, null), "1D Horizontal");
GConvolveImageOps.vertical(kernel, gray, output, border);
panel.addImage(VisualizeImageData.standard(output, null), "1D Vertical");
}
use of boofcv.struct.convolve.Kernel1D_S32 in project BoofCV by lessthanoptimal.
the class TestFactoryConvolve method convolve1D_I32.
@Test
void convolve1D_I32() {
Kernel1D_S32 kernel = FactoryKernel.random1D_I32(kernelWidth, radius, 1, 6, rand);
ConvolveInterface conv;
GrayU8 input = new GrayU8(width, height);
GrayS16 found = new GrayS16(width, height);
GrayS16 expected = new GrayS16(width, height);
ImageMiscOps.fillUniform(input, rand, 0, 5);
// CHECK NO BORDER
conv = FactoryConvolve.convolve(kernel, input.imageType, found.imageType, BorderType.SKIP, true);
conv.process(input, found);
ConvolveImageNoBorder.horizontal(kernel, input, expected);
BoofTesting.assertEquals(expected, found, 0);
// CHECK EXTENDED
conv = FactoryConvolve.convolve(kernel, input.imageType, found.imageType, BorderType.EXTENDED, true);
conv.process(input, found);
ConvolveImage.horizontal(kernel, input, expected, new ImageBorder1D_S32(BorderIndex1D_Extend::new));
BoofTesting.assertEquals(expected, found, 0);
// CHECK NORMALIZED
GrayU8 found8 = new GrayU8(width, height);
GrayU8 expected8 = new GrayU8(width, height);
conv = FactoryConvolve.convolve(kernel, input.imageType, ImageType.single(GrayI8.class), BorderType.NORMALIZED, true);
conv.process(input, found8);
ConvolveImageNormalized.horizontal(kernel, input, expected8);
BoofTesting.assertEquals(expected8, found8, 0);
}
Aggregations