use of boofcv.struct.convolve.Kernel1D in project BoofCV by lessthanoptimal.
the class TestConvolveImageStandard_SB method verticalDiv.
/**
* Unit test for vertical convolution with division.
*/
public void verticalDiv(ImageGray img, ImageGray dest) {
Kernel1D ker = FactoryKernel.createKernelForImage(kernelWidth, kernelRadius, 1, img.getClass());
// standard symmetric odd kernel shape
ker = FactoryKernel.random(ker.getClass(), kernelWidth, kernelRadius, 0, maxKernelValue, rand);
checkVerticalDiv(ker, img, dest);
// odd non-symmetric kernel shape
ker = FactoryKernel.random(ker.getClass(), kernelWidth, 0, 0, maxKernelValue, rand);
checkVerticalDiv(ker, img, dest);
// even non-symmetric kernel shape
ker = FactoryKernel.random(ker.getClass(), 2, 1, 0, maxKernelValue, rand);
checkVerticalDiv(ker, img, dest);
}
use of boofcv.struct.convolve.Kernel1D in project BoofCV by lessthanoptimal.
the class TestImageLocalNormalization method zeroMeanStdOne_kernel.
@Test
public void zeroMeanStdOne_kernel() {
for (Class type : types) {
int bits = type == GrayF32.class ? 32 : 64;
Kernel1D kernel = FactoryKernelGaussian.gaussian(1, true, bits, -1, radius);
GrayF input = (GrayF) GeneralizedImageOps.createSingleBand(type, width, height);
GrayF found = (GrayF) GeneralizedImageOps.createSingleBand(type, width, height);
GImageMiscOps.fillUniform(input, rand, 0, maxPixelValue);
ImageLocalNormalization alg = new ImageLocalNormalization(type, BorderType.NORMALIZED);
alg.zeroMeanStdOne(kernel, input, maxPixelValue, delta, found);
compareToExpected(input, kernel, found);
}
}
use of boofcv.struct.convolve.Kernel1D in project BoofCV by lessthanoptimal.
the class TestImageLocalNormalization method zeroMeanStdOne.
@Test
public void zeroMeanStdOne() {
Kernel1D kernel = FactoryKernel.table1D_F64(radius, false);
for (Class type : types) {
GrayF input = (GrayF) GeneralizedImageOps.createSingleBand(type, width, height);
GrayF found = (GrayF) GeneralizedImageOps.createSingleBand(type, width, height);
GImageMiscOps.fillUniform(input, rand, 0, maxPixelValue);
ImageLocalNormalization alg = new ImageLocalNormalization(type, BorderType.NORMALIZED);
alg.zeroMeanStdOne(radius, input, maxPixelValue, delta, found);
compareToExpected(input, kernel, found);
}
}
use of boofcv.struct.convolve.Kernel1D in project BoofCV by lessthanoptimal.
the class FactoryPyramid method discreteGaussian.
/**
* Creates an updater for discrete pyramids where a Gaussian is convolved across the input
* prior to sub-sampling.
*
* @param imageType Type of input image.
* @param sigma Gaussian sigma. If < 0 then a sigma is selected using the radius. Try -1.
* @param radius Radius of the Gaussian kernel. If < 0 then the radius is selected using sigma. Try 2.
* @return PyramidDiscrete
*/
public static <T extends ImageBase<T>> PyramidDiscrete<T> discreteGaussian(int[] scaleFactors, double sigma, int radius, boolean saveOriginalReference, ImageType<T> imageType) {
Class<Kernel1D> kernelType = FactoryKernel.getKernelType(imageType.getDataType(), 1);
Kernel1D kernel = FactoryKernelGaussian.gaussian(kernelType, sigma, radius);
return new PyramidDiscreteSampleBlur<>(kernel, sigma, imageType, saveOriginalReference, scaleFactors);
}
use of boofcv.struct.convolve.Kernel1D in project BoofCV by lessthanoptimal.
the class NoCacheScaleSpace method setActiveScale.
@Override
public void setActiveScale(int index) {
this.currentScale = index;
double sigma = scales[index];
int radius = FactoryKernelGaussian.radiusForSigma(sigma, 0);
Kernel1D kernel = FactoryKernelGaussian.gaussian1D(inputType, sigma, radius);
ImageType<I> _imageType = ImageType.single(inputType);
ConvolveInterface<I, I> blurX = FactoryConvolve.convolve(kernel, _imageType, _imageType, borderBlur, true);
ConvolveInterface<I, I> blurY = FactoryConvolve.convolve(kernel, _imageType, _imageType, borderBlur, false);
// compute the scale image
blurX.process(originalImage, workImage);
blurY.process(workImage, scaledImage);
anyDeriv.setInput(scaledImage);
}
Aggregations