use of boofcv.struct.convolve.Kernel1D_F32 in project BoofCV by lessthanoptimal.
the class SiftDetector method createSparseDerivatives.
/**
* Define sparse image derivative operators.
*/
private void createSparseDerivatives() {
Kernel1D_F32 kernelD = new Kernel1D_F32(new float[] { -1, 0, 1 }, 3);
Kernel1D_F32 kernelDD = KernelMath.convolve1D_F32(kernelD, kernelD);
Kernel2D_F32 kernelXY = KernelMath.convolve2D(kernelD, kernelD);
derivXX = FactoryConvolveSparse.horizontal1D(GrayF32.class, kernelDD);
derivXY = FactoryConvolveSparse.convolve2D(GrayF32.class, kernelXY);
derivYY = FactoryConvolveSparse.vertical1D(GrayF32.class, kernelDD);
ImageBorder<GrayF32> border = FactoryImageBorder.single(BorderType.EXTENDED, GrayF32.class);
derivXX.setImageBorder(border);
derivXY.setImageBorder(border);
derivYY.setImageBorder(border);
}
use of boofcv.struct.convolve.Kernel1D_F32 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 InterleavedF32 gaussian(InterleavedF32 input, @Nullable InterleavedF32 output, double sigmaX, int radiusX, double sigmaY, int radiusY, @Nullable InterleavedF32 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_F32 kernelX = FactoryKernelGaussian.gaussian(Kernel1D_F32.class, sigmaX, radiusX);
Kernel1D_F32 kernelY = sigmaX == sigmaY && radiusX == radiusY ? kernelX : FactoryKernelGaussian.gaussian(Kernel1D_F32.class, sigmaY, radiusY);
ConvolveImageNormalized.horizontal(kernelX, input, storage);
ConvolveImageNormalized.vertical(kernelY, storage, output);
}
return output;
}
use of boofcv.struct.convolve.Kernel1D_F32 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(GrayF32 input, GrayF32 output, int radius, @Nullable GrowArray<DogArray_F32> work) {
InputSanityCheck.checkSameShape(input, output);
Kernel1D_F32 kernel = FactoryKernel.table1D_F32(radius, false);
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);
}
}
use of boofcv.struct.convolve.Kernel1D_F32 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(GrayF32 input, GrayF32 output, int radius) {
InputSanityCheck.checkSameShape(input, output);
Kernel1D_F32 kernel = FactoryKernel.table1D_F32(radius, false);
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_F32 in project BoofCV by lessthanoptimal.
the class BenchmarkImagePyramids method createUpdate.
private static void createUpdate() {
Kernel1D_F32 kernel = FactoryKernelGaussian.gaussian(Kernel1D_F32.class, -1.0, 2);
pyramidD = new PyramidDiscreteSampleBlur<>(kernel, 2, ImageType.single(GrayF32.class), true, scalesD);
pyramidF = FactoryPyramid.scaleSpacePyramid(scalesF, GrayF32.class);
}
Aggregations