use of boofcv.struct.convolve.Kernel1D_S32 in project BoofCV by lessthanoptimal.
the class ConvolveImageMean method horizontal.
/**
* Performs a horizontal 1D mean box filter. Outside pixels are specified by a border.
*
* @param input The input image. Not modified.
* @param output Where the resulting image is written to. Modified.
* @param offset Start offset from pixel coordinate
* @param binput Used to process image borders. If null borders are not processed.
* @param length How long the mean filter is
*/
public static void horizontal(GrayU8 input, GrayI8 output, int offset, int length, @Nullable ImageBorder_S32<GrayU8> binput) {
output.reshape(input.width, output.height);
if (binput != null) {
binput.setImage(input);
Kernel1D_S32 kernel = FactoryKernel.table1D_S32(offset, length);
ConvolveJustBorder_General_SB.horizontal(kernel, binput, output, kernel.computeSum());
}
if (length <= input.width) {
if (BoofConcurrency.USE_CONCURRENT) {
ImplConvolveMean_MT.horizontal(input, output, offset, length);
} else {
ImplConvolveMean.horizontal(input, output, offset, length);
}
}
}
use of boofcv.struct.convolve.Kernel1D_S32 in project BoofCV by lessthanoptimal.
the class BlurImageOps method gaussian.
/**
* Applies Gaussian blur.
*
* @param input Input image. Not modified.
* @param output (Optional) Storage for output image, Can be null. Modified.
* @param sigmaX Gaussian distribution's sigma along x-axis. If ≤ 0 then will be selected based on radius.
* @param radiusX Radius of the Gaussian blur function along x-axis. If ≤ 0 then radius will be determined by sigma.
* @param sigmaY Gaussian distribution's sigma along y-axis. If ≤ 0 then will be selected based on radius.
* @param radiusY Radius of the Gaussian blur function along y-axis. If ≤ 0 then radius will be determined by sigma.
* @param storage (Optional) Storage for intermediate results. Same size as input image. Can be null.
* @return Output blurred image.
*/
public static InterleavedU8 gaussian(InterleavedU8 input, @Nullable InterleavedU8 output, double sigmaX, int radiusX, double sigmaY, int radiusY, @Nullable InterleavedU8 storage) {
output = InputSanityCheck.declareOrReshape(input, output);
storage = InputSanityCheck.declareOrReshape(input, storage);
boolean processed = BOverrideBlurImageOps.invokeNativeGaussian(input, output, sigmaX, radiusX, sigmaY, radiusY, storage);
if (!processed) {
Kernel1D_S32 kernelX = FactoryKernelGaussian.gaussian(Kernel1D_S32.class, sigmaX, radiusX);
Kernel1D_S32 kernelY = sigmaX == sigmaY && radiusX == radiusY ? kernelX : FactoryKernelGaussian.gaussian(Kernel1D_S32.class, sigmaY, radiusY);
ConvolveImageNormalized.horizontal(kernelX, input, storage);
ConvolveImageNormalized.vertical(kernelY, storage, output);
}
return output;
}
use of boofcv.struct.convolve.Kernel1D_S32 in project BoofCV by lessthanoptimal.
the class BlurImageOps method gaussian.
/**
* Applies Gaussian blur.
*
* @param input Input image. Not modified.
* @param output (Optional) Storage for output image, Can be null. Modified.
* @param sigmaX Gaussian distribution's sigma along x-axis. If ≤ 0 then will be selected based on radius.
* @param radiusX Radius of the Gaussian blur function along x-axis. If ≤ 0 then radius will be determined by sigma.
* @param sigmaY Gaussian distribution's sigma along y-axis. If ≤ 0 then will be selected based on radius.
* @param radiusY Radius of the Gaussian blur function along y-axis. If ≤ 0 then radius will be determined by sigma.
* @param storage (Optional) Storage for intermediate results. Same size as input image. Can be null.
* @return Output blurred image.
*/
public static GrayU16 gaussian(GrayU16 input, @Nullable GrayU16 output, double sigmaX, int radiusX, double sigmaY, int radiusY, @Nullable GrayU16 storage) {
output = InputSanityCheck.declareOrReshape(input, output);
storage = InputSanityCheck.declareOrReshape(input, storage);
boolean processed = BOverrideBlurImageOps.invokeNativeGaussian(input, output, sigmaX, radiusX, sigmaY, radiusY, storage);
if (!processed) {
Kernel1D_S32 kernelX = FactoryKernelGaussian.gaussian(Kernel1D_S32.class, sigmaX, radiusX);
Kernel1D_S32 kernelY = sigmaX == sigmaY && radiusX == radiusY ? kernelX : FactoryKernelGaussian.gaussian(Kernel1D_S32.class, sigmaY, radiusY);
ConvolveImageNormalized.horizontal(kernelX, input, storage);
ConvolveImageNormalized.vertical(kernelY, storage, output);
}
return output;
}
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, GrayS32 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);
}
}
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(GrayS16 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);
}
}
Aggregations